我有一些 C++ 代码,除了 imread(file) 函数外,OpenCV 一切正常.它正确地找到了文件并加载了名称,但没有加载任何数据.
I have some C++ code and everything was working fine with OpenCV except the function imread(file). It was finding correctly the file and loading the name, but it wasn't loading any data.
Mat pattImage = imread(fileName, 0);
在网络上进行一些研究后,我意识到我处于调试模式,但使用的是 OpenCV 发布库,而不是调试库.
After some reaserch on the web I realized that I was in debug mode but with the release OpenCV libraries, instead of the debug ones.
debug library: opencv_core231d.lib
release library: opencv_core231.lib
虽然这是典型的愚蠢错误,我认为这不应该有任何关系,调试库应该允许 OpenCV 代码调试,而发布库允许更快地执行代码,但是我不明白为什么 imread 失败了.
Though it is the tipical stupid error I thought this shouldn't have anything to do, the debug libraries are supposed to allow OpenCV code debugging while the release libraries allow faster execution of the code, but I don't understand why imread was failing.
谁能解释一下OpenCV中调试和发布库之间的区别,以及为什么会出现这个错误?
Can anybody explain me the differences between debug and release libraries in OpenCV and why this error occurs?
这是一个 OpenCV 错误吗?
我永远不会厌倦告诉人们Windows 的 C++ OpenCV 接口有最奇怪的错误.
I'll never get tired of telling people that the C++ OpenCV interface for Windows has the wierdest bugs.
使用 C 接口编写一个小测试来检查它是否有效(cvLoadImage() 等).
Write a small test using the C interface to check if it works or not (cvLoadImage(), etc).
更新:既然您知道 C 接口工作正常,您可以转到邮件列表并在那里报告此错误,或者自己深入研究代码以找出失败的原因.
Update: now that you know that the C interface works properly, you can either go to the mailing list and report this bug there or dig into the code yourself to find why it fails.
这篇关于使用发布库时,OpenCV imread(filename) 在调试模式下失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
断言失败(size.width>0 && size.height&gAssertion failed (size.widthgt;0 amp;amp; size.heightgt;0)(断言失败(size.width0 amp;amp; size.height0))
在 C++ 中旋转图像而不使用 OpenCV 函数Rotate an image in C++ without using OpenCV functions(在 C++ 中旋转图像而不使用 OpenCV 函数)
OpenCV:处理每一帧OpenCV: process every frame(OpenCV:处理每一帧)
为什么我不能在 openCV 中打开 avi 视频?Why can#39;t I open avi video in openCV?(为什么我不能在 openCV 中打开 avi 视频?)
OpenCV 无法设置 SVM 参数OpenCV unable to set up SVM Parameters(OpenCV 无法设置 SVM 参数)
使用 cvtColor 转换单一颜色Convert a single color with cvtColor(使用 cvtColor 转换单一颜色)