Products & Services Solutions Academia Support User Community Company

Learn more about Image Processing Toolbox   

imregionalmax - Regional maxima

Syntax

BW = imregionalmax(I)
BW = imregionalmax(I,conn)

Description

BW = imregionalmax(I) finds the regional maxima of I. imregionalmax returns the binary image BW that identifies the locations of the regional maxima in I. BW is the same size as I. In BW, pixels that are set to 1 identify regional maxima; all other pixels are set to 0.

Regional maxima are connected components of pixels with a constant intensity value, and whose external boundary pixels all have a lower value.

By default, imregionalmax uses 8-connected neighborhoods for 2-D images and 26-connected neighborhoods for 3-D images. For higher dimensions, imregionalmax uses conndef(ndims(I),'maximal').

BW = imregionalmax(I,conn) computes the regional maxima of I using the specified connectivity. conn can have any of the following scalar values.

Value

Meaning

Two-dimensional connectivities

4

4-connected neighborhood

8

8-connected neighborhood

Three-dimensional connectivities

6

6-connected neighborhood

18

18-connected neighborhood

26

26-connected neighborhood

Connectivity can be defined in a more general way for any dimension by using for conn a 3-by-3-by- ...-by-3 matrix of 0's and 1's. The 1-valued elements define neighborhood locations relative to the center element of conn. Note that conn must be symmetric about its center element.

Class Support

I can be any nonsparse, numeric class and any dimension. BW is logical.

Examples

Create a sample image with several regional maxima.

A = 10*ones(10,10);
A(2:4,2:4) = 22; 
A(6:8,6:8) = 33; 
A(2,7) = 44;
A(3,8) = 45;
A(4,9) = 44;
A =
   10    10    10    10    10    10    10    10    10    10
   10    22    22    22    10    10    44    10    10    10
   10    22    22    22    10    10    10    45    10    10
   10    22    22    22    10    10    10    10    44    10
   10    10    10    10    10    10    10    10    10    10
   10    10    10    10    10    33    33    33    10    10
   10    10    10    10    10    33    33    33    10    10
   10    10    10    10    10    33    33    33    10    10
   10    10    10    10    10    10    10    10    10    10
   10    10    10    10    10    10    10    10    10    10

Find the regional maxima.

regmax = imregionalmax(A)
regmax =
     0     0     0     0     0     0     0     0     0     0
     0     1     1     1     0     0     0     0     0     0
     0     1     1     1     0     0     0     1     0     0
     0     1     1     1     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     1     1     1     0     0
     0     0     0     0     0     1     1     1     0     0
     0     0     0     0     0     1     1     1     0     0
     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0

See Also

conndef, imextendedmax, imhmax, imreconstruct, imregionalmin

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS