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 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`

 

你可能感兴趣的:(opencv编程)