I just installed OpenCV 2.2 and Visual C++ 2010 and configured it. I don't get compilation errors but running this code I get this error
Unhandled exception at 0x6c2f22f2 (msvcr100.dll) in Es_CornerDetector.exe: 0xC0000005: access violation reading location 0x002a1000.
Code:
#include "opencv/highgui.h"
#include "opencv2/features2d/features2d.hpp"
int main(int argc, char** argv)
{
cv::SurfFeatureDetector detector;
detector.create("SURF");
}
I really don't understand which can be the cause..
The use of "detector.create()" may be wrong so I tried something different but i get another error (always when I try to access "detector"):
First-chance exception at 0x67608ef4 in Es_CornerDetector.exe: 0xC0000005: Access violation writing location 0x02655008.
Unhandled exception at 0x67608ef4 in Es_CornerDetector.exe: 0xC0000005: Access violation writing location 0x02655008.
Alternative code:
#include "opencv\cv.h"
#include "opencv\highgui.h"
#include "opencv2\features2d\features2d.hpp"
#include <vector>
#include <iostream>
int main()
{
IplImage* img_temp = cvLoadImage("img.jpg");
cv::Mat img(img_temp);
if(img.empty()==1)
{
std::cout << "Can't load the image.." << endl;
getchar();
return -1;
}
cv::SurfFeatureDetector detector;
vector<cv::KeyPoint> keypoints;
detector.detect(img,keypoints);
return 0;
}
I get the same error in 2 different system both with VS2010 and VS2008 and also if I try to run the example code descriptor_extractor_matcher.cpp that can be found in ..\OpenCV2.2\samples\cpp\descriptor_extractor_matcher.cpp
Wow, new exotic error:
Run-Time Check Failure #2 - Stack around the variable 'keypoints' was corrupted.
I'm about to give up...
I had the same problem and figured out that the directory having opencv binaries in my system path was incorrectly led to wrong directory which contains vc10 or vc9 opencv binaries. See if your problem is something like this. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With