(13)Corner Detection角点检测

import cv2                                               
import numpy as np

img=cv2.imread('opencv-corner-detection-sample.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)

#最多使用100个角点,点之间的最小距离是10
corners = cv2.goodFeaturesToTrack(gray,100,0.01,10)
corners = np.int0(corners)

for corner in corners:
        x,y=corner.ravel()
        cv2.circle(img,(x,y),3,255,-1)
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

 

posted on 2017-12-30 20:41  SunnyCx  阅读(259)  评论(0编辑  收藏  举报

导航