Documentation Center

  • Trial Software
  • Product Updates

imregionalmin

Regional minima

Syntax

BW = imregionalmin(I)
BW = imregionalmin(I,conn)

Description

BW = imregionalmin(I) computes the regional minima of I. The output binary image BW has value 1 corresponding to the pixels of I that belong to regional minima and 0 otherwise. BW is the same size as I.

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

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

BW = imregionalmin(I,conn) specifies the desired 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.

Code Generation

imregionalmin supports the generation of efficient, production-quality C/C++ code from MATLAB. When generating code, the optional second input argument, conn, must be a compile-time constant. Generated code for this function uses a precompiled platform-specific shared library. To see a complete list of toolbox functions that support code generation, see List of Supported Functions with Usage Notes.

Class Support

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

Examples

Create a 10-by-10 pixel sample image that contains two regional minima.

A = 10*ones(10,10);
A(2:4,2:4) = 2; 
A(6:8,6:8) = 7; 
A =
    10    10    10    10    10    10    10    10    10    10
    10     2     2     2    10    10    10    10    10    10
    10     2     2     2    10    10    10    10    10    10
    10     2     2     2    10    10    10    10    10    10
    10    10    10    10    10    10    10    10    10    10
    10    10    10    10    10     7     7     7    10    10
    10    10    10    10    10     7     7     7    10    10
    10    10    10    10    10     7     7     7    10    10
    10    10    10    10    10    10    10    10    10    10
    10    10    10    10    10    10    10    10    10    10

Pass the sample image A to imregionalmin. The function returns a binary image, the same size as A, in which pixels with the value 1 represent the regional minima in A. imregionalmin sets all other pixels in to zero (0).

B = imregionalmin(A)
B = 
     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     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

| | | | |

Was this topic helpful?