header photo

Level 3e - How to Extract the Detected Faces From Input Image

April 30, 2012

Once faces have been detected from an input image, extract each single face out and save to a folder OR view on the windows form in a picturebox

NOTE: we're starting off with modifying the Camera Capture application, right where we left it at the end of Level 3d. how we connected to camera, got an input image, detected faces and marked them in boxes and displayed them - to know all that, please have a detailed look at Level 1 and then  Level 3a to Level 3d

STEP 1:  If you still haven't then Add a button to "Browse For Input Image" on your application.

STEP 2:  Insert the Code to "Extract a Faces" after face detection code.

STEP 3:  Add components/tools to Display the  "Extract Faces"  on your windows form.
Also create an array to hold all the extracted faces

STEP 4:  Add  each extracted face to the ExtractedFaces array. Then display each extracted face in the array to the picturebox. code behind the added buttons to navigate through the extracted faces array to display previous or next extracted face.

STEP 5: Handle the exception cases in navigating through the extracted faces.

STEP 6: Finalize the application with following modifications:


Go Back

Thanks a lot, awesome and wonderful.

Thanks for the tutorial so far they have been really explanatory, great job.

thanks alot .. wonderfull

Hi Mahvish,
thanks alot for this tutorial as it helped me alot a little request kindly can you tell me what if i wnt the same color image in the picture box except the one in gray scale kindly waiting for your soon reply as it could hellp me in my FYP.

i need help in eye extraction
any help plz

thanks so much. it's great.

Hi! Thanks for your examples, they are well documented and thorough. I've implemented your code (by actually typing it, not just copy paste..) and everything works like a charm. One thing i don't like, and that has been my issue since the first time i started using emgucv/opencv, is the Haar principle. Sure, it works but not as good as i want it to be.

To fix that, i thought it would be quite simple to make the border around the face a bit bigger. Might be a few false positives more, but for my project it's necassary.

In processframe i've implemented the part where you copy the inside of the border and paste it into a new image. Works like a charm. But how can i make sure that there are some extra pixels copied? The "face.rect" can't be edited, unfortunately, so i'm kinda stuck. Do i need to make my own vectors, or is there a simpler way?

Also, if you do have the time to make a NORMAL tutorial on how to train the program and make your own vectors, that would be quite awesome. You're a programmer, but you have one big plus against others: you speak normal English lol, and for a beginner/novice in C# that's great. I understand more and more, learned a lot in the past 1.5 hours!

Thanks so much :)

Hi your all tutorials are great but why these images/videos in other and this tutorials are not displaying?

Thanks Mahvish. I have gone through all the tutorials. The tutorial has been very helpful. I would appreciate it if you could help me with giving some idea or lecture on extracting facial features(like eyes,noes, mouth etc.) from a detected a face. Thank You.