Unhandled exception at using detect function(ORB)
Hi, i'm trying to get the keypoints in a image using the detector ORB but always gets an exception, my code is the next one.
vector < KeyPoint > kp;
int nfeatures = 500;
float scaleFactor = 1.2f;
int nlevels = 8;
int edgeThreshold = 15;
int firstLevel = 0;
int WTA_K = 2;
int scoreType = ORB::HARRIS_SCORE;
int patchSize = 31;
int fastThreshold = 20;
Ptr < ORB > detector = ORB::create(
nfeatures,
scaleFactor,
nlevels,
edgeThreshold,
firstLevel,
WTA_K,
scoreType,
patchSize,
fastThreshold );
detector->detect(img, kp);
cout << "Found " << kp.size() << " Keypoints " << std::endl;
Mat out;
drawKeypoints(img, kp, out, Scalar::all(255));
imshow("Kpts", out);
img is declared early, the problem is when do detector->detect(img, kp); and i don't know what problem is, i'm trying other form of do it but all crash in the call of detect().
edit:
I try to do with BRISK and the problem is the same in the call of detect crash. With brisk i did the next one:
Ptr < BRISK > detector = BRISK::create();
vector <KeyPoint> kp;
detector->detect(img,kp);
This is turning exasperating.
Sorry for my english and thanks for the answer.
I have try your code using opencv 3.0 there is no error. Check your image :
What is your error message?
The message error is Unhandled exception at 0x753E3E28 in Trabajo1.exe: Microsoft C++ exception: cv::Exception at memory location 0x009AD9E0.
But other times say access violation writing, and change every run...
The only librarys i include for that is: "opencv2/features2d.hpp"
is ok? I have opencv 3 already and the image is ok
edit: I use that in windows 10 with visual studio 2015.
Same configuration for me. As you use VS 2015 I think you have build opencv
Have you build opencv with VS 2015 using cmake?
no, any link for do it?
I think that Dll on website are not compatible with VS 2015 only with vs2013 and 2012. I think that @berak can confirm this.
sorry, i can't (no vs2015 here)
apart from that, building from src is always the better idea, imho. you get libs, that fit your env, there will be bugs and bugfixes, you'll find out, that you need opencv_contrib as well, etc. the sooner you get used to updating your own system, the better.
Build opencv with opencv_contrib solve the problem thank you very much. For solve i follow the next instructions if someone have the same problem: http://audhootchavancv.blogspot.in/20...