1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import numpy as np import cv2 as cv from matplotlib import pyplot as plt img = cv.imread('blox.jpg',0)
fast = cv.FastFeatureDetector_create()
kp = fast.detect(img,None) img2 = cv.drawKeypoints(img, kp, None, color=(255,0,0))
print( "Threshold: {}".format(fast.getThreshold()) ) print( "nonmaxSuppression:{}".format(fast.getNonmaxSuppression()) ) print( "neighborhood: {}".format(fast.getType()) ) print( "Total Keypoints with nonmaxSuppression: {}".format(len(kp)) ) cv.imwrite('fast_true.png', img2)
fast.setNonmaxSuppression(0) kp = fast.detect(img, None) print( "Total Keypoints without nonmaxSuppression: {}".format(len(kp)) ) img3 = cv.drawKeypoints(img, kp, None, color=(255,0,0)) cv.imwrite('fast_false.png', img3)
|