使用发布库时,OpenCV imread(filename) 在调试模式下

OpenCV imread(filename) fails in debug mode when using release libraries(使用发布库时,OpenCV imread(filename) 在调试模式下失败)

本文介绍了使用发布库时,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) 在调试模式下

基础教程推荐