OpenCV algorithm freezes **PLEASE HELP** [unsolved] [closed]

asked 2016-06-21 10:48:44 -0500

danaro gravatar image

updated 2016-06-27 03:21:44 -0500

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.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-08 02:55:27.838879


your code is OK. (i tested it with haarcascade_frontalface_alt.xml ) shows frames and finds faces.

sturkmen gravatar imagesturkmen ( 2016-06-21 10:58:20 -0500 )edit

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)?

danaro gravatar imagedanaro ( 2016-06-21 11:16:23 -0500 )edit

share your xml lets try it.

sturkmen gravatar imagesturkmen ( 2016-06-24 13:39:37 -0500 )edit

yes. your xml makes the program frozen.

sturkmen gravatar imagesturkmen ( 2016-06-24 15:06:37 -0500 )edit

Thank you for answering, what should I do to make it work?

danaro gravatar imagedanaro ( 2016-06-25 01:53:15 -0500 )edit

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.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-06-25 05:17:07 -0500 )edit

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?

danaro gravatar imagedanaro ( 2016-06-25 05:51:31 -0500 )edit

The size of your model is not the problem. How did you tran the model?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-06-26 08:33:39 -0500 )edit

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

danaro gravatar imagedanaro ( 2016-06-26 09:08:16 -0500 )edit

Please, stop updating your question with no additional relevant information.

LorenaGdL gravatar imageLorenaGdL ( 2016-06-27 03:30:25 -0500 )edit