zoukankan      html  css  js  c++  java
  • 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 }

  • 相关阅读:
    java下载url图片链接
    mysql 设计索引的原则
    169. 多数元素
    263. 丑数
    markdown 语法笔记
    70.爬楼梯
    540. 有序数组中的单一元素
    88. 合并两个有序数组
    面试题57
    152. 乘积最大子序列
  • 原文地址:https://www.cnblogs.com/sclu/p/11511925.html
Copyright © 2011-2022 走看看