Example Analysis of OpenCV Image feature and harris Corner Detection in Python
This article mainly introduces the Python OpenCV image features and harris corner detection example analysis, the article is very detailed, has a certain reference value, interested friends must read it!
Concept
Step 1: calculate a gradient Ix,Iy
Step 2: integrate the matrix and calculate the eigenvalues
Step 3: compare the size of eigenvalues
Step 4: non-maximum suppression, leaving the real corner, and filtering out the code around the corner
Import cv2import numpy as npimg = cv2.imread ('pie.png') print (' img.shape',img.shape) gray = cv2.cvtColor (img,cv2.COLOR_BGR2GRAY) # gray = np.float32 (gray) dst = cv2.cornerHarris (gray,2,3,0.04) print ('dst.shape',dst.shape)
Img [dst > 0.01*dst.max ()] = [0mem0255] cv2.imshow ('dst',img) cv2.waitKey (0) cv2.destroyAllWindows ()
The above is all the contents of the article "sample Analysis of OpenCV Image Features and harris Corner Detection in Python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!