Opencv学习笔记(二十三)Shi-Tomas角点检测

文章目录

    • Shi-Tomas角点检测
    • 代码

Shi-Tomas角点检测

cv2. goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance)
image 为灰度图
maxCorners为最好的角点个数, qualitylevel为角点的质量水平,在0~1之间,低于该值的角点被舍弃。
minDistance为两个角点之间的最短欧式距离

代码

import cv2
import numpy as np

src = cv2.imread(r'F:\OPENCV\Opencv\animal.png')
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
# Shi-Tomas角点检测
corners = cv2.goodFeaturesToTrack(gray, 25, 0.02, 20)
corners = np.int0(corners)
print(corners)
for i in corners:
    x, y = i.ravel()  # 数组维度拉成以一维数组
    cv2.circle(src, (x, y), 3, (0, 0, 255), -1)
cv2.imshow('src', src)
cv2.waitKey()
cv2.destroyAllWindows()

结果显示

你可能感兴趣的:(OpenCV-数字图像处理,opencv,计算机视觉,cv)