Python+OpenCV|Shi-Tomasiのコーナ検出

プログラム

import cv2
import numpy as np
 
img = cv2.imread('haruna_kankore.png')
gray = cv2.imread('haruna_kankore.png', 0)
 
gray = np.float32(gray)
 
dst = cv2.goodFeaturesToTrack(gray,2,3,0.06)
 
corners = cv2.goodFeaturesToTrack(gray,25,0.01,10)
corners = np.int0(corners)

for i in corners:
    x,y = i.ravel()
    cv2.circle(img,(x,y),3,255,-1)

cv2.imwrite('Shi-Tomasi1.png', img)

参考

http://labs.eecs.tottori-u.ac.jp/sd/Member/oyamada/OpenCV/html/py_tutorials/py_feature2d/py_shi_tomasi/py_shi_tomasi.html

おすすめ