Skip to Main Content Skip to Search
Product Documentation

cornermetric - Create corner metric matrix from image

Description

CM = cornermetric(I) generates a corner metric matrix for the grayscale or logical image I. The corner metric, CM, is used to detect corner features in I and is the same size as I. Larger values in CM correspond to pixels in I with a higher likelihood of being a corner feature.

CM = cornermetric(I, method) generates a corner metric matrix for the grayscale or logical image I using the specified method. Valid values for method are:

ValueDescription
'Harris'The Harris corner detector. This is the default method.
'MinimumEigenvalue'Shi and Tomasi's minimum eigenvalue method.

CM = cornermetric(..., param1, val1, param2, val2, ...) generates a corner metric matrix for I, specifying parameters and corresponding values that control various aspects of the corner metric calculation algorithm. Parameters include:

ParameterDescription
'FilterCoefficients' A vector, V, of filter coefficients for the separable smoothing filter. This parameter is valid with the 'Harris' and 'MinimumEigenvalue' methods. The outer product, V*V', gives the full filter kernel. The default is fspecial('gaussian',[5 1],1.5).
'SensitivityFactor' A scalar k, 0 < k < 0.25, specifying the sensitivity factor used in the Harris detection algorithm. For smaller values of k, the algorithm is more likely to detect sharper corners. This parameter is only valid with the 'Harris' method.
Default value: 0.04

Tips

The corner and cornermetric functions both detect corners in images. For most applications, use the streamlined corner function to find corners in one step. If you want greater control over corner selection, use the cornermetric function to compute a corner metric matrix and then write your own algorithm to find peak values.

Class Support

I is a nonsparse numeric array. CM is a matrix of class double.

Examples

Find corner features in grayscale image.

First generate a corner metric matrix.

 I = imread('pout.tif');
 I = I(1:150,1:120);
 subplot(1,3,1);
 imshow(I);
 title('Original Image');
 CM = cornermetric(I);

Adjust corner metric for viewing.

CM_adjusted = imadjust(CM);
subplot(1,3,2);
imshow(CM_adjusted);
title('Corner Metric');

Find and display some corner features.

corner_peaks = imregionalmax(CM);
corner_idx = find(corner_peaks == true);
[r g b] = deal(I);
r(corner_idx) = 255;
g(corner_idx) = 255;
b(corner_idx) = 0;
RGB = cat(3,r,g,b);
subplot(1,3,3);
imshow(RGB);
title('Corner Points');

The following figure shows the output of these operations.

See Also

corner | edge | immovie | imshow

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS