me 2019-06-28
FAST Algorithm for Corner Detection
我们已经学习带走几个特征检测器,它们都really good , 但是从实时的角度来说,它们的速度还不够快.作为解决方案,FAST(加速段测试的特征)算法由Edward Rosten和Tom Drummond在2006年的论文“Machine learning for high-speed corner detection”中提出(后来在2010年修订).
FAST 全称 Features from accelerated segment test,一种用于角点检测的算法,该算法的原理是取图像中检测点,以该点为圆心的周围的16个像素点判断检测点是否为角点,通俗的讲就是中心的的像素值比大部分周围的像素值要亮一个阈值或者暗一个阈值则为角点.
实现步骤:
NOTE:
import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread('img8.png') # Initiate FAST object with default values fast = cv2.FastFeatureDetector_create() # find and draw the keypoints kp = fast.detect(img,None) img2 = cv2.drawKeypoints(img, kp, None, color=(255,0,0)) # Print all default params print( "Threshold: {}".format(fast.getThreshold()) ) print( "nonmaxSuppression:{}".format(fast.getNonmaxSuppression()) ) print( "neighborhood: {}".format(fast.getType()) ) print( "Total Keypoints with nonmaxSuppression: {}".format(len(kp)) ) cv2.imshow('fast_true',img2) # Disable nonmaxSuppression fast.setNonmaxSuppression(0) kp = fast.detect(img,None) print( "Total Keypoints without nonmaxSuppression: {}".format(len(kp)) ) img3 = cv2.drawKeypoints(img, kp, None, color=(255,0,0)) cv2.imshow('fast_false',img3) cv2.waitKey()