I'm new on openCV. I'm working on feature matching. Currently, I would like to extract ORB feature using openCV. I searched example and guide line how to use ORB feature on openCV. I tried a very simple source code to extract ORB feature that I referred on the internet. But I don't know why it threw an unhandled exception with the message like "Unhandled exception at 0x1000AAD2 (Ldcnlib.dll) in motors.exe: 0xC0000005: Access violation writing location 0x00000025". It's often a kind of memory error. But I cannot find the reason out. Could anyone help me to find the solution to solve this error? The input image size is 240x98.
Source code:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/features2d/features2d.hpp"
#include <vector>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat img_1 = imread("008_1.jpg",CV_LOAD_IMAGE_GRAYSCALE);
if (!img_1.data){
cout << "error"<< endl;
return -1;
}
// declare variables
OrbFeatureDetector detector;
vector<KeyPoint> kp1;
Mat desc1;
detector.detect(img_1,kp1);
// to do more
waitKey(0); // Wait for a keystroke in the window
return 0;
}
User contributions licensed under CC BY-SA 3.0