opencv (python) in Harris corner detection function
Prototype:
= cv.cornerHarris DST (the src, blockSize, ksize, K [, DST [, borderType]])
the src: picture
blockSize: moving window size detection process
ksize: Soble filter size
k: constant, typically in the range [0.04 , 0.16]
do not understand the parameters, refer to: Harris corner detection algorithm implemented explain and python
Small example:
import numpy as np
import cv2 as cv
image1 = cv.imread('../qiqiao.jpg')
gray = cv.cvtColor(image1,cv.COLOR_RGB2GRAY)
gray = np.float32(gray)
dst = cv.cornerHarris(gray, blockSize=10, ksize=3, k=0.04)
# 使角点更大
dst = cv.dilate(dst,None)
# 标记角点为红色
image1[dst>0.01*dst.max()]=[0,0,255]
cv.imshow('result',image1)
cv.imwrite('out.jpg',image1)
cv.waitKey(0)
cv.destroyAllWindows()
The results:
Original:
Harris corner detection algorithm results:
Like the point of a walk ah, dudes!