Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haar create sample parse error

I am creating samples in opencv 2.1 by "opencv_createsamples.exe", but I've got parse error on line 1.

File positives.txt contains:

c:\haar\Positives\PosImg_0.jpg 1 175,120,275,240
c:\haar\Positives\PosImg_1.jpg 1 175,120,275,240
c:\haar\Positives\PosImg_10.jpg 1 175,120,275,240
...(--and so on )

and what I did in cmd is:

c:\Haar>C:\OpenCV2.1\bin\opencv_createsamples.exe  -info positives.txt -vec Posi
tivesMany.vec -num 15 -w 24 -h 24 PAUSE
Info file name: positives.txt
Img file name: (NULL)
Vec file name: PositivesMany.vec
BG  file name: (NULL)
Num: 15
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 24
Height: 24
Create training samples from images collection...
positives.txt(1) : parse errorDone. Created 0 samples

All of the info files paths are correct.

like image 495
YAHOOOOO Avatar asked Dec 17 '22 09:12

YAHOOOOO


2 Answers

I had the same problem, and in my case i solved it by passing to opencv_createsamples the -num parameter with exactly the total number of image samples described in the description file. I guess a minor number passed would work too.

Note that omitting the -num parameter gives parse error too, even though it's clearly a redundant parameter when you want to process exactly all the samples described.

like image 81
hariseldon78 Avatar answered Dec 31 '22 00:12

hariseldon78


You need to remove the comma in your positives.txt file.

Like this:

c:\haar\Positives\PosImg_0.jpg 1 175 120 275 240
c:\haar\Positives\PosImg_1.jpg 1 175 120 275 240
c:\haar\Positives\PosImg_10.jpg 1 175 120 275 240
...(--and so on )

Also, it seems strange that all of your picture have the object at the exact same place...

like image 32
Jean-François Côté Avatar answered Dec 31 '22 02:12

Jean-François Côté