我在训练级联分类器时遇到问题。
首先,我使用 opencv_createsamples 创建示例:
./opencv_createsamples -vec test.vec -img ./positive/speed_50.jpeg -bg /home/boris/src/cascade/neg.txt -num 50 -w 150 -h 150
它工作得很好,输出如下:
Info file name: (NULL)
Img file name: ./positive/speed_50.jpeg
Vec file name: test.vec
BG file name: /home/boris/src/cascade/neg.txt
Num: 50
BG color: 0
BG threshold: 80
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: 150
Height: 150
Create training samples from single image applying distortions...
Done
然后是级联训练器:
./opencv_traincascade -data /home/boris/src/cascade -vec ./test.vec -bg ./neg.txt -numPos 50 -numNeg 2 -w 150 -h 150
我收到以下错误:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Emergency stop (core dumped)
neg.txt 文件:
img/img1.jpeg
img/img2.jpeg
这两个文件都存在于 img 目录中。
OpenCV 版本是 2.4.2,操作系统是 Ubuntu 12.04。
谢谢你的帮助。