Harris、Shi-Tomasi和亚像素角点都是角点,隶属于特征点这个大类(特征点可以分为边缘、角点、斑点).

一、Harris角点检测是一种直接基于灰度图像的角点提取算法,稳定性较高,但是也可能出现有用信息丢失的情况。
函数:cornerHarris()
void cv::cornerHarris ( InputArray  src,  //需要为8位单通道
    OutputArray  dst,  //结果
    int  blockSize, //领域大小
    int  ksize, //Sobel孔径大小
    double  k, //Harris参数
    int  borderType = BORDER_DEFAULT 
  )    

Harris corner detector.

The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel (x, y) it calculates a 2\times2 gradient covariance matrix M^{(x,y)} over a \texttt{blockSize} \times \texttt{blockSize} neighborhood. Then, it computes the following characteristic:

(特征点计算方法)

 

Corners in the image can be found as the local maxima of this response map.

Parameters
src Input single-channel 8-bit or floating-point image.
dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same size as src .
blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
ksize Aperture parameter for the Sobel operator.
k Harris detector free parameter. See the formula below.
borderType Pixel extrapolation method. See cv::BorderTypes.
调用:
 
    Mat srcGray ,,.);
    .,,THRESH_BINARY);
    imshow();
lena的结果:
二、Shi-Tomasi角点
一般认为是Harris的改进,因为当时提出的论文叫做《Good Features to Track》,所以这种角点再OpenCV中叫做goodFeatures
函数:goodFeaturesToTrack()
void cv::goodFeaturesToTrack ( InputArray  image,//输入图像
    OutputArray  corners,//输出向量
    int  maxCorners,//角点最大数量
    double  qualityLevel,//角点检测可接受的最小特征值
    double  minDistance,//角点之间的最小距离
    InputArray  mask = noArray(),//感兴趣区域
    int  blockSize = 3,//领域范围
    bool  useHarrisDetector = false,//true为harris;false为Shi-Tomasi
    double  k = 0.04 //权重系数
  )    

Determines strong corners on an image.

The function finds the most prominent corners in the image or in the specified image region, as described in [154]

  • Function calculates the corner quality measure at every source image pixel using the cornerMinEigenVal or cornerHarris .
  • Function performs a non-maximum suppression (the local maximums in 3 x 3 neighborhood are retained).
  • The corners with the minimal eigenvalue less than qualityLevel⋅maxx,yqualityMeasureMap(x,y) are rejected.
  • The remaining corners are sorted by the quality measure in the descending order.
  • Function throws away each corner for which there is a stronger corner at a distance less than maxDistance.

The function can be used to initialize a point-based tracker of an object.

Note
If the function is called with different values A and B of the parameter qualityLevel , and A > B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B .
Parameters
image Input 8-bit or floating-point 32-bit, single-channel image.
corners Output vector of detected corners.
maxCorners Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned.
qualityLevel Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.
minDistance Minimum possible Euclidean distance between the returned corners.
mask Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
blockSize Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See cornerEigenValsAndVecs .
useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris) or cornerMinEigenVal.
k Free parameter of the Harris detector.
调用:
Mat srcGray = imread("e:/template/lena.jpg",IMREAD_GRAYSCALE);    
,.,,Mat(),,.);
    ;i,Scalar());
    }
     
    imshow();
结果:
可以看到,眼部、帽子上面的尖端这些的却是"GoodFeatures"的地方都被标注了出来
三、如果需要亚像素的角点,我们必须更进一步。
函数:cornerSubPix()
void cv::cornerSubPix ( InputArray  image,
    InputOutputArray  corners,
    Size  winSize,
    Size  zeroZone,
    TermCriteria  criteria 
  )    
调用:需要注意现计算goodfeatures再算亚像素
Mat srcGray .,                              ,                                 ,                                 .                               , ),      ,),                   ,                              .                             ;i,Scalar());
        cout);
结果:
可以看到其计算处理小数点后面的值。
四、小结
角点虽然现在用的比较少了,但是作为基本的知识有必要了解;下一步的更为复杂的特征点模型都是基于角点的,它们之间有着一脉相承的关系。

寻找Harris、Shi-Tomasi和亚像素角点的更多相关文章

  1. OpenCV亚像素角点cornerSubPixel()源代码分析

    上一篇博客中讲到了goodFeatureToTrack()这个API函数能够获取图像中的强角点.但是获取的角点坐标是整数,但是通常情况下,角点的真实位置并不一定在整数像素位置,因此为了获取更为精确的角 ...

  2. OpenCV——Harris、Shi Tomas、自定义、亚像素角点检测

    #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...

  3. OpenCV亚像素级的角点检测

    亚像素级的角点检测 目标 在本教程中我们将涉及以下内容: 使用OpenCV函数 cornerSubPix 寻找更精确的角点位置 (不是整数类型的位置,而是更精确的浮点类型位置). 理论 代码 这个教程 ...

  4. opencv亚像素级角点检测

    一般角点检测: harris cv::cornerHarris() shi-tomasi cv::goodFeaturesToTrack() 亚像素级角点检测是在一般角点检测基础之上将检测出的角点精确 ...

  5. Paper | 亚像素运动补偿 + 视频超分辨

    目录 1. ABSTRACT 2. INTRODUCTION 3. RELATED WORKS 4. SUB-PIXEL MOTION COMPENSATION (SPMC) 5. OUR METHO ...

  6. 亚像素Sub Pixel

    亚像素Sub Pixel 评估图像处理算法时,通常会考虑是否具有亚像素精度. 亚像素概念的引出: 图像处理过程中,提高检测方法的精度一般有两种方式:一种是提高图像系统的光学放大倍数和CCD相机的分辨率 ...

  7. 【工程应用七】接着折腾模板匹配算法 (Optimization选项 + no_pregeneration模拟 + 3D亚像素插值)

    在折腾中成长,在折腾中永生. 接着玩模板匹配,最近主要研究了3个课题. 1.创建模型的Optimization选项模拟(2022.5.16日) 这两天又遇到一个做模板匹配隐藏的高手,切磋起来后面就还是 ...

  8. Opencv 亚像素级别角点检测

    Size winSize = Size(5,5); Size zerozone = Size(-1,-1); TermCriteria tc = TermCriteria(TermCriteria:: ...

  9. OpenCV 亚像素级的角点检测

    #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #i ...

随机推荐

  1. Android文件上传与下载

    文件上传与下载 文件上传 -- 服务端 以Tomcat为服务器,Android客服端访问Servlet,经Servlet处理逻辑,最终将文件上传,这里就是简单模拟该功能,就将文件上传到本机的D:\\u ...

  2. [补档][NOI 2008]假面舞会

    [NOI 2008]假面舞会 题目 一年一度的假面舞会又开始了,栋栋也兴致勃勃的参加了今年的舞会.今年的面具都是主办方特别定制的.每个参加舞会的人都可以在入场时选择一个自己喜欢的面具. 每个面具都有一 ...

  3. 39. leetcode 326. Power of Three

    326. Power of Three Given an integer, write a function to determine if it is a power of three. Follo ...

  4. 七、vue中v-for有时候对页面不会重新渲染,数组变化后如何到渲染页面

      v-for不能进行双向数据绑定,页面渲染完成后,再次更改v-for遍历的数据,js里面打印的数据看到数据值已经更改,但是页面的数据就是没有渲染,这是为什么呢? vue中v-for和angularj ...

  5. Python爬虫从入门到放弃(二十二)之 爬虫与反爬虫大战

    爬虫与发爬虫的厮杀,一方为了拿到数据,一方为了防止爬虫拿到数据,谁是最后的赢家? 重新理解爬虫中的一些概念 爬虫:自动获取网站数据的程序反爬虫:使用技术手段防止爬虫程序爬取数据误伤:反爬虫技术将普通用 ...

  6. gitlab+jenkins持续集成(一)

    1. 环境:CentOS7.0,jdk-8u91-linux-x64.rpm,jenkins 2.7.4 ,gitlab 9.2.2 2.    安装jdk,jenkins     (rpm -ivh ...

  7. React Native 系列(六) -- PropTypes

    前言 本系列是基于React Native版本号0.44.3写的.在我们之前的通过props实现组件间传值的时候,大家有没有发现在父组件传递值过去,在子控件获取props的时候没有提示,那么如何能实现 ...

  8. Vue表单控件绑定

    前面的话 本文将详细介绍Vue表单控件绑定 基础用法 可以用 v-model 指令在表单控件元素上创建双向数据绑定.它会根据控件类型自动选取正确的方法来更新元素.v-model本质上不过是语法糖,它负 ...

  9. 关于IE,Chrome,Firefox浏览器的字符串拼接问题

    昨天项目测试的时候,IE8.IE11测试勾选checkbox然后执行保存的时候,竟然执行的结果与预期相反,吓屎我了,最终排查之下,原来是拼接checkbox的值的时候出现的问题.本人对js了解知之甚少 ...

  10. ASP.NET Core 快速入门【第二弹-实战篇】

    上篇讲了asp.net core在linux上的环境部署.今天我们将做几个小玩意实战一下.用到的技术和工具有mysql.websocket.AngleSharp(爬虫html解析).nginx多站点部 ...