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