https://blog.csdn.net/zhu_hongji/article/details/81235643
图像特征描述
角点检测原理
ret,labels,stats,centroids=cv2.connectedComponentsWithStats(dst)
import cv2
import numpy as np
import matplotlib.pyplot as plt
img =cv2.imread('E:/python/ha.png')
imgray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#harris角点检测图像需为float32
gray=np.float32(imgray)
dst=cv2.cornerHarris(gray,8,3,0.04)
dst=cv2.dilate(dst,None)
ret,dst=cv2.threshold(dst,0.01*dst.max(),255,0)
dst=np.uint8(dst)
#图像连通域
ret,labels,stats,centroids=cv2.connectedComponentsWithStats(dst)
#迭代停止规则
criteria=(cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER,100,0.001)
corners=cv2.cornerSubPix(gray,np.float32(centroids),(5,5),(-1,-1),criteria)
res=np.hstack((centroids,corners))
re