0xC0000005 dll exception: imwrite functions cvtcolor does not

asked 2016-04-10 04:53:09 -0600

muon_strange gravatar image

updated 2016-04-10 06:28:55 -0600

Good afternoon everybody!

I have what I believe to be a DLL runtime loading, nevertheless I'm at my knowledge's end. If you care to have a look at my failing code:

Mat src;
Mat resized;
Mat gray;
src = imread("C:\\E.bmp", 1);
imwrite("egami.bmp", src);

cvtColor(src, gray, COLOR_RGB2GRAY);
imwrite("egami_gray.bmp", resized);

I am positive that the image is well read because egami.bmp is created correctly with the same lena_std face as usual.

The cvtColor line however throws an exception:

 0xC0000005: Access violation reading location 0x0000000000000000

I'm puzzled: how can I load and write an image correctly if my dll are not found? Could it be because I switched from 2.4.10 to 3.1 (prebuilt vs2015)? Or have I missed something in VS configuration? It does not seem to be linked to debug/release configurations.

edit: the same happens (unsurprisingly when I change the last line to imwrite("egami_gray.bmp", gray);

edit retag flag offensive close merge delete

Comments

please double check, if you accidentally link opencv debug build to release libs, or vice versa, correct vs version, etc.

berak gravatar imageberak ( 2016-04-10 05:45:47 -0600 )edit
1

checked: release configuration is liked with opencv_world310.lib and debug configuration with opencv_world310d.lib both are together in the "lib" folder and both dll are in the "bin" folder

the lib is indicated as additionnal input folder the bin is in the path variable

muon_strange gravatar imagemuon_strange ( 2016-04-10 06:13:18 -0600 )edit

Could you check what error message the console displays? Are you sure your src matrix is a 3-channel matrix?

LorenaGdL gravatar imageLorenaGdL ( 2016-04-10 06:57:10 -0600 )edit

I am flabbergasted!

The console message is 0xC0000005: Access violation reading location 0x0000000000000000 with a dialog box "exception thrown, [same figures] if the program has an exception handler, it may continue execution, [Abort] [Ignore] []"

I tried to ignore: the same exception keeps on happening in console but without dialog box. And the best part: the conversion to grayscale actually happens.

As for the 3-channel matrix, I don't know. The watch indicates 512 rows, 512 collumns but src.dims is 2. And the data pointer is not NULL.

Maybe somebody has any idea as to what happens here? Something with Visual Studio?

oh: and it works with resize() which gave the exact same problem before I reverted to copy the tutorial

muon_strange gravatar imagemuon_strange ( 2016-04-10 07:25:39 -0600 )edit

The black cmd screen is likely to output an additional error message, much more useful than the thrown exception. If the conversion really takes places, are you sure the error is with the cvtColor function?

LorenaGdL gravatar imageLorenaGdL ( 2016-04-10 07:50:35 -0600 )edit

the black cmd sceen has nothing but the cout checks I use to verify the advancement of my programs. I do not know though whether it was so before I clicked ignore in the dialog box.

the exception occurs both when I execute step by step and when I let the program flow. no problem of any kind in imwrite and imread but in cvtColor() and resize() it comes.

muon_strange gravatar imagemuon_strange ( 2016-04-10 09:12:00 -0600 )edit