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??

1 Ansicht (letzte 30 Tage)
here is my code for single image, i want to perform this task on many images.
I=imread('E:\a.jpg');
figure(1),imshow(I);
FaceDetect = vision.CascadeObjectDetector;
BB = step(FaceDetect,I);
figure(2),imshow(I);
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',3,'LineStyle','- ','EdgeColor','r');
end
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')
end

Antworten (1)

Image Analyst
Image Analyst am 20 Nov. 2017

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by