Ask Your Question

Photonik's profile - activity

2019-09-30 06:17:19 -0600 received badge  Popular Question (source)
2016-05-20 07:14:12 -0600 answered a question save png with imwrite() - read access violation

This isn't a real solution for the problem itself, but somewhere I found a way by using the C API.

cvSaveImage("image.png", &IplImage(mat) );

I don't get any errors and the images save fine in every supported format.

2016-05-20 03:39:12 -0600 commented question save png with imwrite() - read access violation

Sorry for the late reply, I was very busy otherwise. For the time being I use the image save function of QT, which works, but limits me to 8bit, but I'd really need 16bit for my purposes (and don't want to use xml/yaml as alternative).

My .pro file of QT looks like this (OpenCV parts only)

INCLUDEPATH += C:\opencv\build\include

CONFIG(release,debug|release)
{
LIBS += C:\opencv\build\x64\vc12\lib\opencv_world310.lib
}

CONFIG(debug,debug|release)
{
LIBS += C:\opencv\build\x64\vc12\lib\opencv_world310d.lib
}

So I don't think I linked anything wrong. If so, please correct me; I just did, what others suggested.

2016-04-20 07:02:28 -0600 asked a question 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