#-*-coding:utf-8-*-#author:lyp TIME:2018/8/3ImportCv2ImportNumPy as Npimg= Cv2.imread ('lyp.jpg') grayimg=Cv2.cvtcolor (IMG, Cv2. Color_bgr2gray) Surf= Cv2.xfeatures2d.SURF_create (upright=True) KP, des=Surf.detectandcompute (grayimg, None) Img2= Cv2.drawkeypoints (IMG, KP, None, (0, 255, 0), Cv2. draw_matches_flags_draw_rich_keypoints) Cv2.imshow ('SURF Image', Img2) Cv2.waitkey () cv2.destroyallwindows ()
0. Function explanation
retval=cv2xfeatures2d. Surf_create ([, hessianthreshold[, noctaves[, noctavelayers[, extended[, upright] []])
hessianthreshold:h matrix thresholds, default value is 100, Key points larger than this threshold will be displayed, the recommended range is 300-500
Extended: Whether to extend the surf description dimension, the default value is False, the extended description of the 128 dimension is computed by the extension, otherwise the description of the 64 dimension is calculated by default (fast)
Upright: whether to calculate the direction of the surf description, the default value is False, and the run is faster without calculation
keypoints=cv2.Feature2D.detect(image[, mask]) 关键点keypoints, descriptors=cv2.Feature2D.compute(image, keypoints[, descriptors]) 特征描述向量
1.参考来自
小林的CV视觉工坊
Opencv-python:surt Demo One