Main Content

Corner Detection

Calculate corner metric matrix and find corners in images

  • Corner Detection block

Libraries:
Computer Vision Toolbox / Analysis & Enhancement

Description

The Corner Detection block finds corners in an image by using the Harris corner detection (by Harris and Stephens), minimum eigenvalue (by Shi and Tomasi), or local intensity comparison (based on the Accelerated Segment Test, (FAST) method by Rosten and Drummond) method. The block finds the corners in the image based on the pixels that have the largest corner metric values.

Examples

Ports

Input

expand all

Input image, specified as a matrix of intensity values.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Output

expand all

Corner locations, returned as an M-by-2 matrix of [x y] coordinates. M represents the number of corners and is less than or equal to the Maximum number of corners parameter.

Dependencies

To enable this port, set the Output parameter to one of these:

  • Corner location

  • Corner location and metric matrix

Data Types: uint32

Number of detected corners, returned as a scalar.

Dependencies

To enable this port, set these block parameters:

  • Output: Corner location | Corner location and metric matrix

  • Output variable size signal: off

Data Types: uint32

Corner metric values, returned as a matrix of intensity values. The returned matrix is the same size as the input image.

Dependencies

To enable this port, set the Output parameter to one of these:

  • Corner location and metric matrix

  • Metric matrix

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Parameters

expand all

Main

Specify the corner detection method as Harris corner detection (Harris & Stephens), Minimum eigenvalue (Shi & Tomasi), or Local intensity comparison (Rosten & Drummond).

To get the most accurate results, use Minimum eigenvalue (Shi & Tomasi). For the fastest computation, use Local intensity comparison (Rosten & Drummond). For a balance between accuracy and computation speed, use Harris corner detection (Harris & Stephens). For more information on each method, see the Algorithms section.

Specify the sensitivity factor, k. As k decreases, the likelihood that the algorithm can detect sharp corners increases.

Tunable: Yes

Dependencies

To enable this parameter, set the Method parameter to Harris corner detection (Harris & Stephens).

Specify a vector of filter coefficients for the smoothing filter.

Dependencies

To enable this parameter, set the Method parameter to one of these:

  • Harris corner detection (Harris & Stephens)

  • Minimum eigenvalue (Shi & Tomasi)

Specify the intensity threshold value used to find valid surrounding pixels.

Tunable: Yes

Dependencies

To enable this parameter, set the Method parameter to Local intensity comparison (Rosten & Drummond).

Specify the maximum corner angle.

Tunable: Yes

Dependencies

  • To enable this parameter, set the Method parameter to Local intensity comparison (Rosten & Drummond).

  • This parameter is tunable for simulation only.

Specify the block output as Corner location, Corner location and metric matrix, and Metric matrix.

Set this parameter to Corner location or Corner location and metric matrix to expose the Maximum number of corners, Minimum metric value that indicates a corner, and Neighborhood size (suppress region around detected corners) parameters.

Specify the maximum number of corners you want the block to find.

Dependencies

To enable this parameter, set the Output parameter to one of these:

  • Corner location

  • Corner location and metric matrix

Specify the minimum corner metric value.

Tunable: Yes

Dependencies

To enable this parameter, set the Output parameter to one of these:

  • Corner location

  • Corner location and metric matrix

Specify the neighborhood size as a two-element vector of positive odd integers, [row, column]. The block uses this parameter to suppress the region around a valid corner point with the largest corner metric value.

Dependencies

To enable this parameter, set the Output parameter to one of these:

  • Corner location

  • Corner location and metric matrix

Select this parameter to output a variable size signal.

Dependencies

To enable this parameter, set the Output parameter to one of these:

  • Corner location

  • Corner location and metric matrix

Data Types

For details on the fixed-point block parameters, see Specify Fixed-Point Attributes for Blocks (DSP System Toolbox).

Select this parameter to prevent the fixed-point tools from overriding the data types you specify in this block. For more information, see Lock the Output Data Type Setting (Fixed-Point Designer).

Block Characteristics

Data Types

Booleana | double | fixed point | integer | single

Multidimensional Signals

no

Variable-Size Signals

yes

a This data type is not supported for the Local Intensity Comparison method.

More About

expand all

These diagrams show the data types used in the Corner Detection block for fixed-point signals. These diagrams apply to the Harris corner detection and minimum eigenvalue methods only.

The following table summarizes the variables used in the previous diagrams.

Variable NameDefinition
IN_DTInput data type
MEM_DTMemory data type
OUT_DTMetric output data type
COEF_DTCoefficients data type

Algorithms

expand all

References

[1] Harris, C. and M Stephens. “A Combined Corner and Edge Detector.” Proceedings of the 4th Alvey Vision Conference, 147-151. August 1988.

[2] Shi, J. and C. Tomasi. “Good Features to Track.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 593-600. June 1994.

[3] Rosten, E. and T. Drummond. “Fusing Points and Lines for High Performance Tracking.” Proceedings of the IEEE International Conference on Computer Vision Vol. 2, 1508-1511. October 2005.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2007b