Hi Ahmed,
I was going to try and give you are concise answer but I'm limited for time so I apologise. I've been using EMGU for several years now and I've looked into Haar Classifiers extensively. I intend to write an article at some point. There is a lot out there on Haar classifiers but a very good source is
Here[
^].
Now the tutorial isn't very clear but I did write c# program utilising EMGU to create the Haar classifier for you and I'll try and dig it out. Now the most important thing I need to make sure you understand is the complexity of forming a Haar cascade and make sure you wish to go down this line, it's not a quick process.
If your running Linux based OS then I can't help you much other than the steps you need. As for timing issues to generate a good Haar classifier you will need several thousand sample images and powerful processor (single core as multiple cores are not supported yet) and about a week or more access.
From the papers I have read it can take between a day to over a week to form these classifiers and yes there is no way of knowing if the classifier will work.
The Steps Involved
Sample Images
Positive
The website I provided a link to uses positive 5000 sample images I would recommend this to be the minimum you utilise while you may think you don't need as many all you will end up doing is wasting your time and producing a cascade that doesn't work. I would recommend producing a quick c# application using EMGU that allows you to select a ROI (region of interest) and save that to a file using a standard naming convention i.e. 1.jpg-5000.jpg
Negative
The number of Negative sample image does not have to be as high as positive ones but there needs to be a large amount generally tailored to the background the object your looking for will regularly occur on.
So if it's cars in a car park you need a few thousand images of the carpark without cars present and under different conditions snow, rain , night, day etc.
Creating Samples
This is done using a command line program now I would assume this is were you've found the C++ code but don't worry this is compiled for you if you examine the "Installation Directory of EMGU\Bin" folder you will find the follwing compiled files
opencv_createsamples.exe
opencv_haartraining.exe
Now if you jumped a head and tried to run one of these programs then you shouldn't have done all that will happen is the console window will open show some text and close usually before you will see the text.
To utilise these console applications they have to be called through command line from the start menu select RUN.. and type in CMD press enter and a console window will appear. Now type the location of opencv_createsamples.exe
e.g C:\EMGU\bin\opencv_createsamples.exe
It will simply display all the possible inputs for the command line call
Usage: ./createsamples
[-info <description_file_name>]
[-img <image_file_name>]
[-vec <vec_file_name>]
[-bg <background_file_name>]
[-num <number_of_samples = 1000>]
[-bgcolor <background_color = 0>]
[-inv] [-randinv] [-bgthresh <background_color_threshold = 80>]
[-maxidev <max_intensity_deviation = 40>]
[-maxxangle <max_x_rotation_angle = 1.100000>]
[-maxyangle <max_y_rotation_angle = 1.100000>]
[-maxzangle <max_z_rotation_angle = 0.500000>]
[-show [<scale = 4.000000>]]
[-w <sample_width = 24>]
[-h <sample_height = 24>]
Now please look at the web page
Here[
^] and about a 1/3rd of the way down you will see 2. Create training samples from some follow th steps involved you will have tor create the -info <description_file_of_samples> file yourself it's just a simple text file holding relevant file information about your training sets.
The Cascade
I don't wish to re-write the webpage I've provided a link for so you will have to work through the steps it shows from now on. Despite it being a bit hard to read through once the samples are created you should utilise opencv_haartraining.exe from now on to generate your Haar Cascade. Calling it in the same command line fashion as before. If all goes well you will have a classifier that works.
Please take note that the more stages you have to your cascade the more accurate it will be however the longer it will take to complete calculations and generate the required XML file.
Notes
I hope this helps you and please feel free to ask extra questions I'll answer them as soon as I can when I have found the c# to generate the Haar classifiers I will write an article and upload it and of course post the link here
Cheers
Chris