問題描述
我正在嘗試使用 OpenCV2.2 中的 imread
函數.
I'm trying to use the imread
function from OpenCV2.2.
我的代碼很簡單.
cv::Mat host= imread("1.bmp", CV_LOAD_IMAGE_GRAYSCALE);
之后,宿主矩陣被零指針填充,即圖像尚未加載.
After that, the host matrix became filled by zeros pointers, i.e. an image has not loaded.
如果我使用 cvLoadImage
那么一切正常.
If I use cvLoadImage
then it all works properly.
文件存在,我沒有混合發布和調試庫.為什么 imread
不起作用?
The file exists, and I am not mixing the release and debug libraries. Why imread
doesn't work?
推薦答案
轉載于 opencv 2.4.8.
Reproduced with opencv 2.4.8.
如果您在 Debug 中運行,請檢查您是否也在使用調試庫,它解決了我們的問題.: OpenCV imread(filename) 在調試模式下使用時失敗發布庫.
If you are running in Debug, check that you are also using debug libraries, it fixed our problem. : OpenCV imread(filename) fails in debug mode when using release libraries.
這篇關于imread 在 Opencv 中不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!