Opencv Corner Detection

OpenCV
Fast algorithm
Corner detection
Image processing
FAST object
fast_true.png
fast_false.png
This code utilizes OpenCV’s Fast algorithm to detect corners in an image, initializing the FAST object with default values and saving the results as ‘fast_true.png’ and ‘fast_false.png’. The Fast algorithm is a feature detection method that helps locate feature points or interest points in an image which can be useful for various computer vision tasks.
Published

September 17, 2022


fast algorithm for corner detection

import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('blox.jpg',0) # `<opencv_root>/samples/data/blox.jpg`
# Initiate FAST object with default values
fast = cv.FastFeatureDetector_create()
# find and draw the keypoints
kp = fast.detect(img,None)
img2 = cv.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)) )
cv.imwrite('fast_true.png', img2)
# Disable nonmaxSuppression
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)