Unhandled exception at using detect function(ORB)

asked 2015-11-10 08:25:49 -0500

Jalg gravatar image

updated 2015-11-11 08:47:56 -0500

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.

edit retag flag offensive close merge delete

Comments

I have try your code using opencv 3.0 there is no error. Check your image :

 cout<<img.depth()<<" "<<img.size()<<" "<<img.channels()<<" ";

What is your error message?

LBerger gravatar imageLBerger ( 2015-11-10 09:41:52 -0500 )edit

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.

Jalg gravatar imageJalg ( 2015-11-10 11:28:52 -0500 )edit

Same configuration for me. As you use VS 2015 I think you have build opencv

LBerger gravatar imageLBerger ( 2015-11-10 12:32:44 -0500 )edit

Have you build opencv with VS 2015 using cmake?

LBerger gravatar imageLBerger ( 2015-11-11 07:36:00 -0500 )edit

no, any link for do it?

Jalg gravatar imageJalg ( 2015-11-11 08:48:26 -0500 )edit

I think that Dll on website are not compatible with VS 2015 only with vs2013 and 2012. I think that @berak can confirm this.

LBerger gravatar imageLBerger ( 2015-11-11 10:26:07 -0500 )edit

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.

berak gravatar imageberak ( 2015-11-11 10:31:03 -0500 )edit

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...

Jalg gravatar imageJalg ( 2015-11-11 20:05:01 -0500 )edit