問題描述
我有一些 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模板網!