Haar create sample parse error

10,395

Solution 1

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.

Solution 2

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...

Share:
10,395
YAHOOOOO
Author by

YAHOOOOO

Updated on June 09, 2022

Comments

  • YAHOOOOO
    YAHOOOOO almost 2 years

    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.