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.
what exactly are you trying to detect ?
Is this even remotely related to: http://answers.opencv.org/question/17... ... where the user is looking for the rotation angle?
To berak - A playing card identifier from the top corner of a playing card. For example, the 6 hearts motif.
To sjhalayka - Sorry, no.
so, they are several different cards to detect ? (it gets more and more unlikely, that this is the right tool then)
To berak - The original image being searched would be a table top with a varying number of playing cards at different rotations. I have been working from the book OpenCV 3 Blueprints and thought I could adapt Face Detection techniques to detect possible locations where a card identifier has been found and then apply a Face Recognition routine to identify which card has been found. If there is a better and more efficient approach I should be pleased to hear. Thank you.
this won't work, imho. you can train a cascade only on a single object(symbol), and you can't vary the pose much (+-15°, maybe) cascade classifiers are the wrog tool here.
rather try to detect the outline of the playing cards, rotate that to vertical, crop it, and train an SVM or such on plenty of example train images (ohn and trying with the face-recognition classes makes some sense for this, too)
To berak - thank you very much for your help and I will look at what you suggest. Out of curiosity though, what would be the correct settings for the w and h parameters in my original approach - a square or a rectangle?
w and h should have the same aspect ratio as the original, unrotated card
To berak - thank you for your w and h response.