Zi 字媒體
2017-07-25T20:27:27+00:00
fanfuhan OpenCV 教學098 ~ OpenCV的-098-SIFT特徵提取之關鍵點提取
資料來源: https://fanfuhan.github.io/
https://fanfuhan.github.io/2019/05/16/opencv-098/
GITHUB:https://github.com/jash-git/fanfuhan_ML_OpenCV
SIFT特徵提取是圖像特徵提取中最經典的一個算法,歸納起來SIFT特徵提取主要有如下幾步:
△構建高斯多尺度金字塔
△關鍵點查找/過濾與精準定位
△窗口區域角度方向直方圖
△描述子生成
Python
"""
SIFT特征提取之关键点提取
"""
import cv2 as cv
src = cv.imread("images/test4.jpg")
cv.imshow("input", src)
# 需要编译才能使用
sift = cv.xfeatures2d.SIFT_create()
kps = sift.detect(src)
# opencv4 python版中好像没有 cv.drawKeypoints()
# result = cv.drawKeypoints(src, kps, None, (0, 255, 0), cv.DrawMatchesFlags_DEFAULT)
result = src.copy()
for marker in kps:
result = cv.drawMarker(src, tuple(int(i) for i in marker.pt), color=(0, 255, 0))
cv.imshow("result", result)
cv.waitKey(0)
cv.destroyAllWindows()
寫了
5860316篇文章,獲得
23313次喜歡