使用"cv :: imread"读取图像的问题; OpenCv中的功能 [英] Issue with reading an image using "cv::imread" function in OpenCv

查看:176
本文介绍了使用"cv :: imread"读取图像的问题; OpenCv中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对一些基本的OpenCV代码有疑问. 这是我的代码:

I have got a problem with some basic OpenCV code. Here is my code:

 cv::Mat src;
 src=imread("Calibration.bmp",0);

 if (src.empty())
  cout << "Cannot load image" << " ";
 else
  cout << src.cols << " " << src.rows << " ";

不幸的是,cv :: imread返回带有任何类型的输入图像的NULL矩阵(我尝试过.bmp,.jpg).文件名似乎工作正常(程序不会以错误结尾),因为使用错误的文件名会生成错误消息. 我尝试使用旧样式"CvLoadImage",但发生了相同的结果. 有谁知道如何解决这个问题?

Unfortunatelly cv::imread returns NULL matrix with any kind of input image (I have tried .bmp, .jpg). The filename seems to be working fine (program does not end with error), as using wrong filename generates an error message. I have tried using oldstyle "CvLoadImage" but same result occurred. Does anyone have any idea how to fix this?

推荐答案

好,我已经解决了这个问题... 当您混合使用发行版和调试OpenCV库时,会出现问题. 我已经更改了项目属性中的路径和库名称,并且"cv :: imread"可以正常工作.

Ok, I fixed the problem... Problem arises when you are mixing up release and debug OpenCV libs. I've changed paths and libs names in project properties and "cv::imread" works just fine.

这篇关于使用"cv :: imread"读取图像的问题; OpenCv中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆