寻找Harris、Shi-Tomasi和亚像素角点
Harris、Shi-Tomasi和亚像素角点都是角点,隶属于特征点这个大类(特征点可以分为边缘、角点、斑点).
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 matHarris;
cornerHarris(srcGray,matHarris,2,3,0.01);
//显示
Mat matDst;
threshold(matHarris,matDst,0.00001,255,THRESH_BINARY);
imshow("matDst",matDst);
waitKey(0);
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 matHarris;
vector<Point2f> corners;//输出向量
goodFeaturesToTrack(srcGray,corners,100,0.01,10,Mat(),3,false,0.04);
//显示
Mat matDst = srcGray.clone();
for (int i=0;i<corners.size();i++)
{
circle(matDst,corners[i],2,Scalar(255));
}
imshow("matDst",matDst);
waitKey(0);
void cv::cornerSubPix | ( | InputArray | image, |
InputOutputArray | corners, | ||
Size | winSize, | ||
Size | zeroZone, | ||
TermCriteria | criteria | ||
) |
//进行角点检测
Mat matHarris;
vector<Point2f> corners;//输出向量
cv::goodFeaturesToTrack(
srcGray, // Image to track
corners, // Vector of detected corners (output)
MAX_CORNERS, // Keep up to this many corners
0.01, // Quality level (percent of maximum)
5, // Min distance between corners
cv::noArray(), // Mask
3, // Block size
false, // true: Harris, false: Shi-Tomasi
0.04 // method specific parameter
);
cv::cornerSubPix(
srcGray, // Input image
corners, // Vector of corners (input and output)
cv::Size(5, 5), // Half side length of search window
cv::Size(-1,-1), // Half side length of dead zone (-1=none)
cv::TermCriteria(
cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS,
20, // Maximum number of iterations
0.03 // Minimum change per iteration
)
);
//显示
Mat matDst = srcGray.clone();
for (int i=0;i<corners.size();i++)
{
circle(matDst,corners[i],2,Scalar(255));
cout<<"\t"<<"序号"<<i<<"亚像素坐标("<<corners[i].x<<","<<corners[i].y<<")"<<endl;
}
imshow("matDst",matDst);
waitKey(0);
转载于:https://www.cnblogs.com/jsxyhelu/p/7522441.html
寻找Harris、Shi-Tomasi和亚像素角点相关推荐
- OpenCV——Harris、Shi Tomas、自定义、亚像素角点检测
在图像处理和与计算机视觉领域,兴趣点(interest points),或称作关键点(keypoints).特征点(feature points) 被大量用于解决物体识别,图像识别.图像匹配.视觉跟踪 ...
- OpenCV——角点检测原理分析(Harris,Shi-Tomasi、亚像素级角点检测)
一.角点(corner) 角点通常被定义为两条边的交点,或者说,角点的局部邻域应该具有两个不同区域的不同方向的边界.角点检测(Corner Detection)是计算机视觉系统中获取图像特征的一种方法 ...
- opencv3/C++ Harris角点、Shi-Tomasi角点亚像素角点
角点检测在图像匹配.目标识别.目标跟踪.运动估计与三维重建等CV领域起着非常重要的作用. 角点定义 关于角点的定义有以下几种: 1.角点是两条及两条以上的边缘的交点: 2.角点处的一阶导数最大,二阶导 ...
- 图像处理之角点检测与亚像素角点定位
图像处理之角点检测与亚像素角点定位 角点是图像中亮度变化最强地方反映了图像的本质特征,提取图像中的角点可以有效提高图像处理速度与精准度.所以对于整张图像来说特别重要,角点检测与提取的越准确图像处理与分 ...
- 《opencv学习笔记》-- 亚像素角点检测
亚像素级角点检测的位置在摄像机标定.跟踪并重建摄像机的轨迹,或者重建被跟踪目标的三维结构时,是一个基本的测测量值. 将所求得的角点位置精确到亚像素级精度 .一个向量和与其正交的向量的点积为0,角点则满 ...
- OpenCV亚像素角点检测
前言 我在做围棋盘的的四个角点检测时,试了几种角点检测,用来得到棋盘四个角的初始点,试了几种角点检测的方法,但在我所使用的环境下,亚像素的角点检测得到的结果比较理想. 代码 //亚像素角点检测 voi ...
- cv::cornerSubPix()亚像素角点检测
转自https://blog.csdn.net/guduruyu/article/details/69537083 cv::goodFeaturesToTrack()提取到的角点只能达到像素级别,在很 ...
- opencv亚像素边缘精度_OpenCV亚像素角点cornerSubPixel()源代码分析
上一篇博客中讲到了goodFeatureToTrack()这个API函数能够获取图像中的强角点.但是获取的角点坐标是整数,但是通常情况下,角点的真实位置并不一定在整数像素位置,因此为了获取更为精确的角 ...
- OpenCV中角点检测:Harris、Shi-Tomasi、亚像素级角点检测
1.角点的定义 角点通常被定义为两条边的交点,或者说,角点的局部邻域应该具有两个不同区域的不同方向的边界.比如,三角形有三个角,矩形有四个角,这些就是角点,也是他们叫做矩形.三角形的特征. 角点是个很 ...
- OpenCV开发笔记(六十二):红胖子8分钟带你深入了解亚像素角点检测(图文并茂+浅显易懂+程序源码)
若该文为原创文章,未经允许不得转载 原博主博客地址:https://blog.csdn.net/qq21497936 原博主博客导航:https://blog.csdn.net/qq21497936/ ...
最新文章
- 【转】jQuery最佳实践
- CodeForces - 1270D Strange Device(思维+构造)
- Debian 9 中设置网络
- Katas编写的Java教程:Mars Rover
- selenium python 文本框输入信息_selenium python向富文本框中输入内容
- 安装PetShop后调试的诸多问题
- python抓取网站内容_python抓取网站内容详细
- ubuntu linux软件,Linux新系统必装软件(Ubuntu及类似系统)
- 软件工程之软件质量管理(SQA)
- Leetcode 每日一题——845. 数组中的最长山脉
- 深度学习与python运用论文心得
- 李白:下终南山过斛斯山人宿置酒
- Qt之Cannot retrieve debugging output.
- meta http-equiv 属性 详解
- python新手快速入门教程-10 分钟快速入门 Python3的教程
- [图]部分Surface Book 2升级Windows 10 May 2019出现显卡兼容问题
- Redis缓存过期和淘汰策略
- KOL垂直化,品牌营销策略如何变更?
- emacs之使用gnus读取和发送新浪邮件
- hoolilaw案例分析:美国神奇网站Craigslist交易骗术
热门文章
- java标识符写法_标识符你书写规范了吗?
- fidder不拦截_利用Fiddler拦截接口请求并篡改数据
- ZZULIoj 1913: 小火山的计算能力
- PostFix postqueue 指令
- 我被房东的由器了 怎么办呀 高手们请帮帮
- Windows 7 - 使用批处理脚本模拟Windows XP中的msbackup备份程序
- 玩玩AJAX之使用ashx文件响应来自JQuery的JSON请求.
- Linux bash介绍
- C++--第14课 - 专题二经典问题解析
- Community Enterprise Operating System ISO 全镜像下载