opencv cascade Invalid background description file. Segmentation fault

背景

我在尝试训练自己的级联检测器,当在windows上写好的txt文件传到ubuntu时由于编码问题出现了如下报错,经过一番网上冲浪,在一个other国家的网站上发现了一个人写的解决方案。
就是这个网站

报错

root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# opencv_createsamples -img watch.jpg -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 500
Info file name: info/info.lst
Img file name: watch.jpg
Vec file name: (NULL)
BG  file name: bg.txt
Num: 500
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 0.5
Max y angle: 0.5
Max z angle: 0.5
Show samples: FALSE
Width: 24
Height: 24
Max Scale: -1
Create test samples from single image applying distortions...
Open background image: neg/01.jpg
-------略
Invalid background description file.
Segmentation fault

解决

在这里插入图片描述
粘一下我的代码:

root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# file bg.txt 

bg.txt: ASCII text, with CRLF line terminators
root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# sudo apt install dos2unix
Reading package lists... Done
--------安装信息省略--------
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# dos2unix bg.txt
dos2unix: converting file bg.txt to Unix format...
root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# file bg.txt 
bg.txt: ASCII text
root@iZ2zef0icee95uw35ttpgmZ:~/test_workspace# opencv_createsamples -img watch.jpg -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 2000
Info file name: info/info.lst
Img file name: watch.jpg
Vec file name: (NULL)
BG  file name: bg.txt
Num: 2000
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 0.5
Max y angle: 0.5
Max z angle: 0.5
Show samples: FALSE
Width: 24
Height: 24
Max Scale: -1
Create test samples from single image applying distortions...
Open background image: neg/01.jpg
----------
Done

祝愉快

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值