OpenCVのコーナー検出の研究ノート6

コーナー検出

焦点検出1.harris

cornerHarris (InputArray SRC、OutputArray DST、int型のblockSize、int型ksize、ダブルK、intborderType = BORDER_DEFAULT)

 

1      マットSRC =(IMREAD " E:/house.png "0 );
 2つの     マットハリス、harris_bin;
 。3      cornerHarris(SRC、ハリス、230.01 );
 4      閾値(ハリス、harris_bin、0.00001255 、THRESH_BINARY )
 。5      関数imshow(" SRC " 、SRC)
 。6      関数imshow(" コーナー点がバイナリレンダリングを検出する" 、harris_bin)
 。7      waitKey()。

 

 

 

 2.閾値(二値画像を生成するための)

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

 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 }

おすすめ

転載: www.cnblogs.com/sclu/p/11511925.html