Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

detectHarrisFeatures

Detect corners using Harris–Stephens algorithm and return cornerPoints object

Syntax

  • points = detectHarrisFeatures(I)
    example
  • points = detectHarrisFeatures(I,Name,Value)
  • PointsGPU = detectHarrisFeatures(gpuI,___)

Description

example

points = detectHarrisFeatures(I) returns a cornerPoints object, points. The object contains information about the feature points detected in a 2-D input image, I. The detectHarrisFeatures function uses the Harris–Stephens algorithm to find these feature points.

points = detectHarrisFeatures(I,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Code Generation Support:
Compile-time constant input: 'FilterSize'
Supports MATLAB Function block: No
Generated code for this function uses a precompiled platform-specific shared library.
Code Generation Support, Usage Notes, and Limitations

PointsGPU = detectHarrisFeatures(gpuI,___) perform operation on a graphics processing unit (GPU), where gpuI is a gpuArray object that contains a 2-D input image, and the output is a cornerPoints object. This syntax requires the Parallel Computing Toolbox™.

Examples

collapse all

Read the image.

I = checkerboard;

Find the corners.

corners = detectHarrisFeatures(I);

Display the results.

imshow(I); hold on;
plot(corners.selectStrongest(50));

Related Examples

Input Arguments

collapse all

Input image, specified is an M-by-N 2-D image. The input image must be real and nonsparse.

Example:

Data Types: single | double | int16 | uint8 | uint16 | logical

Input image stored on the GPU, specified as an M-by-N 2-D image. The input image must be real and nonsparse.

Data Types: single | double | int16 | uint8 | uint16 | logical

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.

Example: 'MinQuality','0.01','ROI', [50,150,100,200] specifies that the detector must use a 1% minimum accepted quality of corners within the designated region of interest. This region of interest is located at x=50, y=150. The ROI has a width of 100 pixels and a height of 200 pixels.

collapse all

Minimum accepted quality of corners, specified as the comma-separated pair consisting of 'MinQuality' and a scalar value in the range [0,1].

The minimum accepted quality of corners represents a fraction of the maximum corner metric value in the image. Larger values can be used to remove erroneous corners.

Example: 'MinQuality', 0.01

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

Gaussian filter dimension, specified as the comma-separated pair consisting of 'FilterSize' and an odd integer value in the range [3, min(size(I))].

The Gaussian filter smooths the gradient of the input image.

The function uses the FilterSize value to calculate the filter's dimensions, FilterSize-by-FilterSize. It also defines the standard deviation of the Gaussian filter as FilterSize/3.

Example: 'FilterSize', 5

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

Rectangular region for corner detection, specified as a comma-separated pair consisting of 'ROI' and a vector of the format [x y width height]. The first two integer values [x y] represent the location of the upper-left corner of the region of interest. The last two integer values represent the width and height.

Example: 'ROI', [50,150,100,200]

Output Arguments

collapse all

Corner points object, returned as a cornerPoints object. The object contains information about the feature points detected in the 2-D input image.

Corner points object, returned as a cornerPoints object. The object contains information about the feature points detected in the 2-D input image. The underlying feature point data of this object is stored on the GPU. Use the gather method and PointsGPU output to copy data back to the CPU.

pointsCPU = gather(pointsGPU);

References

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

Introduced in R2013a

Was this topic helpful?