I have directory, there are many images in this directory, I want to detect the face from images, and create the directories of image name store only the faces on that directory. How to do this, kindly help me

2 views (last 30 days)
saeeda saher
saeeda saher on 18 Nov 2017
Commented: Image Analyst on 30 Nov 2017
myDir = 'C:\myImages\';
this is the name of directory which contains many images. i want to detect the faces from images and want to crop the face from image and save it like: For example. There is one image name 1.jpg, create the directory name 1 and inside directory there should faces stored which were present in the image 1.jpg.
  6 Comments
Image Analyst
Image Analyst on 30 Nov 2017
Remants of original discussion(before they also get deleted):
myDir = 'C:\myImages\';
this is the name of directory which contains many images. i want to detect the faces from images and want to crop the face from image and save it like: For example. There is one image name 1.jpg, create the directory name 1 and inside directory there should faces stored which were present in the image 1.jpg.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 18 Nov 2017
"i have done till face detection and cropping, but i am facing difficulty to save the cropped face "
OK, good that you've already done that, because that's the hardest part.
To save the cropped image, simply call imwrite:
baseFileName = sprintf('Face#%d.png', currentFaceIndex);
fullFileName = fullfile(outputFolder, baseFileName);
imwrite(croppedImage, fullFileName);
  2 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!