1

I'm trying to run create samples on Ubuntu 16.04 with OpenCV, and I keep coming across this error when it runs. I have about 1960 negative images that I'm trying to generate sample images from. What i'm running in the terminal is:

opencv_createsamples -img pipe1.jpg -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 5 -maxyangle 5 -maxzangle 5 -num 1950

and and abbreviated output is:

Open background image: neg/930.jpg
Open background image: neg/11.jpg
Open background image: neg/332.jpg
Open background image: neg/141.jpg
Invalid background description file.

What I don't get is it seems to be able to parse the file correctly and find the images...but it keeps saying the description file is incorrect...

AndrewD
  • 75
  • 7

1 Answers1

0

Here is my solution: use full path.

This problem can be caused by a few things:

1) an image is missing thus failed to be opened.

2) the path is incorrect. you need to verify the path you give if the path to an image.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Bananagod
  • 101
  • 2
  • 5
  • I tried both, no luck. I tried exchanging the file of the line in question with another .jpg, to test if it was corrupt. I tried removing the line from the bg.txt, which causes it to throw the same error at another place. What I don't get is that the order in which the lines are read seem to be completely random. Using same commandline as above with openCV 3.4.7. – Frederik Steinmetz Oct 05 '19 at 07:09
  • I narrowed it down to 8 images, used num 3 (and 8 ofc.) - it still checks all 8 - and found out: it tries to go through the list twice. The line where it fails has already been processed successfully before. – Frederik Steinmetz Oct 05 '19 at 07:29