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