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 Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by