imread not working in Opencv(imread 在 Opencv 中不起作用)
问题描述
我正在尝试使用 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 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:imread 在 Opencv 中不起作用
基础教程推荐
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
