| Video and Image Processing Blockset™ | ![]() |
Statistics

The Find Local Maxima block finds the local maxima in the input matrix. It does this by comparing the maximum value in the matrix to a user-specified threshold. If the maximum value is greater than or equal to this threshold, the block considers the value a valid local maximum. Then, it sets all the matrix values in the neighborhood, an area around and including the maximum value, to 0. This step ensures that this maximum is not included in subsequent searches. The size of the neighborhood must be appropriate for the data set. That is, it must eliminate enough of the values around the maximum so that false peaks are not discovered. The block repeats this entire process until either it finds all the valid maxima or it finds the number of local maxima equal to the Maximum number of local maxima (N) parameter value, whichever comes first.
The block outputs the zero-based row and column coordinates of the maxima at the Idx port and the number of valid local maxima found at the Count port.
| Port | Input/Output | Supported Data Types | Complex Values Supported |
|---|---|---|---|
I/ Hough | Matrix in which you want to find the maxima |
| No |
Th | Scalar value that represents the value the maxima should meet or exceed | Same as I/Hough port | No |
Idx | Vector or matrix that represents the zero-based coordinates of the maxima. The first row represents the row coordinates and the second row represents the column coordinates. |
| No |
Count | Scalar value that represents the number of maxima that meet or exceed the threshold value | Same as Idx port | No |
The inputs to the I/Hough and Th ports must be the same data type.
Use the Maximum number of local maxima (N) parameter to specify the maximum number of maxima to find.
Use the Neighborhood size parameter to specify the size of the neighborhood around the maxima over which the block zeros out the values. Enter a two-element vector of positive odd integers, [r c]. Here, r is the number of rows in the neighborhood and c is the number of columns.
Use the Source of threshold value parameter to specify how to enter the threshold value. If you select Input port, the Th port appears on the block. If you select Specify via dialog, the Threshold parameter appears in the dialog box. Enter a scalar value that represents the value all maxima should meet or exceed.
If the input to this block is a Hough matrix output from the Hough Transform block, select the Input is Hough matrix spanning full theta range check box. If you select this check box, the block assumes that the Hough port input is antisymmetric about the rho axis and theta ranges from -pi/2 to pi/2 radians. If the block finds a local maxima near the boundary such that the neighborhood lies outside the Hough matrix, the block finds only one local maximum, and it ignores the corresponding antisymmetric maximum.
Use the Index output data type parameter to specify the data type of the Idx port output. Your choices are double, single, uint8, uint16, or uint32.
Use the Count output data type parameter to specify the data type of the Count port output. Your choices are double, single, uint8, uint16, or uint32.
See Finding Lines in Images and Measuring an Angle Between Lines in the Video and Image Processing Blockset™ User's Guide.
The Find Local Maxima dialog box appears as shown in the following figure.

Specify the maximum number of maxima you want the block to find.
Specify the size of the neighborhood around the maxima over which the block zeros out the values. Enter a two-element vector of positive odd integers, [r c].
Specify how to enter the threshold value. If you select Input port, the Th port appears on the block. If you select Specify via dialog, the Threshold parameter appears in the dialog box.
Enter a scalar value that represents the value all maxima should meet or exceed. This parameter is visible if, for the Source of threshold value parameter, you choose Specify via dialog.
If you select this check box, the block assumes that the Hough port input is antisymmetric about the rho axis and theta ranges from -pi/2 to pi/2 radians.
Specify the data type of the Peaks port output. Your choices are double, single, uint8, uint16, or uint32.
Specify the data type of the Count port output. Your choices are double, single, uint8, uint16, or uint32.
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Image Processing Toolbox |
![]() | Estimate Geometric Transformation | Frame Rate Display | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |