OpenCV Createsamples ROI断言失败错误排查求助
OpenCV createsamples 执行报错问题
执行命令
在VS Code终端执行以下命令:
C:\Ankit\VirEnv\opencv\build\x64\vc14\bin\opencv_createsamples.exe -info C:\Ankit\VirEnv\pos.txt -w 20 -h 20 -num 1000 -vec pos.vec
相关文件说明
pos.txt文件通过opencv_annotation工具生成,包含标注的目标边界框坐标。
命令执行输出
Info file name: C:\Ankit\VirEnv\pos.txt Img file name: (NULL) Vec file name: pos.vec BG file name: (NULL) Num: 1000 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 Max z angle: 0.5 Show samples: FALSE Width: 20 Height: 20 Max Scale: -1 RNG Seed: 12345 Create training samples from images collection... Unable to open image: C:\Ankit\VirEnv\C:\Ankit\VirEnv\Test\Positive\opencv_frame_0.png OpenCV: terminate handler is called! The last OpenCV error is: OpenCV(3.4.16) Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file C:\build\3_4_winpack-build-win64-vc14\opencv\modules\core\src\matrix.cpp, line 751
最终错误信息
OpenCV(3.4.16) Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file C:\build\3_4_winpack-build-win64-vc14\opencv\modules\core\src\matrix.cpp, line 751
问题描述
我通过opencv_annotation工具生成的pos.txt应该包含正确的边界框坐标,但执行命令后仍触发上述错误。已参考相关视频教程和OpenCV官方文档,无法定位问题原因。
内容的提问来源于stack exchange,提问作者Ankit_Gunner
相关产品推荐
相关产品推荐

