rgbImage = imread('face.jpeg');
rgbImage = imresize(rgbImage,1);
subplot(2, 3, 1);
imshow(rgbImage);
axis('on', 'image');
drawnow;
detector=vision.CascadeObjectDetector('mouth');
detector.MergeThreshold=60;
allBoundingBoxes=step(detector,rgbImage)
out = insertObjectAnnotation(rgbImage,'rectangle',allBoundingBoxes,'mouth Detected','LineWidth',3,'TextColor','black');
subplot(2, 3, 2);
imshow(out)
axis('on', 'image');
for k = 1 : size(allBoundingBoxes, 1)
thisBoundingBox = allBoundingBoxes(k, :);
croppedImage = imcrop(rgbImage, thisBoundingBox);
subplot(2, 3, k+2);
imshow(croppedImage)
axis('on', 'image');
end