Possible Duplicate:
Getting started with OpenCV 2.4 and MinGW on Windows 7
I installed the MinGW compiler and OpenCV2.4.0 in Windows 7. I wrote some C++ code, compiled it and ran it, but it can't display the image:
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
{
Mat im = imread("baboon.jpg
if (im.empty()) {
cout << "Cannot open image!" << endl;
return -1;
}
imshow("image", im);
waitKey(0);
return 0;
}
After compiling, everything is ok. The moment you run loadimg.exe
, there's a black dialog box that pops up, but it does not display images, and then loadimg.exe
stops working. I know it is a problem with MinGW. I checked my GCC with gcc -v, the version is 4.6.2. I can compile other c++ source and run it Ok, so I don't know what happened and how to fix it.