我试图使用opencv(python)中的harris角点检测来检测图像中的所有角点.但是由于线条的粗细,我在一个角落里得到了多个角落.我能做些什么来纠正这一点吗.
密码
import numpy as np import cv2 as cv filename = 'Triangle.jpg' 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 marking the corners, not important dst = cv.dilate(dst,None) # Threshold for an optimal value, it may vary depending on the image. img[dst>0.01*dst.max()]=[0,0,255] cv.imshow('dst',img) if cv.waitKey(0) & 0xff == 27: cv.destroyAllWindows() 密码>