1
votes

I'm trying to get the keypoints in a image using the detector ORB but always gets an exception and crash, 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().

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 for simplify:

Ptr < BRISK > detector = BRISK::create();
vector <KeyPoint> kp;
detector->detect(img,kp);

This is turning exasperating.

I using opencv 3 in visual studio 2015 with windows 10.

Sorry for my English and thanks for the answer.

2

2 Answers

0
votes

Ok i solve my problem building opencv for visual studio with cmake and the opencv_contrib, i follow the instructions of the next links if someone have the same problem:

http://audhootchavancv.blogspot.in/2015/08/how-to-install-opencv-30-and.html

0
votes

This error continues in CV2 version 4.2.0 actual for today. I have similarly tried to initialize with cv2.ORB(), received the ~00x5 error, tried ORB_create() and it eventually worked!