MATLAB Answers


Feature Extraction & Selection from a standard Face Image.

Asked by sidra
on 4 Sep 2013
Latest activity Commented on by jenny jenny on 7 Jul 2017

I need to extract and select features from a face image. I have extracted the basic Texture , Color and Shape features using the inbuilt matlab functions. My question is twofold.

Firstly, what are the other ways to extract features from an image.

Secondly, I have about 10 features, how do i select the best ones? I tried sequentialfs but the function 'fun' is giving some errors. Please help me out with the code!


Log in to comment.

3 Answers

Answer by Anand
on 16 Sep 2013

If you have the Computer Vision System Toolbox, you can use any of the following built-in feature extraction methods:


Not all of these are necessarily suited to face identification though. One thing you could do is use the vision.CascadeObjectDetector to not only detect faces, but detect the eyes, nose and mouth. You can use the different classification models provided to accomplish this. Once you've identified different parts of the face, you could detect and extract features for each of these face parts using any of the previously mentioned methods (detectSURFFeatures etc).

Feature selection is a different beast. Why do you need to do feature selection? A combination of these features with a good machine learning algorithm should work fine atleast for starting applications. Try an SVM, for instance and see if that works. You can usually throw a bunch of features at an SVM if you have enough training data and hope for a good result.


@Anand: Thank you so much. I have already extracted features using some of these i will use the other two.

As a part of my thesis i am required to do feature selection too. I selected a few features using ward's algorithm, but i am having difficulty interpreting the results, i can't really make out which features have been selected.

Plus i have been trying to implement a paper where PCA based feature selection was used , but i am stuck at point where for each principle component i am required to find axis that is closest to it.Can you please help me out with this?

I don't know about the Ward's algorithm, so I can't help you there.

MATLAB to the rescue for PCA. Just use the princomp function:

If you want to implement PCA yourself, here's a set of slides from a course I once took that I find helpful in trying to understand how to implement PCA.

Log in to comment.

Answer by UJJWAL
on 4 Sep 2013

Your question is not very clear. What do you want to do with the face images? Is it a detection problem or recognition problem. How general is the setting (like are occlusions and viewpoint changes are allowed ? )

A feature you extract out of an image is something that characterizes the image. Depending on the exact version of the problem you are trying to solve, this would change.

There are Haar features, HoG features, LBP features, GMP features, SIFT Features etc etc which you can extract. What you should extract depends on the version of the problem. This is still an open issue as to what is a good feature and how to select one. So I would choose to stay silent at that point. I would suggest you to go through some important papers which talk about these issues.

Following are some references you should look at :

a) Viola Jones Face detector paper (IJCV 2004)

b) Viola Jones Face detector (in built in OpenCV. Not sure about MATALAB).

c) HoG feature descriptor.


Viola-Jones is in the Computer Vision System Toolbox: Face detection

@ Ujjwal : Thank you so much i will go through the papers. I want to extract and select features which i can use for face identification(one to many matching) or authentication(one to one matching).

Right now i just want to familiarize myself with different feature extraction and selection techniques.And according to the results i will employ the most relevant ones in my project.

I tried to use 'sequentialfs' to select features but as mentioned above there is an error with regard to the function 'fun'. I tried to select features using data variance but their is an error with regard to single\double class.

Which are some other methods i can employ to select features?

Good morning @sidra I have the same problem in my thesis the first step is features extraction when I try to know the existing methods I don't know what is the best and should I use the existing methods in the toolbox or should I implemented them I don't konw what should I do I'm working in gestures recognition :(

Log in to comment.

Answer by sidra
on 10 Sep 2013

Could anyone help, please?


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!