問題描述
我有一些 C++ 代碼,除了 imread(file)
函數(shù)外,OpenCV 一切正常.它正確地找到了文件并加載了名稱,但沒有加載任何數(shù)據(jù).
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);
在網(wǎng)絡(luò)上進(jìn)行一些研究后,我意識到我處于調(diào)試模式,但使用的是 OpenCV 發(fā)布庫,而不是調(diào)試庫.
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
雖然這是典型的愚蠢錯誤,我認(rèn)為這不應(yīng)該有任何關(guān)系,調(diào)試庫應(yīng)該允許 OpenCV 代碼調(diào)試,而發(fā)布庫允許更快地執(zhí)行代碼,但是我不明白為什么 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中調(diào)試和發(fā)布庫之間的區(qū)別,以及為什么會出現(xiàn)這個錯誤?
Can anybody explain me the differences between debug and release libraries in OpenCV and why this error occurs?
這是一個 OpenCV 錯誤嗎?
推薦答案
我永遠(yuǎn)不會厭倦告訴人們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 接口工作正常,您可以轉(zhuǎn)到郵件列表并在那里報告此錯誤,或者自己深入研究代碼以找出失敗的原因.
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.
這篇關(guān)于使用發(fā)布庫時,OpenCV imread(filename) 在調(diào)試模式下失敗的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!