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??
    3 views (last 30 days)
  
       Show older comments
    
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
Answers (1)
See Also
Categories
				Find more on Read, Write, and Modify Image in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

