Once you have a file that lists your positive images with the corresponding positive locations within each image you can then create a training sample based off of this file that will then create a vector of samples and translations to be used to train your classifier.
opencv_createsamples.exe -info "C:\My Documents\Positive Test Set\positives.txt" -vec "C:\My Documents\Positive Test Set\positives.vec"
Explanation of the code above:
opencv_createsamples.exe is a utility distributed with the OpenCV library. This is usually contained int the “bin” folder in the directory you installed OpenCV.
ex. C:\OpenCV2.2\bin
Below are the options available for this utility as well as what the defaults are.
Usage: opencv_createsamples.exe [-info <collection_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>]
From my example of the usage I just kept everything as the default. I did create a number of vector files by specifying different options and values, but of those I found my classifier results to be undesired. So I need to come up with better values for these options, but for the time being since my time for implementation is short. I might come back to this and fine tune when I have the time.
The vector file created will contain information non readable to you, but its your way of knowing it worked.
A small excerpt from the file:
è D D C @ < ; < ; 7 6 5 3 3 5 2 / - , + * ( ' & $ D D C @ < ;
< ; 7 7 5 3 3 5 3 / - , + * ( ' & $ D D C @ =
; < ; 7 7 5 3 3 5 3 / - , , * ( ' & % E E D A > < = ; 9 8 5 4 4 5 2 /
i e a ] Z X W W V U W Y W U R P N O „ ~ | z u o j e d _ \ Z Z
Tags: create samples, Haar Classifier