I have directory which has many images , i want to perform face detection and cropping process on these images. kindly guide me, how to do this??

2 views (last 30 days)
saeeda saher
saeeda saher on 20 Nov 2017
Commented: Jan on 30 Nov 2017
here is my code for single image, i want to perform this task on many images.
FaceDetect = vision.CascadeObjectDetector;
BB = step(FaceDetect,I);
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',3,'LineStyle','- ','EdgeColor','r');
for i = 1:size(BB,1)
J= imcrop(I,BB(i,:));
% figure(3),subplot(5,5,i);imshow(J);
fname = sprintf('b_cropped_%d.jpg', i);
fpath = fullfile('E:\face', fname);
imwrite(J, fpath)
% imwrite(J,'E:\g_cropped.jpg')

Community Treasure Hunt

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

Start Hunting!