Opencv_createsamples失败并出现分段错误 [英] Opencv_createsamples fails with segmentation fault

查看:115
本文介绍了Opencv_createsamples失败并出现分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试进行HAAR分类器.我已经制作了一个批注文件,并按照openCV官方教程中的说明进行了所有操作:

I am currently trying to make a HAAR classifier. I have made an annotation file and have done everything as described in the official openCV tutorial: https://docs.opencv.org/3.3.0/dc/d88/tutorial_traincascade.html . However, when I try to create the samples with opencv_createsamples, I get an error. My command:

opencv_createsamples -vec/some_dirs/samples/samples.vec -info/some_dirs/annotations/annotations.dat -w 8 -h 8 -num 100

错误:

信息文件名:/home/nikifaets/code/pointsProcessing/annotations/annotations.dat图文件名:(NULL)Vec文件名:/home/nikifaets/code/pointsProcessing/samples/samples.vecBG文件名:(NULL)数量:100背景颜色:0BG阈值:80反转:FALSE最大强度偏差:40最大x角:1.1最大y角:1.1最大z角:0.5显示样本:FALSE宽度:8高度:8最大比例:-1RNG种子:12345从图像收集中创建训练样本...OpenCV错误:调整大小时断言失败(ssize.width> 0& ssize.height> 0),文件/build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp,第4044行抛出'cv :: Exception'实例后调用终止what():/build/opencv/src/opencv-3.4.0/modules/imgproc/src/resize.cpp:4044:错误:(-215)ssize.width> 0&&ssize.height> 0,函数调整大小

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 ...),尽管我的数据集包含大约300-400张图片,但它会运行并创建.vec文件.

However, if I try to do only two samples (no idea why exactly 2...), it runs and creates the .vec file, although my dataset includes about 300-400 pictures.

annotations.dat

提前感谢您的支持!

推荐答案

已解决!感谢Micka提出解决方案并提出正确建议.注释文件中有错误.对兴趣点的描述之一是 0 0 0 0 ,它是无效的.务必仔细检查文件!

Solved! Thank to Micka for suggesting a solution and being right. There was an error in the annotations file. One of the descriptions of a point of interest was 0 0 0 0 which is invalid. Always check your files carefully!

这篇关于Opencv_createsamples失败并出现分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆