我目前正在尝试制造一个HAAR分类器。我创建了一个注释文件,并完成了官方openCV教程:traincascade.html中描述的所有操作。但是,当我尝试用opencv_createsamples创建示例时,会出现一个错误。我的命令:
opencv_createsamples -vec /some_dirs/samples/samples.vec -info /some_dirs/annotations/annotations.dat -w 8 -h 8 -num 100
错误:
Info file name: /home/nikifaets/code/pointsProcessing/annotations/annotations.dat Img file name: (NULL) Vec file name: /home/nikifaets/code/pointsProcessing/samples/samples.vec BG file name: (NULL) Num: 100 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: 8 Height: 8 Max Scale: -1 RNG Seed: 12345 Create training samples from images collection... OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp, line 4044 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp:4044: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize
Aborted (core dumped)
但是,如果我只试着做两个示例(不知道为什么只有2.),它将运行并创建.vec文件,尽管我的数据集包含大约300-400张图片。
annotations.dat的Pastebin
提前感谢您的支持!
发布于 2018-03-07 13:03:25
解决了!感谢米卡提出了一个解决方案,而且是正确的。注释文件中有一个错误。兴趣点的描述之一是0 0 0,这是无效的。始终仔细检查你的文件!
https://stackoverflow.com/questions/49141708
复制相似问题