SURF

In [7]:
import cv2
import numpy as np

#Ipythonで表示用の設定
import matplotlib.pyplot as plt
%matplotlib inline

in_img = cv2.imread('lena.jpg')

# Hessian Threshold:700
surf   = cv2.SURF(700)
kp     = surf.detect(in_img,None)

# 特徴点の描画
out_img = cv2.drawKeypoints(in_img,kp,flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

#OpenCVがBGRなのでRGBに変換
disp_in_img  = cv2.cvtColor(in_img,  cv2.COLOR_BGR2RGB)
disp_out_img = cv2.cvtColor(out_img, cv2.COLOR_BGR2RGB)

#画像表示
plt.figure(figsize=(16,8))
plt.subplot(121)
plt.imshow(disp_in_img)
plt.subplot(122)
plt.imshow(disp_out_img)
Out[7]:
<matplotlib.image.AxesImage at 0xb97dff0>
inserted by FC2 system