Hello people. I used the algorithm below to detect the face of the people, but would like to save the cropped face, how can I do this?
A = imread ('marcelo.jpg');
FaceDetector = vision.CascadeObjectDetector();
BBOX = step(FaceDetector, A);
B = insertObjectAnnotation (A, 'rectangle', BBOX, 'Face'); imshow(B), title('Detected Faces');

 Akzeptierte Antwort

Image Analyst
Image Analyst am 2 Nov. 2016

0 Stimmen

Try putting (the badly-named) A and the bounding box into imcrop():
croppedImage = imcrop(A, BBOX);

2 Kommentare

Valmir Junior
Valmir Junior am 19 Nov. 2016
Great worked thank you very much.
Would you kindly help me with another question?
I performed the delimitation of the face with his help, found the position of the eyes and through the position of the eyes aligned the image with the component imrotate.
I need now to delimit the image a little above the line of the eyes and also to delimit in the horizontal because when the alignment was done, the image was left unadjusted. Follows an image represented. Can you help me? Thanks in advance
rosto = (imrotate(rosto,(180/pi)*atan((BBREye(2)-BBLEye(2))/(BBREye(1)-BBLEye(1))))); imwrite(rosto, strcat('rotacionada.jpg'));
Image Analyst
Image Analyst am 20 Nov. 2016
imrotate has options where you can expand the canvass, or crop the image if the corners go outside the canvass. Perhaps you want the cropping option instead of the expand the canvass option.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by