Ask Your Question

Benny's profile - activity

2018-08-10 09:43:53 -0600 received badge  Notable Question (source)
2016-09-02 15:30:30 -0600 received badge  Popular Question (source)
2014-03-26 06:12:25 -0600 commented question Problem with imread in debug mode

Close enough!!. Problem solved!. Actually, though the "Character Set" wasn't set that wasn't the problem. The problem was "Runtime library" in Project settings->C/C++ -> Code Generation which should be "Multi-threaded Debug DLL" instead of just "Multi-threaded" Thank U!!

2014-03-26 05:17:48 -0600 commented question Problem with imread in debug mode

Yes, I am sure about the path and I also used "/". Did you tested it in debug mode? Once again, the problem, as reflects when debugging the code, is that the string which actually got passed to imread was different than the one I specified.

2014-03-26 03:47:09 -0600 received badge  Editor (source)
2014-03-26 02:52:32 -0600 asked a question 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?

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!