OpenCV特征检测

本文介绍了OpenCV中的Harris角点检测方法,包括其工作原理,如考虑的邻域大小(blockSize)、Sobel导数的卷积核大小(ksize)以及自由参数(k)。同时,提到了为了提高检测精度,OpenCV提供了cv.cornerSubPix()函数来实现亚像素级别的角点定位。通过实例展示了Harris算法与亚像素校正后的角点对比,显示了亚像素精度的优势。
摘要由CSDN通过智能技术生成

Harris Corner Detection

 

dst=cv.cornerHarris(src, blockSize, ksize, k)

  • img - Input image, it should be grayscale and float32 type.应该输入灰度图像
  • blockSize - It is the size of neighbourhood considered for corner detection  考虑要检测的附近的块大小,for each pixel (x,y) it calculates a 2×2 gradient covariance matrix M(x,y) over a blockSize×blockSize neighborhood.,对于每一个像素,都会计算附近blocksize大小的像素点的梯度covariance矩阵。
  • ksize - Aperture parameter of Sobel derivative used. Sobel算子的卷积核大小
  • k - Harris detector free parameter in the equation. 自由参数?

例子:

import numpy as np
import cv2 as cv
filename = 'chessboard.png'
img = cv.imread(filename)
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv.cornerHarris(gray,2,3,0.04)
#result is dilated for
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值