zoukankan      html  css  js  c++  java
  • Shi-Tomasi角点检测

      Shi-Tomasi角点检测原理与Harris角点检测相同,只是在最后判别式的选取上不同Shi-Tomasi角点检测选取特征中的最小的那个来判别。${ m{R = }}min ({lambda _1},{lambda _2})$,下面是其Shi-Tomasi角点检测结果。

    • Shi-Tomasi角点检测函数参数解释
     1 goodFeaturesToTrack(
     2 InputArray image,//输入图像,8位或浮点数32位
     3 OutputArray corners,//检测到的角点向量
     4 Int maxCorners,//角点的最大数量
     5 Double qualityLevel,//可接受的最小特征值
     6 Double minDistance,//角点之间的最小距离
     7 InputArray mask,//感兴趣区域,一般默认无Mat()
     8 Int blockSize,//自相关矩阵指定的领域范围
     9 Bool useHarris,//是否使用Harris角点检测,1使用,0不使用
    10 Double k,//自相关矩阵权重系数);
     1 #include<opencv2/opencv.hpp>
     2 #include<iostream>
     3 
     4 using namespace std;
     5 using namespace cv;
     6 int init_value=50, max_value=555;
     7 Mat src,gray,dst;
     8 void shi_tomasi(int, void*);
     9 int main(int argc, char** argv)
    10 {
    11     
    12     src = imread("H:/cv_code/image/home.jpg");
    13     if (src.empty())
    14     {
    15         printf("could not find image");
    16         return -1;
    17     }
    18     namedWindow("input");
    19     imshow("input",src);
    20     cvtColor(src,gray,COLOR_BGR2GRAY);
    21     namedWindow("result");
    22     createTrackbar("value:","result",&init_value,max_value,shi_tomasi);
    23     shi_tomasi(0,0);
    24     waitKey(0);
    25     return 0;
    26 }
    27 
    28 void shi_tomasi(int, void*)
    29 {
    30     if (init_value <= 1)
    31         init_value = 1;
    32     vector<Point2f> corners;
    33     goodFeaturesToTrack(gray,corners,init_value,0.01,10,Mat(),3,false,0.04);
    34     dst = src.clone();
    35     int r = 4;
    36     for (int i = 0; i < corners.size(); i++)
    37     {
    38         circle(dst,corners[i],3,Scalar(0,0,255),-1,8,0);
    39     }
    40     imshow("result",dst);
    41 }
  • 相关阅读:
    替换OSD操作的优化与分析
    Centos7下Jewel版本radosgw服务启动
    如何统计Ceph的RBD真实使用容量
    Ceph中的Copyset概念和使用方法
    Proftp最简匿名访问配置
    Windows could not set the offline local information.Error code:0X80000001解决方法
    《一百岁感言》 杨绛
    取扑克牌的问题
    马云的懒人理论
    明代地图总目
  • 原文地址:https://www.cnblogs.com/fuzhuoxin/p/11995987.html
Copyright © 2011-2022 走看看