Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

save png with imwrite() - read access violation

Hey there,

I already searched everything I could but only found similar problems, not a single proper solution. What I'm using: Win7 x64, QT 5.5.1 x64, VS2013 as compiler, opencv 3.1 x64 (precompiled version from the website).

I already have lots of code using opencv that works well. Only problem: writing png/jpg with imwrite while in debug mode.

#include "opencv2/opencv.hpp"
...
cv::imwrite("D:/Scans/image.png", matTemp); // crashes
cv::imwrite("D:/Scans/image.bmp", matTemp); // works fine

Error: ... code: 0xc0000005: read access violation at: 0x0, flags=0x0

As said, this only happens when trying to save JPG or PNG in DEBUG mode. Saving as bmp works fine, saving as png and jpg while in release mode works, too. So there's nothing wrong with the Mat, the saved images are ok.

What I've gathered is, that this might have to do with opencv_ffmpeg*.dll. (also I read, that 0xc0...05 usually points to problems with (wrong) dlls)

There's no debug version of that file in the opencv-dl, so it makes sense to me, that it crashes when I try to access dependent methods.

Question is, how can I use ffmpeg in debug mode? I'm not a professional programmer, nor a particularily good hobbyist - I just do image processing and work my way through programming as good as I can - so I'm happy that everything is set up and works (mostly).

Would I need to build a debug dll myself? If so, how, from what? I've no idea about that stuff. Or is there a simpler way to get it to work with what I already have?

Some mentioned copying the ffmpeg.dll in the debug folder, didn't help. ...\vc12\bin\ is registered as PATH variable, doesn't help.

I'd be very thankful, if anyone could help me with that problem. I'm out of (my very limited) ideas and would really like to solve this.

Photonik