OpenCV 2.4 error 0xc0000005 in Windows 7 64 bit

浪子不回头ぞ 提交于 2019-12-13 03:50:44

问题


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 :

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 :(


回答1:


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.




回答2:


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");
}


来源:https://stackoverflow.com/questions/11935422/opencv-2-4-error-0xc0000005-in-windows-7-64-bit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!