opencv学习笔记6 角点检测

角点检测

1.harris焦点检测

void cornerHarris(InputArray src,OutputArray dst, int blockSize, int ksize, double k, intborderType=BORDER_DEFAULT )

opencv学习笔记6 角点检测 

1     Mat src = imread("E:/house.png", 0);
2     Mat harris,harris_bin;
3     cornerHarris(src, harris, 2, 3, 0.01);
4     threshold(harris, harris_bin, 0.00001, 255, THRESH_BINARY);
5     imshow("src", src);
6     imshow("角点检测后的二值效果图", harris_bin);
7     waitKey();

 

 opencv学习笔记6 角点检测

 

 2.阈值(用于生成二值图)

double threshold(InputArray src,OutputArray dst, double thresh, double maxval, int type)

opencv学习笔记6 角点检测

opencv学习笔记6 角点检测

 1 #include<opencv.hpp>
 2 #include<vector>
 3 using namespace std;
 4 using namespace cv;
 5 int main()
 6 {
 7     Mat src = imread("E:/test.jpg",0);
 8     imshow("src", src);
 9     Mat thresh_bin;
10     threshold(src, thresh_bin, 127, 255, THRESH_BINARY); //阈值127
11     imshow("thresh_bin", thresh_bin);
12     Mat thresh_bin_inv;
13     threshold(src, thresh_bin_inv, 127, 255, THRESH_BINARY_INV);
14     imshow("thresh_bin_inv", thresh_bin_inv);
15     waitKey();
16     return 0;
17 }

opencv学习笔记6 角点检测

上一篇:OpenCV(Python)--1,图像的读取,显示和保存


下一篇:利用高斯矩阵模糊图像的标签