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 }

  • 相关阅读:
    PHP 单例 工厂模式 类的重载 抽象 接口
    上传文件
    ThinkPHP3.2中if标签
    JS闭包特性 运算符 DOM操作
    循环数组 连接数据库 AJAX
    ThinkPHP
    TP框架
    MVC框架
    类的自动加载,静态属性静态方法
    魔术方法__get()和set函数
  • 原文地址:https://www.cnblogs.com/sclu/p/11511925.html
Copyright © 2011-2022 走看看