corner

Find corner points in image

Syntax

C = corner(I)
C = corner(I,method)
C = corner(I,N)
C = corner(I,method,N)
C = corner(___,Name,Value,...)

Description

C = corner(I) detects corners in image I and returns them in matrix C.

C = corner(I,method) detects corners in image I using the specified method.

C = corner(I,N) detects corners in image I and returns a maximum of N corners.

C = corner(I,method,N) detects corners using the specified method and maximum number of corners.

C = corner(___,Name,Value,...) specifies parameters and corresponding values that control various aspects of the corner detection algorithm.

Input Arguments

I

A grayscale or binary image.

method

The algorithm used to detect corners. Supported methods are:

  • 'Harris': The Harris corner detector.

  • 'MinimumEigenvalue': Shi & Tomasi's minimum eigenvalue method.

Default: 'Harris'

N

The maximum number of corners the corner function can return.

Default: 200

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'FilterCoefficients'

A vector, V, of filter coefficients for the separable smoothing filter. The outer product, V*V', gives the full filter kernel. The length of the vector must be odd and at least 3.

Default: fspecial('gaussian',[5 1],1.5)

'QualityLevel'

A scalar value, Q, where 0 < Q < 1, specifying the minimum accepted quality of corners. When candidate corners have corner metric values less than Q * max(corner metric), the toolbox rejects them. Use larger values of Q to remove erroneous corners.

Default: 0.01

'SensitivityFactor'

A scalar value, K, where 0 < K < 0.25, specifying the sensitivity factor used in the Harris detection algorithm. The smaller the value of K, the more likely the algorithm is to detect sharp corners. Use this parameter with the 'Harris' method only.

Default: 0.04

Output Arguments

C

An M-by-2 matrix containing the X and Y coordinates of the corner points detected in I.

Class Support

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

Examples

Find and plot corner points in a checkerboard image.

I = checkerboard(50,2,2);
C = corner(I);
imshow(I);
hold on
plot(C(:,1), C(:,2), 'r*');

More About

expand all

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.

Algorithms

The corner function performs nonmaxima suppression on candidate corners, and corners are at least two pixels apart.

See Also

Was this topic helpful?