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()
![图片[1]-python Shi-Tomasi角点检测源代码-给我网盘资源](https://kngzs.cc/wp-content/uploads/2024/04/1673363299337.png)
THE END