Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with imread in debug mode

Hi

I am trying to use imread() in a very simple manner:

const string ImageName("D:\SomeImage.tif");
Mat Image=imread(ImageName);

the problem is that the returned Mat is empty.

I compiled the opencv sources myself (Ver 2.4.6.0) using VS 2008 SP1 in both debug and release modes.

Have started debugging the code in debug mode where I have used the debug lib files for linker input (i.e., opencv_somemodule246d.lib etc.) and copied the corresponding debug dlls and pdb files to the application directory.

When the debugger hit the imread() line I steped into imread and saw that the actual value passed in the string for the file name was garbage so obviously it returned empty matrix. I also tried to use non const string and const and non const char* for the image name - the results were identical!. I should note that in release mode there isn't any problem and the passed string is the correct one.

Any ideas?

Problem with imread in debug mode

Hi

I am trying to use imread() in a very simple manner:

const string ImageName("D:\SomeImage.tif");
ImageName("D:/SomeImage.tif");
Mat Image=imread(ImageName);

the problem is that the returned Mat is empty.

I compiled the opencv sources myself (Ver 2.4.6.0) using VS 2008 SP1 in both debug and release modes.

Have started debugging the code in debug mode where I have used the debug lib files for linker input (i.e., opencv_somemodule246d.lib etc.) and copied the corresponding debug dlls and pdb files to the application directory.

When the debugger hit the imread() line I steped into imread and saw that the actual value passed in the string for the file name was garbage so obviously it returned empty matrix. I also tried to use non const string and const and non const char* for the image name - the results were identical!. I should note that in release mode there isn't any problem and the passed string is the correct one.

Any ideas?

Edit : Changed my typo ImageName("D:\SomeImage.tif") to ImageName("D:/SomeImage.tif"); I have actually tried it with "\\" and with "/" for the file separator - the result were the same: garbage passed string - once again this happens only on debug mode, in release - everything OK!