Fast corner detection

int _tmain(int argc, _TCHAR* argv[]) {
	Mat img = imread("LenaGr.jpg", 0);

	//vector of KeyPoints
	vector<KeyPoint> keyPoints;

	//construction of the fast feature detector object
	FastFeatureDetector fast(40);
	//feature point detection
	fast.detect(img, keyPoints);
	
	drawKeypoints(img, keyPoints, img, Scalar::all(-1), DrawMatchesFlags::DEFAULT);
	
	//output all the (x,y) of keypoint
	vector<KeyPoint>::iterator it;

	for(it = keyPoints.begin(); it != keyPoints.end(); ++it) {
		printf("x=%f y=%f\n", it->pt.x, it->pt.y);
	}

	namedWindow("img", WINDOW_AUTOSIZE);
	imshow("img", img);

	waitKey(0);
	return 0;
}


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章