OpenCV algorithm freezes **PLEASE HELP** [unsolved] [closed]
Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.
When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.
I noticed this line causes the problem:
tl_cascade.detectMultiScale(frame_gray, tls, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
this is the .xml file.
What should I do to make it show the captured frames and start detecting?
Thank you.
your code is OK. (i tested it with
haarcascade_frontalface_alt.xml
) shows frames and finds faces.So why if I change the xml file it doesn't work? could it be that my xml file is too short (I trained it only with 15 positive photos)?
share your xml lets try it.
yes. your xml makes the program frozen.
Thank you for answering, what should I do to make it work?
start testing with the most simple command possible, being
letter_cascade.detectMultiScale(frame_gray, letters, 1.05, 3);
. The we know if your model works with the default values. Also show us how you initialized the letter vector.Thank you for replying, I've got the same results after modifying this line, the vector is: std::vector<rect> letters; Could it be that the xml file is too small? if so, how can I make files which are more that 100kb?
The size of your model is not the problem. How did you tran the model?
I tried to trai it with more photos like this: C:\opencv\build\x86\vc12\bin\opencv_traincascade.exe -data C:\opencv\build\x86\vc12\bin\tl_train_cascade -vec C:\opencv\build\x86\vc12\bin\train.vec -bg C:\opencv\build\x86\vc12\bin\tl_neg.dat -numPos 250 -numNeg 200 -numStages 4 -minHitRate 0.999 -w 40 -h 40 -featureType LBP -maxFalseAlarmRate 0.5 You can a look at the new xml file I posted in my question
Please, stop updating your question with no additional relevant information.