• opencv学习笔记6 角点检测


    角点检测

    1.harris焦点检测

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

     

    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();

     

     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 }

  • 相关阅读:
    android数据恢复
    UVA 690 Pipeline Scheduling
    2017 国庆湖南 Day4
    2017 国庆湖南 Day5
    2017 国庆湖南 Day6
    2017国庆 清北学堂 北京综合强化班 Day1
    2017 国庆湖南Day2
    bzoj 2962 序列操作
    UVA 818 Cutting Chains
    UVA 211 The Domino Effect
  • 原文地址:https://www.cnblogs.com/sclu/p/11511925.html
Copyright © 2020-2023  润新知