我在我的OPENCV_ROOT文件夹中,在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我的negatives.txt看起来是这样的:
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这是我的输出:
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.我的负片收集文件(negatives.txt)有什么无效?我尝试用绝对路径和相对路径列出其中的文件。我正在学习这教程。
发布于 2014-04-05 14:25:58
问题解决了!问题仅仅是我用Notepad++编写了集合文件名,这一切似乎都很好。但是当我碰巧在记事本中打开同一个文件时,我注意到在每个图像文件名之后没有换行符!当我添加新行并运行命令时,创建的示例没有错误!
发布于 2018-08-28 08:55:07
如果您在Windows上创建了该文件,并在Linux (例如Ubuntu )上运行它,则必须更改“行尾序列”。
单击CR上编辑器的底部,并将其更改为 LF ,然后重试!
Notepad++:

代码:

Geany: Documents > Set行末端>转换并设置为LF (Unix)

发布于 2014-10-09 18:22:22
我也有同样的问题。只需跳过图像地址之间的行。例如:在我的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问题解决了。
https://stackoverflow.com/questions/22610142
复制相似问题