Face Detection Isolating faces

조회 수: 2 (최근 30일)
Jonathan
Jonathan 2013년 10월 25일
답변: Anandakumar Selvaraj 2013년 11월 27일
Hi guys, I have recently tried the viola jones cascedeobjectdetector to detect faces and it works great. The only thing that I am having trouble is to crop out the faces, isolate and save them individually. have used the icrop function but still stuck thinking of a method to isolate them.. Anyone have any idea?
  댓글 수: 1
Jonathan
Jonathan 2013년 10월 25일
At the moment I can only do one lame thing which is this. I=imread('1.jpg'); %I = rgb2gray(I); faceDetector = vision.CascadeObjectDetector(); bbox_face = step(faceDetector, I);
I_faces = insertObjectAnnotation(I, 'rectangle', bbox_face, 'Face'); figure, imshow(I_faces), title('Detected faces');
for i=1: length(bbox_face) Icrop= imcrop(I,bbox_face(i,:));
Y= Icrop; if i==1 imwrite(Y,'cropped.jpg'); elseif i==2 imwrite(Y,'cropped2.jpg' ); elseif i==3 imwrite(Y,'cropped3.jpg'); else imwrite(Y,'cropped4.jpg' );
end end
Do advice if theres a better way :D

댓글을 달려면 로그인하십시오.

답변 (1개)

Anandakumar Selvaraj
Anandakumar Selvaraj 2013년 11월 27일
you can try this code to crop the face
faceBBox = step(faceDetector,videoFrame);
x = faceBBox(1); y = faceBBox(2); w = faceBBox(3); h = faceBBox(4);
bboxPolygon = [x, y, x+w, y, x+w, y+1.56*h, x, y+1.56*h];
face = imcrop(videoFrame,faceBBox);

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by