MATLAB: Save face delimited – Matlab

bounding boxComputer Vision Toolboxface detection

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');

Best Answer

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