Ask Your Question

How can I classify people into different categories?

asked 2015-07-15 08:11:51 -0600

mayooran gravatar image

I have the need to classify people into different categories such as military man,doctor,student etc based on the images captured from a webcam. I have written the code to capture the images and I now have image/frame. How can I categorize people using Opencv. I am new to this. Please provide with some code samples if possible.

edit retag flag offensive close merge delete


you have the entire man or just a part of it in the frame?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-15 08:49:46 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-15 09:47:26 -0600

chr0x gravatar image

This question is kind generic, but basically what you should do to accomplish that task is:

1 - Define your dataset, i.e. the folder that contains all images that you will use. Presuming that you will use supervised learning classification, this dataset should contain a considerable number of examples for your machine learning algorithm, i.e. pictures already classified with the information you are looking for.

2 - Extract the features that you will use in classification from the image. You should decide at this moment which approach you will use to distinguish the subjects, it can be by the clothes for example, if in your input the person is wearing a uniform, you can use this information to distinguish that person.

3 - Normalize the rest of the data: after you decided which information you will use for step 2, you should now "standardize" the rest of the information so the irrelevant features in the image will not be consider (for instance, the image size / scale is not important in this definition, so you must put all the images in the same size / scale).

4 - Choose and implement a Machine Learning algorithm to classify the real time data (webcam as you said) based on the dataset examples defined in step 1. There are a vast number of algorithms to choose (a big number of those was already implemented in the OpenCV lib), like: Random Forest, Support Vector Machine (SVM), Neural Networks. You can read more about this here:

Hope it can be useful.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-15 08:11:51 -0600

Seen: 460 times

Last updated: Jul 15 '15