Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cascade training in OpenCV 3

My question relates to creating positive samples for use in cascade training for OpenCV 3. I wish to find an object with a rectangular shape that is approximately 45 pixels wide and 90 pixels high. The object may be orientated at any angle in the original image being searched. The original image and the object image are in Black and White (grayscale 0/255).

One option I am considering is to superimpose the object image on a background of grayscale 127 that is 100 pixels square and use the createsamples program to produce rotations between 0-359 degrees with the bgcolor parameter set to 127. The rotations would then be applied to the negative background images (also grayscale 0/255).

What figures should I give to the w and h parameters? Should it be a square (50 x 50 pixels) or a rectangle (22 x 45 pixels) keeping in mind that the object searched for could be horizontal and therefore 90 pixels wide and 45 pixels high? Presumably the w and h parameters in the traincascade program should be the same as used in createsamples?

Thank you for your help.