Ask Your Question

danaro's profile - activity

2016-08-23 11:03:18 -0600 commented answer OpenCV 3.1 cratesamples

Sir, I read the documentation and it says:

-num <number_of_samples>

Number of positive samples to generate.

So 1200 is a valid declaration, moreover, I have 1200 negatives.

2016-08-23 11:02:22 -0600 received badge  Scholar (source)
2016-08-23 11:02:10 -0600 received badge  Critic (source)
2016-08-22 12:00:36 -0600 received badge  Student (source)
2016-08-22 11:24:48 -0600 commented question OpenCV 3.1 cratesamples

Don't you have any other suggestions to fix my problem?

2016-08-22 11:05:38 -0600 commented question OpenCV 3.1 cratesamples

Could it help if I build OpenCV in the release version?

2016-08-22 10:55:59 -0600 commented question OpenCV 3.1 cratesamples

I viewed the file with Visual Studio and there is no line but the 27th. BTW, I use opencv_createsamplesd which seems a bit weird not like in the previous 2.3.14 version where it was opencv_createsamples

2016-08-22 10:36:23 -0600 commented question OpenCV 3.1 cratesamples

I posted the whole filenames text file, there is no 28th line.

2016-08-22 08:48:38 -0600 commented question OpenCV 3.1 cratesamples

Ok, I did that, But I still get the same result

2016-08-22 04:11:34 -0600 asked a question OpenCV 3.1 cratesamples

I'm trying to create a .vec file with 1200 samples as the following:

C:\opencv3\build\install\x64\vc12\bin>opencv_createsamplesd -vec vec.vec -bg tl_neg_2.txt -info tl_pos_vec_2\filenames.txt -num 1200 -maxxangle 0.1 -maxyangle 0.1 -maxzangle 0 -w 24 -h 24

EDIT: The tl_neg_2.txt (1200 objects):

 C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-0.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-1.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-2.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-3.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-4.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-5.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-6.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-7.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-8.jpg
C:\opencv3\build\install\x64\vc12\bin\tl_neg\neg-9.jpg
...

The tl_pos_vec_2\filenames.txt (27 objects):

0.jpg 1 0 0 40 40
1.jpg 1 0 0 40 40
10.jpg 1 0 0 40 40
11.jpg 1 0 0 40 40
12.jpg 1 0 0 40 40
13.jpg 1 0 0 40 40
14.jpg 1 0 0 40 40
15.jpg 1 0 0 40 40
16.jpg 1 0 0 40 40
17.jpg 1 0 0 40 40
18.jpg 1 0 0 40 40
19.jpg 1 0 0 40 40
2.jpg 1 0 0 40 40
20.jpg 1 0 0 40 40
21.jpg 1 0 0 40 40
22.jpg 1 0 0 40 40
23.jpg 1 0 0 40 40
24.jpg 1 0 0 40 40
25.jpg 1 0 0 40 40
26.jpg 1 0 0 40 40
3.jpg 1 0 0 40 40
4.jpg 1 0 0 40 40
5.jpg 1 0 0 40 40
6.jpg 1 0 0 40 40
7.jpg 1 0 0 40 40
8.jpg 1 0 0 40 40
9.jpg 1 0 0 40 40

I get:

Info file name: tl_pos_vec_2\filenames.txt
Img file name: (NULL)
Vec file name: vec.vec
BG  file name: tl_neg_2.txt
Num: 1200
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 0.1
Max y angle: 0.1
Max z angle: 0
Show samples: FALSE
Width: 24
Height: 24
Max Scale: -1
Create training samples from images collection...
tl_pos_vec_2\filenames.txt(28) : parse errorDone. Created 27 samples

So instead of 1200 samples I get a .vec file containing only 27, what should I do to fix this problem?

Thank you, Dan.

2016-07-26 05:41:10 -0600 commented question OpenCV convexhull points coordinates

That is right but I want to extract the coordinates of the points in this array and print them on acreen as I described above, how can I do it?

2016-07-26 04:00:31 -0600 asked a question OpenCV convexhull points coordinates

Hello, I'm trying to get all the points coordinates (X and Y position) of a hull which the program finds.

For instance, if a rectangular hull is found, all of his bounding points (which are drawn by the cvdrawcontours and convex hull functions) will be printed out on the screen so all the drawn convex hull is transferred to coordinates of points that build it.

Thank you, Dan.

2016-07-01 13:11:30 -0600 commented question OpenCV Error:Bad argument (Can not Get new Positive sample)

You should use much more positive images, also I suggest you to declare -minHitRate 0.999.

2016-07-01 12:57:42 -0600 commented question Unable to train an usable cascade

If your training used images are much smaller than the image which the detection runs on it will probably give you many false results, try resizing the tested image to be slightly bigger than the trained one (you can use resize() function), as for the training steps, declare -w 24 -h 24 for rectangular images and use more positives than negatives. this is how I got the best results in training similarly to your case.

2016-07-01 12:45:22 -0600 commented question opencv_createsamples don't generate enough positive samples

Yes, you should use more background images, you can even not specify -num if you want to get the same number of samples as background images.

2016-07-01 12:42:54 -0600 commented question problems with traincascade

Does the algorithm start to train the cascade although it shows the wrong parameters?

2016-06-26 09:08:16 -0600 commented question OpenCV algorithm freezes **PLEASE HELP** [unsolved]

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

2016-06-25 05:51:31 -0600 commented question OpenCV algorithm freezes **PLEASE HELP** [unsolved]

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?

2016-06-25 01:53:15 -0600 commented question OpenCV algorithm freezes **PLEASE HELP** [unsolved]

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

2016-06-25 01:51:49 -0600 received badge  Enthusiast
2016-06-24 12:18:41 -0600 received badge  Editor (source)
2016-06-24 12:18:41 -0600 edited question OpenCV algorithm freezes **PLEASE HELP** [unsolved]

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.

2016-06-22 11:02:19 -0600 asked a question training stage-1 error

I try to train the cascade using the following parameters:

C:\opencv\build\x86\vc12\bin>C:\opencv\build\x86\vc12\bin\opencv_traincascade.exe -data C:\opencv\build\x86\vc12\bin\LETTER_TRAIN -vec C:\opencv\build\x86\vc12\bin\LETTERS.vec -bg C:\opencv\build\x86\vc12\bin\LETTER_NEG.dat -numPos 32 -numNeg 160 -numStages 2 -minHitRate 0.1 -w 50 -h 50 -featureType LBP -precalcValBufSize 1024 -precalcldxBufSize 1024 -maxFalseAlarmRate 0.999

The result I get is:

PARAMETERS:
cascadeDirName: C:\opencv\build\x86\vc12\bin\LETTER_TRAIN
vecFileName: C:\opencv\build\x86\vc12\bin\LETTERS.vec
bgFileName: C:\opencv\build\x86\vc12\bin\LETTER_NEG.dat
numPos: 32
numNeg: 160
numStages: 2
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 50
sampleHeight: 50
boostType: GAB
minHitRate: 0.1
maxFalseAlarmRate: 0.999
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
Number of unique features given windowSize [50,50] : 166464

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

===== TRAINING 1-stage =====
<BEGIN
POS count : consumed   32 : 32
Train dataset for temp stage can not be filled. Branch training terminated.

What should I do to make the program run trough all the stages specified in the parameters?

Thank you.

2016-06-21 11:17:28 -0600 commented question OpenCV algorithm freezes **PLEASE HELP** [unsolved]

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