Opencv HarrisとFAST角点検出アルゴリズム


Harrisアルゴリズム
#include
#include
#include

using namespace cv;
using namespace std;

int thresh = 53;
Mat src, dst, norm_dst, gray_img, abs_dst, out1, out2;
void callback(int, void*);

int main(int arc, char** argv)
{
	struct timeval t1,t2;
	src = imread("cloned1.png");
	namedWindow("input", CV_WINDOW_AUTOSIZE);
	imshow("input", src);
	cvtColor(src, gray_img, CV_BGR2GRAY);

	namedWindow("output", CV_WINDOW_AUTOSIZE);
	
	gettimeofday(&t1,NULL);
	cout <(i, j);
			if (value > thresh) {
				circle(result_img, Point(j, i), 1, Scalar(0, 255, 0), 2);
			}
		}
	}
	imshow("output", result_img);
}

 
Fastアルゴリズム
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
using namespace cv;

int main() {
	vector<:keypoint> keypoints;
	Mat image= cv::imread("cloned2.png"); 
	keypoints.clear();
	FastFeatureDetector fast(10);

	fast.detect(image,keypoints);				
	imshow("FAST   ", image);
	struct timeval t1,t2;
	gettimeofday(&t1,NULL);
	cout<

コンパイル実行:g++fast.cpp -o fast `pkg-config --cflags --libs opencv`