Haar Cascade OpenCV Python

asked 2016-12-01 04:18:32 -0500

I am trying to detect a "taffic light" which will be always the same shape. I started with the red light, but I am kind of stuck. I tried to do it with the Haar Cascade. This is my positive image:
image description

Now I did 13 images witch my camera from different angles and greyscaled it. Here is a example:
image description

These are the commands i've run to create the cascade:

opencv_createsamples -img redlight01.png -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 13
opencv_createsamples -info info/info.lst -num 13 -w 50 -h 50 -vec positives.vec
opencv_traincascade -data data -vec positives.vec -bg bg.txt -numPos 13 -numNeg 13 -numStages 5 -w 50 -h 50

My first problem is, that i get this result:

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   13 : 13
NEG count : acceptanceRatio    10 : 1
Precalculation time: 1
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        0|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 4 seconds.

===== TRAINING 1-stage =====
<BEGIN
POS count : consumed   13 : 13
NEG count : acceptanceRatio    0 : 0
Required leaf false alarm rate achieved. Branch training terminated.

And when I try to do the method watch_cascade and try to mark it with a rectangle he always just create a rectangle in the center of the image.

edit retag flag offensive close merge delete

Comments

you need more images (x100)

berak gravatar imageberak ( 2016-12-01 04:23:56 -0500 )edit

This is it? I just need more images? What should I do, create a photo from 100 angles?

lemurdock gravatar imagelemurdock ( 2016-12-01 07:59:06 -0500 )edit