Ask Your Question
0

imread returning empty matrix in debug, double-checked that I have the correct libs

asked 2014-01-22 15:56:29 -0600

morganpackard gravatar image

I've seen several references to an issue in which imread fails silently when the wrong libs are used. It's working properly for me in release mode, but not in debug mode. I've triple-checked that my configuration is the same across the two with the exception of adding a "d" at the end of every lib's name, for "debug". So instead of including opencv_highgui248e.lib, I include opencv_highgui248d.lib. I'm using visual studio 2012, building for x64. My library path is C:\sdf3\opencv_2_4_8\build\x64\vc11\lib (though I've also tried vc12).

Any ideas what else I can try?

edit retag flag offensive close merge delete

Comments

more a common sense thing : when starting the prog from the ide, make sure the startup path is correct (it just might not find the image)

berak gravatar imageberak ( 2014-01-22 16:03:23 -0600 )edit

Confirmed. The image is findable. Any other ideas?

morganpackard gravatar imagemorganpackard ( 2014-01-22 16:06:13 -0600 )edit

Is it possible that you made a type here 'opencv_highgui248e.lib'? As far as I know the release libraries dont have an 'e' at the end. Also visual studio is quite stupid when it comes to locating sourcefiles. The place where your image of imread is located for release is NOT the same as for debug. Please try to use an absolute path, like C:/data/image.jpeg and see if the problem still exists?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 04:40:47 -0600 )edit
1

I encountered the same issue. It turns out I should use the full path of the image file.

smwikipedia gravatar imagesmwikipedia ( 2015-07-22 00:22:41 -0600 )edit

1 answer

Sort by » oldest newest most voted
-1

answered 2014-01-23 03:46:55 -0600

claycau gravatar image

try to add #include <opencv2\highgui.hpp> in your code and recompile it

edit flag offensive delete link more

Comments

Seriously ... think about your answer ... if it works in release, then it will not be due to including the wrong opencv header file ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 04:38:34 -0600 )edit

Hmm .... Maybe , in my code there is the same problem and I try to solve it by find where the “imread” is. And I find it in the opencv2\highgui.hpp. Obviously, I should cover it in my program.... and it really work in my code = =!

claycau gravatar imageclaycau ( 2014-01-23 09:49:48 -0600 )edit

You understand me wrongly, he already has that include, since his code does actually execute well in release mode. Without it, there would be linker errors, specifying that the imread function cannot be found.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-24 02:31:50 -0600 )edit

Got it! I misunderstand your point. Your suggestion is right~

claycau gravatar imageclaycau ( 2014-01-24 02:53:54 -0600 )edit

Question Tools

Stats

Asked: 2014-01-22 15:56:29 -0600

Seen: 3,074 times

Last updated: Jan 23 '14