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

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

TTo enable this port, set the Output parameter to ```Corner location and metric matrix or 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 increase accurate results, use ```Minium eigenvalue (Shi & Tomasi)```. For the fastest computation, use ```Local intensity comparison (Rosten & Drummond)```. For a balance between accuracy and computation, use ```Harris corner detection (Harris & Stephens)```. For more information on each method, see the Algorithms section.

After the block determines that a pixel is a possible corner, it computes its corner metric using the following equation:

`$R=\mathrm{max}\left(\sum _{j:{I}_{j}\ge {I}_{p}+T}|{I}_{p}-{I}_{j}|-T,\sum _{j:{I}_{j}\le {I}_{p}-T}|{I}_{p}-{I}_{j}|-T\right)$`

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 `Harris corner detection (Harris & Stephens)` or `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. T

#### Dependencies

To enable this parameter, set the Output parameter to `Corner location` or ```Corner location and metric matrix```.

Specify the minimum corner metric value.

Tunable: Yes

#### Dependencies

To enable this parameter, set the Output parameter to `Corner location` or ```Corner location and metric matrix```.

Specify the neighborhood size as a two-element vector of positive odd integers, [row, column]. Specify the size as the neighborhood around the corner metric value over which the block zeros out the values.

#### Dependencies

To enable this parameter, set the Output parameter to `Corner location` or ```Corner location and metric matrix```.

Select this parameter to output a variable size signal.

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.