using trainCasca​deObjectDe​tector for online game

1 view (last 30 days)
Im trying to create a code for online game that detects specific objects from the image by using xml that created by training cascade to detect it.
I inserted around 40 positive images where in each one I used ROI tool and around 500 negative.
Image for example (grey rocks, the image was taken from google):
The results were very bad and I tried using different numbers of stages.
Is there any limitations to trainCascadeObjectDetector for detecting objects?
If not what might be the reason for detecting around 400 objects in the picture instead on 3?
Thank you

Answers (1)

Florian Morsch
Florian Morsch on 7 Aug 2018
Edited: Florian Morsch on 7 Aug 2018
This depends on the object you want to detect, 40 pictures might not nearly be enough. Cascade object detector can only detect objects to a certain angle and the width to heigth ratio shouldnt vary so much. For good results with the object detector you should consider a lot more positive and a even more negative images. And even then it depends on the object you want to detect, if the object is only a few pixels you wont have a good chance to get it to work.
If you can attach a example picture and the object you want to detect it would be easier to see, if it can be done.
EDIT: Since you now have a picture attached: The cascade object detector is meant to detect objects which doesnt vary much in ratio. Since the objects you want to detect have a variable ratio you will have a hard time to do so. Also there are not many significant points which could different the objects, so to get a reliable detector you would need a lot of positives and negatives, and even then you could get false detections. (by a lot i mean like 5000 positiv and 30000 or more negatives).
You also might want to try a different feature, cascade object detector can work with Haar, LBP or HOG features.
If you change the detection feature you might get better results.


Find more on Computer Vision Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!