Sunday, February 13, 2011

Face Detection using PCA.

I have been working on my image processing library to support face detection. I started with basic method PCA ( Principal component analysis). Basically you need to have a set of images(20-50) with different lighting conditions etc. The next step is to create covariance matrix out of it and find the eigen vector. Then simply project the the image you need to check in to Eigen vectors and find the distance between them.Do some thresholding to classify it.One important thing is you don't have to take all eigen vectors,may be its better to sort (descending ) based on Eigen value and take only first 'N' vectors.

See the video
video

The difficult part in PCA may be to find the eigne vectors , QA algorithm seems a good choice. The current problem with running time.It takes almost 1 second to process 200X201 image. Roughly O(n^3) complexity. I am plan to implement it in CUDA,so that it can be used for real time detection.

9 comments:

Tin Nuen said...

I'm currently in trouble with this. Would you mind sharing your code?

Tin Nuen said...

I'm currently in trouble with this. Would you mind sharing your code?

KD said...

Hi TinNuen, what is your mail id ?

Dadi Elaasri said...

Hi, i'm tryinto to implement PCA for face detection and recognition but i have some problems with detecting faces in images or from camera, would you please help me

krishnadevan k said...

Hi Dadi Elaasri,
First of i want to say is this : PCA is only a basic method for detecting faces. it is not invariant to scale or rotation. It is good that you know it. But i don't think you can use it for some real detecting purposes which contains a lot of variances..

Anonymous said...

Hi krishnadevan, thank you for responding me , i tried to use pca for deteceting a face in camera but it dosent work possibly for the reasons that you mentioned befor, but i tried to detect a face in image but it dosent work too, maybe i have some problem with calculating the distance between the mean adjusted input image and its projection to calissify this input image as a face or no , can you please help me with your code , im in surious trouble, here is my email : dadi.elaasri@gmail.com, i can send you my code to see if i made a mistake there if you dont mind. Thank you so much

Dadi Elaasri said...

help

krishnadevan k said...

Hi Dadi Elaasri,

Sorry, I Didn't see your reply.
Right now i am very busy.May be i can send you some papers which uses PCA to face detection. Other suggestion is try to create the eignen vectors using Matlab or Mathematica like tools. Most probably there is a chance of occuring error in that part.

Mala Irdina said...

Hi. I have problem with this. would you mind to share your code? here is my email: 910mala@gmail.com
thanks in advance