Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Train cascade classifier for game screenshots


Sorry for my bad english :)

THE OBJECTIVE : Detect a fantasy character on a screenshot (yellow rectangle on the image) like this :


I have screenshot extract from a video game.

All screenshot are from the "boss achievement screen". Here some screenshot negative samples :

I need detect if a specific boss is on the screenshot. I need to detect only this boss :

Important Note : it is a static screen, no movement. very little variance.

I installed opencv successfully. I execute the 'face-detection-rectangle' example from node-opencv (, it's ok to detect 'mona lisa' face ;)

Now I want to detect boss from screenshot. I think this is not exactly face detection but more object detection.

I do the "Cascade Classifier Training Tutorial" (, but...

THE PROBLEM : my training is bad, and I can't detect boss on my images. The Bad detection result :


1 / I have only one positive image, I think it's ok, because it's a static screen no movement, and very simple detection needed i think ?

2 / The positive image : What is the difference between - use the complete image (like this : and specify dimensions in like this : 'positives/positive-boss-complete.jpg 1 570 193 326 265' - or crop the image (like this: and specify dimension in like this : 'positives/positive-boss-crop.jpg 1 0 0 326 265'

3 / Negative images samples : What sort of image does a need ? Screenshot from other bosses ? croped screenshot or complete screenshot ? I have only 20 boss screenshot, Should i use images that have nothing to do with the game or only use game screenshots ?

4 / Create sample : I use this command 'opencv_createsamples -info info.dat -bg bg.txt -vec samples.vec -w 100 -h 100' in order to create samples. Is '-w 100 -h 100' ok for my context ? Should I use '-maxxangle' '-maxzangle' and '-maxzangle' and which values ?

5 / Train cascade : I use this command 'opencv_traincascade -w 20 -h 20 -data data -bg bg.txt -vec samples.vec -numPos 1 -numNeg 20 -numStages 10'. Have you some observations ?

Thanks for your help.