import cv2 as cv
import matplotlib.pyplot as plt
# 1读取图像
img = cv.imread('./image/tv.jpg')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
# 2角点检测
corners = cv.goodFeaturesToTrack(gray, 1000, 0.01, 10)
# 3绘制角点
for i in corners:
x, y = i.ravel()
cv.circle(img, (x, y), 2, (0, 0, 255), -1)
# 4图像展示
plt.rc("font", family='Microsoft YaHei')
plt.figure(figsize=(10, 8), dpi=100)
plt.imshow(img[:, :, ::-1]), plt.title('shi-tomasi角点检测')
plt.xticks(), plt.yticks()
plt.show()
THE END
暂无评论内容