KilianK KilianK - 7 months ago 75
Python Question

Where is the FAST algorithm in OpenCV?

I'm not able to find the FAST corner detector in the Python OpenCV module,
I tried this this like described in that link. My OpenCV version is 3.1.0.

I know that feature-description algorithms like SIFT and SURF were shifted to cv2.xfeatures2d, but the FAST algorithm is not located there.


According to opencv-3.1.0 documentation You can run FAST in python this way:

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('simple.jpg',0)

# 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, color=(255,0,0))

# Print all default params
print "Threshold: ", fast.getInt('threshold')
print "nonmaxSuppression: ", fast.getBool('nonmaxSuppression')
print "neighborhood: ", fast.getInt('type')
print "Total Keypoints with nonmaxSuppression: ", len(kp)


# Disable nonmaxSuppression
kp = fast.detect(img,None)

print "Total Keypoints without nonmaxSuppression: ", len(kp)

img3 = cv2.drawKeypoints(img, kp, color=(255,0,0))