0
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
이 스크립트는 얼굴과 같이 찾습니다
이 좋다, 나는 단지의 경계를 확장 할을 더 많은 얼굴 (예 : 머리카락과 턱)을 캡처 할 수 있습니다.