Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Change to

#Print all default params
print("Threshold: ", fast.getThreshold());
print("nonmaxSuppression: ", fast.getNonmaxSuppression());
print("neighborhood: ", fast.getType());
print("Total Keypoints with nonmaxSuppression: ", len(kp));

Change toThis works on CV '3.4.5', Python 3.6.1

# Load image
img = cv.imread(myImagePath);
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY);

# Initiate FAST object with default values
fast = cv.FastFeatureDetector_create();

# find and draw the keypoints
kp = fast.detect(gray, None);

#Print all default params
print("Threshold: ", fast.getThreshold());
print("nonmaxSuppression: ", fast.getNonmaxSuppression());
print("neighborhood: ", fast.getType());
print("Total Keypoints with nonmaxSuppression: ", len(kp));


# Disable nonmaxSuppression
fast.setNonmaxSuppression(False);
kp = fast.detect(gray,None);
print("Total Keypoints without nonmaxSuppression: ", len(kp));

# Output the points on the mats
img2 = cv2.drawKeypoints(img, kp, None, color=BLUE)
img3 = cv2.drawKeypoints(img, kp, None, color=BLUE);

# Show the mats
cv.imshow("img1", img); # Original mat
cv.imshow("img2", img2); # With nonmaxSuppression
cv.imshow("img3", img3); # Without nonmaxSuppression
cv.waitKey();