Main Content

vision.LocalMaximaFinder

(To be removed) Find local maxima in matrices

vision.LocalMaximaFinder function will be removed in a future release. Use the houghpeaks or max functions to find the local maxima, instead.

Description

To find local maxima in matrices.

  1. Create the vision.LocalMaximaFinder object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

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

LMaxFinder = vision.LocalMaximaFinder(maxnum,neighborsize) returns a local maxima finder object with the MaximumNumLocalMaxima property set to maxnum, NeighborhoodSize property set to neighborsize, and other specified properties set to the specified values.

LMaxFinder = vision.LocalMaximaFinder(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in quotes. For example, LMaxFinder = vision.LocalMaximaFinder('ThresholdSource','Property')

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Maximum number of maxima to find, specified as a positive scalar integer.

Neighborhood size for zero-ing out values, specified as a two-element vector

Source of threshold, specified as 'Property' or 'Input port'.

Value that all maxima should match or exceed, specified as a scalar of MATLAB® built-in numeric data type. This property applies when you set the ThresholdSource property to 'Property'.

Tunable: Yes

Indicator of Hough transform matrix input, specified as true or false. The block applies additional processing, specific to Hough transform on the right and left boundaries of the input matrix. 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.

Data type of index values, specified as double, single , uint8, uint16, or uint32.

Usage

Description

example

idx = LMaxFinder(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.

idx = LMaxFinder(I,threshold) finds the local maxima in the input image I, using the threshold value threshold, when you set the ThresholdSource property to 'Input port'.

Input Arguments

expand all

Video frame, specified as grayscale or truecolor (RGB).

Value that all maxima should match or exceed, specified as a scalar of MATLAB built-in numeric data type.

Output Arguments

expand all

Local maxima, returned as an M-by-2 matrix of one-based [x y] coordinates, where M represents the number of local maximas found.

Object Functions

To use an object function, specify the System object™ as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

initializeInitialize video frame and points to track
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

  1. Create an example 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; ... 
         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];
     
  2. Create a local maxima finder object.

     hLocalMax = vision.LocalMaximaFinder('MaximumNumLocalMaxima',1, ...
                                          'NeighborhoodSize',[3,3], ...
                                          'Threshold',1); 
  3. Find local maxima.

    location = hLocalMax(I)                     
    location = 1x2 uint32 row vector
    
       7   4
    
    

Extended Capabilities

Version History

Introduced in R2012b

collapse all

R2024a: vision.LocalMaximaFinder function will be removed

vision.LocalMaximaFinder function will be removed in a future release. Use the houghpeaks or max functions to find the local maxima, instead.