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.

vision.LocalMaximaFinder System object

Find local maxima in matrices


The LocalMaximaFinder object finds local maxima in matrices.

After constructing the object and optionally setting properties, use the step method to find the coordinates of the local maxima in the input image. Use the step syntax below with input matrix, I, LocalMaximaFinder object, H, and any optional properties.

IDX = step(H,I) returns [x y] coordinates of the local maxima in an M-by-2 matrix, IDX. M represents the number of local maximas found. The maximum value of M may not exceed the value set in the MaximumNumLocalMaxima property.
[...] = step(H,I,THRESH) finds the local maxima in input image I, using the threshold value THRESH, when you set the ThresholdSource property to Input port.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.LocalMaximaFinder returns a local maxima finder System object, H, that finds local maxima in input matrices.

H = vision.LocalMaximaFinder(Name,Value) returns a local maxima finder object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

H = vision.LocalMaximaFinder(MAXNUM,NEIGHBORSIZE,Name,Value) returns a local maxima finder object, H, with the MaximumNumLocalMaxima property set to MAXNUM, NeighborhoodSize property set to NEIGHBORSIZE, and other specified properties set to the specified values.



Maximum number of maxima to find

Specify the maximum number of maxima to find as a positive scalar integer value. The default is 2.


Neighborhood size for zero-ing out values

Specify the size of the neighborhood around the maxima, over which the System object zeros out values, as a 2-element vector of positive odd integers. The default is [5 7].


Source of threshold

Specify how to enter the threshold value as Property, or Input port. The default is Property.


Value that all maxima should match or exceed

Specify the threshold value as a scalar of MATLAB® built-in numeric data type. This property applies when you set the ThresholdSource property to Property. The default is 10. This property is tunable.


Indicator of Hough Transform matrix input

Set this property to true if the input is antisymmetric about the rho axis and the theta value ranges from π2 to π2 radians, which correspond to a Hough matrix.

When you set this property to true, the object assumes a Hough matrix input . The block applies additional processing, specific to Hough transform on the right and left boundaries of the input matrix.

The default is false.


Data type of index values

Specify the data type of index values as double, single , uint8, uint16, or uint32. The default is uint32.


stepFind local maxima in input image
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


Find a local maxima in an input.

      I = [0 0 0 0 0 0 0 0 0 0 0 0; ...
           0 0 0 1 1 2 3 2 1 1 0 0; ...
           0 0 0 1 2 3 4 3 2 1 0 0; ...
           0 0 0 1 3 5 7 5 3 1 0 0; ... % local max at x=7, y=4
           0 0 0 1 2 3 4 3 2 1 0 0; ...
           0 0 0 1 1 2 3 2 1 1 0 0; ...
           0 0 0 0 0 0 0 0 0 0 0 0];    

      hLocalMax = vision.LocalMaximaFinder;
      hLocalMax.MaximumNumLocalMaxima = 1;
      hLocalMax.NeighborhoodSize = [3 3];
      hLocalMax.Threshold = 1;

      location = step(hLocalMax, I)


This object implements the algorithm, inputs, and outputs described on the Find Local Maxima block reference page. The object properties correspond to the block parameters.

Extended Capabilities

Introduced in R2012a