views:

536

answers:

3

Hi, 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 << " ";

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?

+1  A: 

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.

Marcin
In your OpenCV\lib directory you should find two types of .lib files (for example: cv210.lib and cv210d.lib). If you are building your Solution in debug mode, in project properties you should link to the cv210d.lib, if you are building your solution in release mode, you should link to the cv210.lib. Same thing corresponds to dll files from OpenCV/bin dorectory. I hope it will help and sorry for not responding for a while:/
Marcin
A: 

I am facing the same problem. Would you explain exactly how to solve the problem with libraries? tnx

sajjad
A: 

Would you give a detailed account how to solve this problem please?

rt_svm