# Corner Detection

Calculate corner metric matrix and find corners in images

• Library:
• 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.

## 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 Tab

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 Tab

For details on the fixed-point block parameters, see Specify Fixed-Point Attributes for Blocks.

## Block Characteristics

 Data Types Boolean[a] | 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.

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 GenerationGenerate C and C++ code using Simulink® Coder™.

Introduced in R2007b