How to crop detected face part?
Show older comments
a=imread('C:\Users\SanaUllah\Documents\MATLAB\face.jpg');
a=imresize(a,1);
subplot(3,3,1);
imshow(a);
detector=vision.CascadeObjectDetector('mouth');
detector.MergeThreshold=60;
boundingbox=step(detector,a);
out=insertObjectAnnotation(a,'rectangle',boundingbox,'mouth Detected','LineWidth',3,'TextColor','black');
subplot(3,3,2);
imshow(out)
1 Comment
Sana Ullah
on 3 Dec 2019
Accepted Answer
More Answers (2)
Philippe Lebel
on 3 Dec 2019
Edited: Philippe Lebel
on 3 Dec 2019
RGB Images are 3D matrices with dimenions = (resolution_x, resolution_y, 3)
I suppose the bounding box contains the face.
Try this:
my_face = a(boundingbox(1):boundingbox(1)+boundingbox(3),boundingbox(2):boundingbox(2)+boundingbox(4), : )
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
