Sunday, April 28, 2013

Surf Detector

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
using namespace std;
using namespace cv;
//#include "Functions.h"
char* source_window = "Source image";
char* corners_window = "Corners detected";
int main()
{
Mat src;
src = imread("building.jpg",CV_LOAD_IMAGE_GRAYSCALE);
if(src.empty())
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
// -- step 1: Detect the keypoints using SURF Detector
int minHessian = 200;
SurfFeatureDetector detector(minHessian);
vector<KeyPoint> keypoints;
detector.detect(src,keypoints);
Mat img_keypoints;
drawKeypoints(src,keypoints,img_keypoints,Scalar::all(-1), DrawMatchesFlags::DEFAULT);
imshow("Keypoins", img_keypoints);
waitKey(0);
return 0;
}
view raw gistfile1.cpp hosted with ❤ by GitHub

No comments:

Post a Comment