OpenCV Invalid background description file

前端 未结 5 1039
长情又很酷
长情又很酷 2021-01-27 10:54

When I try using this Command: opencv_createsamples -img image.jpg -bg bg.txt -info /info/info.lst -pngoutput info -num 2600 it tells me: Invalid background descrip

5条回答
  •  梦如初夏
    2021-01-27 11:05

    I had the same problem and tried many different things (adding full path names in the bg.txt, convert to UTF-8,...) - which resulted in getting slightly different looking errors - but still, no success. I am following this tutorial - and I am preparing all the files on my windows laptop & then pushing them to a ubuntu server.

    Then I read it might be caused by difference in line ending (CLRF and LF) and checked my file (on the ubuntu server):

    $ file bg.txt  
    bg.txt: UTF-8 Unicode (with BOM) text, with CRLF line terminators
    

    I converted the file from dos2unix:

    $ sudo apt install dos2unix
    $ dos2unix bg.txt
    dos2unix: converting file bg.txt to Unix format ...
    $ file bg.txt
    bg.txt: ASCII text
    

    And now the opencv_createsamples command worked.

提交回复
热议问题