how modify haarcascade_frontalface_alt.xml? - opencv

I am new in opencv and I want to work on face detection methods. I have understand that one of the best methods is by haar features. I know some functions in opencv library for detection faces and training.
can any one help me to understand how haarcascade_frontalface_alt.xml is made?
and how can I modify this file?
thanks a lot for your help.

First read this:
http://docs.opencv.org/doc/user_guide/ug_traincascade.html
followed by:
http://note.sonots.com/SciSoftware/haartraining.html
http://opencvuser.blogspot.in/2011/08/creating-haar-cascade-classifier-aka.html
http://achuwilson.wordpress.com/2011/07/01/create-your-own-haar-classifier-for-detecting-objects-in-opencv/
Start with good training data.
Cheers.

Related

How to create a Haar Cascade which recognizes only me?

I'm trying to make my first Haar Cascade and I'm thinking of making one which recognizes only my face. How do i do this? I'm assuming that i'll need to use my face in the positive images but then shouldn't negative images include other faces so that it's able to differentiate between them and I?
I'd really appreciate if someone could some up with an explanation of this.
Thanks.
SentDex has a great tutorial on Haar Cascade.
Check his official website:
https://pythonprogramming.net/haar-cascade-object-detection-python-opencv-tutorial/
Or just go to youtube and search for "SentDex Haar Cascade".

how to apply genetic algorithm on 2d or multidimesional images for optimisation

I am trying to Code a genetic algorithm in Matlab but really dont know how it works in images and how to proceed? Is there any basic tutorial that can help me understand how to apply GA on images (starting from 2d to multidimentional images ).
That will be a great help for me.
Thanking everyone in anticipations.
Kind Regards.
For GA you need two things: a fitness function that can evaluate any solution and tell how good it is, and a representation of your solution so that you can do crossover and mutation. Once you have these, you are good to go. I'm not an expert on image processing so I can't help you with that exactly.
Look at the book Essentials of metaheuristics which is a very good resource for start with evolutionary computation (and not only that) in general. It's free.
There is a paper on this subject which you can find at the IEEE library. I believe it solves the problem you vaguely describe.

Haar training - where to obtain eyeglasses images?

I want to train a new haar-cascade for glasses as I'm not satisfied with the results I'm getting from the cascade that is included in OpenCV.
My main problem is that I'm not sure where to get eyeglasses images. I can manually search and download, but that's not practical for the amount of images I really need. I'm specifically looking for images of people wearing eyeglasses.
As this forum contain many experienced computer vision experts, I hope someone here can guide as to how to obtain images for training.
I'll also be happy to hear other approaches for detecting eyeglasses (on people).
Thanks in advance,
Gil
If you simply want images, it looks like #herhuyongtao pointed you to a good place. Then you can follow opencv's tutorial on training.
Another option is to see what others have trained:
There's a trained data set found here that might be of use, which states simply that it is "better". I'm assuming that it's supposed to be better than opencv.
I didn't immediately see any other places for trained or labeled data.

Haarcascades in opencv

I have seen multiple haarcascade xmls in opencv for face detection, eye detection , ear detection, Human body detection etc., But couldnt see proper documentation or explanation for these xmls.
For example in a application if I need to detect side faces which xml should I use and what are the parameters to be passed for detectMultiScale?
In some cases if I vary the parameters to detectMultiScale the false detections get reduced, but I did all the tests with trial and error method. I couldnt find any definite articles on explaining the use of each xml and parameters.
Can some one provide the documents on this if any, else some explanation on this would be grateful.
OpenCV has a built-in profile face classifier xml under "..\data\haarcascades". If you want to create your own cascade classifier, you should follow this procedure. Here is another link regarding that.
To learn about the detectMultiScale method, check out the documentation. To understand the how the classifier and its parameters work, check out the viola-jones (2001) article or its explanation.
Here is a paper by Vadim Pisarevsky, one of the OpenCV developers, which may be helpful, in understanding some of the parameters.
On the other hand, if using OpenCV is not a hard requirement, please take a look at vision.CascadeObjectDetector in the Computer Vision System Toolbox for Matlab, which provides the same functionality. It also saves you the trouble of figuring out which xml file to use for profile faces.

Can I get the OpenCV source code snippet for k-means clustering algorithm?

I was going the K-means algorithm as a technique for clustering images, as part of my project in the area of Image Processing. In the process, I decided to code using OpenCV libraries. So, can somebody help me in coding the algorithm in C++ using OpenCV. I can manage well, if some code snippet is provided. I just started learning about the OpenCV environment. Thank you for reading this. I ll be grateful for your help. waiting for a reply!
Before you implement clustering (k-means or otherwise), you need to figure out how to compare one image vs the other. This is usually dependent on the type of images you have, what features you can extract (colors, edges, shapes etc.).
A simple way of comparing 2 images would be to use the SURF features and compare to other images' SURF features. The OpenCV samples should get you started on how to extract SURF.
Other approaches would be to extract edges, shapes, color histograms and compare to others. Once you have done so, clustering should be fairly straightforward.
Check mlem.cpp and cxmatrix.cpp.
If you're new to OpenCV, have a look at my website.. http://aishack.in/ I've put up some tutorials/articles on vision and vision algorithms. Hopefully they'll help!

Resources