Python-OpenCV:sift(),SURF() 特徵提取
阿新 • • 發佈:2019-01-31
1、SIFT、SURF
SURF特徵是SIFT特徵的一個更快的特徵提取版,詳細請參閱文獻[1]。以下將展示python open cv 的 SURF 的特徵提取命令,及繪製命令。
python opecv-3.0 參考這裡
2、特徵提取
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 05 09:31:47 2016
@author: Eddy_Zheng
"""
import cv2
# 讀取影象
im = cv2.imread('1.jpg')
cv2.imshow('original',im)
#cv2.waitKey()
# 下采樣
#im_lowers = cv2.pyrDown(im)
#cv2.imshow('im_lowers',im_lowers)
# 檢測特徵點
#s = cv2.SIFT() # 呼叫SIFT
s = cv2.SURF() # 呼叫SURF
keypoints = s.detect(im)
# 顯示特徵點
for k in keypoints:
cv2.circle(im,(int(k.pt[0]),int(k.pt[1])),1,(0,255,0),-1)
#cv2.circle(im,(int(k.pt[0]),int(k.pt[1])),int(k.size),(0,255 ,0),2)
cv2.imshow('SURF_features',im)
cv2.waitKey()
cv2.destroyAllWindows()
原圖:
SURF 特徵提取:
[1]Bay H, Tuytelaars T, Gool L V. SURF: Speeded Up Robust Features[J]. Computer Vision & Image Understanding, 2006, 110(3):404-417.