特徴点の検出

2019/09/05

Python2.7.8, OpenCV4.1.1

# -*- coding: utf-8 -*-
import cv2

# 画像読込
img = cv2.imread('sample.png',0)

#拡大(抽出精度向上)
rate = 2.0
img = cv2.resize(img,None,interpolation=cv2.INTER_LINEAR,fx=rate,fy=rate)

# 検出器の生成(A-KAZE)
detector = cv2.AKAZE_create()

# 特徴点の検出
keypoints = detector.detect(img, None)

# 結果画像の表示
output = cv2.drawKeypoints(img, keypoints, None)
cv2.namedWindow("Result", cv2.WINDOW_KEEPRATIO | cv2.WINDOW_NORMAL)
cv2.imshow("Result", output)
cv2.waitKey(0)