有些特征用轮廓并无法来检测,比如脸,在内容上显示的特征就不能用边缘检测了,要想把这些关键点检测出来就需要用star检测器,
1.Star特征检测器
import numpy as np
import cv2 as cv
image = cv.imread('/Users/youkechaung/Desktop/算法/数据分析/AI/day02/day02/data/table.jpg')
#显示内部细节的检测,不是边缘检测而是特征检测,
#颜色并不是很重要,因此把图转换为灰度图
cv.imshow('Original',image)
gray = cv.cvtColor(image,cv.COLOR_BGR2GRAY)
cv.imshow('Gray',gray)
detector = cv.xfeatures2d.StarDetector_create()#特征检测器
keypoints = detector.detect(gray)#返回关键点问题
# print(keypoints) 是一个矢量,不是很明显表示
cv.drawKeypoints(image,keypoints,image,flag