OpenCV creates patterns - invalid background description file

I am in a folder OPENCV_ROOTand run the following command in Win-x64:

opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 
maxzangle 0.5 -maxidev 40 -w 80 -h 40 
-img ABSOLUTE_PATH_TO_POSITIVE_IMAGES_FOLDER\car.jpg 
-bg ABSOLUTE_PATH_TO_PROJECT\negatives.txt
-vec ABSOLUTE_PATH_TO_SAMPLES_FOLDER\car.jpg.vec 
-num 125

My negatives.txtlooks like this:

negative_images\city01_02.jpg
negative_images\city01_04.jpg
negative_images\city01_05.jpg
negative_images\city01_06.jpg
negative_images\city01_07.jpg

This is my conclusion:

Info file name: (NULL)
Img file name: ABSOLUTE_PATH_TO_POSITIVE_IMAGES_FOLDER\car.jpg
Vec file name: ABSOLUTE_PATH_TO_SAMPLES_FOLDER\car.jpg.vec
BG  file name: ABSOLUTE_PATH_TO_PROJECT\negatives.txt
Num: 125
BG color: 0
BG threshold: 0
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: 80
Height: 40
Create training samples from single image applying distortions...
Invalid background description file.

What is invalid in my negatives collection file ( negatives.txt)? I tried to list the files inside it with both absolute paths and relative paths. I follow this tutorial.

+1
source share
4 answers

! , Notepad ++, . , , ! , !

+2

Windows Linux, , Ubuntu, " ".

CR LF LF !

Notepad++:

Notepad ++ image:

Visual Studio:

Visual Studio Code image:

+2

. . : negatives.dat :

./Negative_Images/197.
./Negative_Images/69.
./Negative_Images/510.
./Negative_Images/513.
./Negative_Images/169.png

:

./Negative_Images/197.png



./Negative_Images/69.png



./Negative_Images/510.png



./Negative_Images/513.png



./Negative_Images/169.png

.

+1

bg.txt . , :

for (int i = 0; i < numberOfImages; i++)
    {
                myDescFile << imagesFolder + std::to_string(i) + ".jpg\n";
    }

\n, !

myDescFile << imagesFolder + std::to_string(i) + ".jpg\n\n";

EDIT:

, / \\ . , opencv_createsamples.exe cmd, , Done .

: L:/imgTraining/plant/bnw/0.jpg

bg notepad++ ( View>Show Symbol>Show End of Line Edit>EOL Conversion>Windows (CR LF)):

enter image description here

0

Source: https://habr.com/ru/post/1523356/


All Articles