OpenCV 2.4 error 0xc0000005 in Windows 7 64 bit

0

I am using CodeBlocks in my windows 7 64 bit and I use MinGw for my default c/c++ compiler.

Few days ago I need to use OpenCV, after I struggle a lot of error, I get unsolveable error like this :

img

img2

The sample code:

#include "cv.h"
#include "highgui.h"

int main( int argc, char** argv ) {
    IplImage* img = cvLoadImage( argv[1] );
    cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
    cvShowImage( "Example1", img );
    cvWaitKey(0);
    cvReleaseImage( &img );
    cvDestroyWindow( "Example1" );
}

I believe my linked & directory setting is correct. So please help me :) I am about to give up :(

c++
windows
opencv
64-bit
asked on Stack Overflow Aug 13, 2012 by psuedobot • edited Aug 23, 2019 by Glorfindel

2 Answers

0

Assuming that you are doing everything correct in the code and the image, this can be a problem due to incompatible opencv binaries.

Please have a look at a similar installation to compile and see if it works. I had a similar problem in my installation, which was fixed by compiling the binaries again.

answered on Stack Overflow Aug 14, 2012 by masad
0

The problem is most probably a failure when loading the image. But you will only be certain if you check the return of cvLoadImage():

IplImage* img = cvLoadImage( argv[1] );
if (!img)
{
    printf("!!! cvLoadImage failed\n");
}

The function fails if the image format is not supported, or if the image is not found in the specified location.

You application expects to load the file passed from the command line, so you better execute your application with: Main.exe C:\some_img.png

You can also hardcode the filename in your code:

IplImage* img = cvLoadImage("C:\\some_img.png");
if (!img)
{
    printf("!!! cvLoadImage failed\n");
}
answered on Stack Overflow Aug 14, 2012 by karlphillip

User contributions licensed under CC BY-SA 3.0