#dotnet – detecting corners on the 🎦 camera feed with FAST algorithm, #OpenCV and #net5

Buy Me A Coffee

Hi !

Today is a quick one: FAST corner detection algorithm.

FAST (Features from Accelerated Segment Test) algorithm was proposed by Edward Rosten and Tom Drummond in their paper “Machine learning for high-speed corner detection” in 2006 (Later revised it in 2010). A basic summary of the algorithm is presented below. Refer original paper for more details (All the images are taken from original paper).

OpenCV includes the FAST algorithm as part of the base set of operations to perform on an image. You only need 2 lines of code to get this output.

opencv demo using fast algorithm

The OpenCV FAST tutorial (see references) explain the different steps and, I’ll keep this simple, just sharing the code !

public Mat applyEffect(Mat image)
{
var newImage = new Mat();
Cv2.CvtColor(image, newImage, ColorConversionCodes.BGR2GRAY, 0);
KeyPoint[] keypoints = Cv2.FAST(newImage, 50, true);
foreach (KeyPoint kp in keypoints)
newImage.Circle((Point)kp.Pt, 3, Scalar.Red, 1, LineTypes.AntiAlias, 0);
return newImage;
}

That’s all for today!

Happy coding!

Greetings

El Bruno

References

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.