Hi,
Ive been trying out SIFT/SURF from online resources and wanted to test it out myself.
I first tried without the non-free libraries using this code:
int _tmain(int argc, _TCHAR* argv[])
{
Mat img = imread("c:\\car.jpg", 0);
Ptr<FeatureDetector> feature_detector = FeatureDetector::create("SIFT");
vector<KeyPoint> keypoints;
feature_detector->detect(img, keypoints);
Mat output;
drawKeypoints(img, keypoints, output, Scalar(255, 0, 0));
namedWindow("meh", CV_WINDOW_AUTOSIZE);
imshow("meh", output);
waitKey(0);
return 0;
}
Here if I do a step by step debugging it breaks at feature_detector->detect(img, keypoints);
Then I tried using the non-free library and tried this code:
int main(int argc, char** argv)
{
const Mat input = cv::imread("/tmp/image.jpg", 0); //Load as grayscale
SiftFeatureDetector detector;
vector<KeyPoint> keypoints;
detector.detect(input, keypoints);
// Add results to image and save.
Mat output;
drawKeypoints(input, keypoints, output);
imwrite("/tmp/SIFT_RESULT.jpg", output);
return 0;
}
This again compiles without errors but when ran, breaks at this step: detector.detect(input, keypoints);
I cannot find the reason why. Can some one please help me out here.
Thank you