Reputation: 7434
On Windows 7 64 bit, AMD processor, I installed OpenCV 2.4.5, with eclipse CDT Juno and MinGW, everything to the latest update. Previously eclipse CDT and MinGW compiled 100+ source files without problems. They even compile this small OpenCV source file,
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
int main()
{
IplImage* img1 = cvLoadImage("lenna.png");
cvShowImage("MyWindow1", img1);
cv::Mat img2;
img2 = cv::imread("lenna.png", CV_LOAD_IMAGE_COLOR);
cv::namedWindow("MyWindow2", CV_WINDOW_AUTOSIZE);
cv::imshow("MyWindow2", img2);
cvWaitKey(0);
return 0;
}
but when I try to Run it then it breaks with notorious
"The application was unable to start correctly (0xc0000005). Click OK to close the application."
What might be wrong and what would be solution to this problem?
opencv_calib3d245 opencv_contrib245 opencv_core245 opencv_features2d245 opencv_flann245 opencv_gpu245 opencv_highgui245 opencv_imgproc245 opencv_legacy245 opencv_ml245 opencv_nonfree245 opencv_objdetect245 opencv_photo245 opencv_stitching245 opencv_video245 opencv_videostab245
Upvotes: 1
Views: 6925
Reputation: 7434
After many trials and errors I decided to follow this tutorial and to compile my own binaries as it seems that too many people are complaining that precompiled binaries are NOT working for them. Eclipse CDT Juno was already installed.
My procedure was as follows:
You can use this code to test your setup:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
Mat img = imread("c:/lenna.png", CV_LOAD_IMAGE_COLOR);
namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
imshow("MyWindow", img);
waitKey(0);
return 0;
}
Don't forget to put image to the C:/ (or wherever you might find suitable, just be sure that eclipse have read acess.
Upvotes: 6
Reputation: 2588
Can you try this code,
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
Mat img = imread("lenna.png", CV_LOAD_IMAGE_COLOR);
namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
imshow("MyWindow", img);
waitKey(0);
return 0;
}
cause it seems like you are not creating a window for img1, and not assigning imread output to img2.
Upvotes: 1