How to Implement Feature Point Detection in Matlab? 6 Common Corner Detection Algorithms

Image feature point detection can extract key information that is representative in an image, allowing for quick and accurate localization and description of important areas in the image under different perspectives and lighting conditions. This code will demonstrate the use of various algorithms to detect feature points in an image. Estimated reading time: 4 minutes.

1. Code

%% Detect various image feature points
I = imread('cameraman.tif');
figure,
%% (1) detect BRISK
points = detectBRISKFeatures(I);
subplot(231),imshow(I); hold on;title('BRISK Features');plot(points.selectStrongest(20));
%% (2) detect FAST Features
corners = detectFASTFeatures(I);
subplot(232),imshow(I); hold on;title('FAST Features');plot(corners.selectStrongest(50));
%% (3) detect Harris Features
corners = detectHarrisFeatures(I);
subplot(233),imshow(I); hold on;title('Harris Features');plot(corners.selectStrongest(50));
%% (4) detect SURF Features
points = detectSURFFeatures(I);
subplot(234),imshow(I); hold on;title('SURF Features');plot(points.selectStrongest(10));
%% (5) detect MinEigen Features
corners = detectMinEigenFeatures(I);
subplot(235);imshow(I); hold on;title('MinEigen Features');plot(corners.selectStrongest(50));
%% (6) detect MSER
regions = detectMSERFeatures(I);
subplot(236),imshow(I); hold on;plot(regions); title('MSER Features - Fitted Ellipses');
figure(2);subplot(121),imshow(I); hold on;title('MSER Features - Pixel List');plot(regions,'showPixelList',true,'showEllipses',false);
subplot(122),imshow(I); hold on;plot(regions); title('MSER Features - Fitted Ellipses');

2. Basic Principles

(1) BRISK (Binary Robust Invariant Scalable Keypoints): This algorithm detects feature points by calculating the intensity differences in local regions of the image, demonstrating robustness to rotation and scale changes. The core idea is to find regions with significant intensity variations at different scales and orientations as feature points.

(2) FAST (Features from Accelerated Segment Test): This algorithm determines whether a pixel is a corner by assessing the intensity of neighboring pixels. If a pixel has a sufficient number of contiguous neighboring pixels whose intensity differs from that of the pixel by a certain threshold, it is considered a corner.

(3) Harris: This method detects corners based on the second moment matrix of the image. It calculates the gray level changes in various directions, and if a region exhibits significant gray level changes in multiple directions, it is identified as a corner.

(4) SURF (Speeded Up Robust Features): This algorithm combines integral images and the Hessian matrix to detect feature points. It looks for positions with high response values of the Hessian determinant at different scales, demonstrating good robustness to rotation, scale, and lighting changes.

(5) MinEigen: Similar to the Harris algorithm, this method also detects corners based on local features of the image. It calculates the minimum eigenvalue of the image, and if this value exceeds a certain threshold, the corresponding pixel is considered a corner.

(6) MSER (Maximally Stable Extremal Regions): This algorithm identifies feature regions by continuously varying the gray level threshold of the image, seeking regions with minimal area changes across different thresholds. These regions typically correspond to objects or areas with significant contrast in the image.

3. Code Analysis

Image Reading: The image ‘cameraman.tif’ is read.

Feature Point Detection:

  • Feature points are detected in the image using the functions detectBRISKFeatures, detectFASTFeatures, detectHarrisFeatures, detectSURFFeatures, and detectMinEigenFeatures, selecting the strongest feature points.

  • The detectMSERFeatures function is used to detect MSER feature regions in the image.

The line of code plot(regions,’showPixelList’,true,’showEllipses’,false) draws the detected MSER features on the original image. ‘showPixelList’, true indicates that the pixel points constituting the MSER region will be displayed.

The line of code plot(regions) will, by default, draw ellipses that fit the MSER regions.

How to Implement Feature Point Detection in Matlab? 6 Common Corner Detection Algorithms

Results Display:

How to Implement Feature Point Detection in Matlab? 6 Common Corner Detection Algorithms

4. Summary of Matlab Functions

  • detectBRISKFeatures: Detects BRISK feature points.

  • detectFASTFeatures: Detects FAST feature points.

  • detectHarrisFeatures: Detects Harris feature points.

  • detectSURFFeatures: Detects SURF feature points.

  • detectMinEigenFeatures: Detects MinEigen feature points.

  • detectMSERFeatures: Detects MSER feature regions.

Different algorithms have distinct characteristics and applicable scenarios. For instance, BRISK and SURF exhibit good robustness to scale and rotation changes, while the FAST algorithm is known for its high detection speed. The appropriate feature point detection algorithm can be selected based on specific application requirements.

Parameters of each algorithm, such as MinContrast and MinQuality, can be further adjusted to achieve feature point detection results that better meet requirements. After detecting feature points, feature descriptors (such as BRIEF, SIFT, etc.) can be used to describe the feature points and perform feature matching for applications like image stitching and object recognition.

How to Implement Feature Point Detection in Matlab? 6 Common Corner Detection Algorithms

If you have any questions, please send a message.

Leave a Comment