刚接触 Matlab。我正在尝试实现一些代码来检测图像中的面部并裁剪它。我正在运行脚本,但它在检测到的脸部周围放置的边界框有点小。有没有办法改变边界框的尺寸以捕获更多的脸部?
clc;
% cd into the a folder with pictures
cd 'C:\Users\abc\Desktop\folder'
files = dir('*.jpg');
for file = files'
img = imread(file.name);
figure(1),imshow(img);
FaceDetect = vision.CascadeObjectDetector;
FaceDetect.MergeThreshold = 7;
BB = step(FaceDetect,img);
figure(2),imshow(img);
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',2,'LineStyle','- ','EdgeColor','r');
end
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',2,'LineStyle','- ','EdgeColor','r');
J = imcrop(img,BB(i,:));
figure(3);
imshow(J);
a = 'edited\'
b = file.name
output = strcat(a,b);
imwrite(J,output);
end
%Code End
end
Run Code Online (Sandbox Code Playgroud)
这很好,我只是想扩展裁剪区域的边界以捕捉更多的脸部(例如头发和下巴)。
我安装了Anaconda的副本来玩,但我决定更喜欢Homebrew,所以我删除了它.但是,这似乎搞砸了我安装的Jupyter笔记本,因为我无法再访问它.我重新安装它,pip install jupyter当我跑步时,pip show jupyter我得到:
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter@googlegroups.org
License: BSD
Location: /usr/local/lib/python2.7/site-packages
Requires: ipywidgets, nbconvert, notebook, jupyter-console, qtconsole, ipykernel
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时which -a jupyter我什么都没得到.我甚至尝试通过Homebrew再次卸载和安装python,它仍然给我错误,-bash: jupyter: command not found.
我正确安装which -a python了python,给出:
/usr/local/bin/python
/usr/bin/python
Run Code Online (Sandbox Code Playgroud)
关于为什么它可能不起作用的任何想法?