OpenCV imread(filename) fails in debug mode when using release libraries(使用发布库时,OpenCV imread(filename) 在调试模式下失败)
问题描述
我有一些 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) 在调试模式下失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用发布库时,OpenCV imread(filename) 在调试模式下
基础教程推荐
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- C++,'if' 表达式中的变量声明 2021-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- 设计字符串本地化的最佳方法 2022-01-01