当前位置:网站首页>Opencv image basic operation (III) -- image feature extraction (corner detection)

Opencv image basic operation (III) -- image feature extraction (corner detection)

2022-06-11 09:36:00 Guoqingru

openCV Basic operation of image ( 3、 ... and )—— Image feature extraction ( Corner detection harris)

 Please add a picture description
The code is as follows :

import cv2 
import numpy as np

img = cv2.imread('test_1.jpg')
print ('img.shape:',img.shape)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# gray = np.float32(gray)
dst = cv2.cornerHarris(gray, 2, 3, 0.04)    #  Perform focus detection 
print ('dst.shape:',dst.shape)
print ('dst',dst)
img[dst>0.01*dst.max()]=[0,0,255]
cv2.imshow('dst',img) 
cv2.imwrite("dst.png",img)
cv2.waitKey(0) 
cv2.destroyAllWindows()

原网站

版权声明
本文为[Guoqingru]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203012248522976.html