You are here : matlabImage Processingimregionalmin

# imregionalmin() - Image Processing

BW = imregionalmin(I) returns
the binary image BW that identifies the regional
minima in I. Regional minima are connected components
of pixels with a constant intensity value, and whose external boundary
pixels all have a higher value. In BW, pixels that
are set to 1 identify regional minima; all other
pixels are set to 0. BW = imregionalmin(I,conn) computes
the regional minima, where conn specifies the
desired connectivity. By default, imregionalmin uses
8-connected neighborhoods for 2-D images and 26-connected neighborhoods
for 3-D imagesexamplegpuarrayBW = imregionalmin(gpuarrayI,___) performs
the operation on a GPU. The input image must be a gpuArray.
The function returns a gpuArray. This syntax requires Parallel Computing Toolboxâ„˘.Code Generation support:
Yes.MATLAB Function Block support:
Yes.

### Syntax

BW = imregionalmin(I) exampleBW = imregionalmin(I,conn)gpuarrayBW = imregionalmin(gpuarrayI,___) example

### Example

Find Regional Minima in Simple Sample ImageOpen This Example
Create a simple sample array with several regional minima.A = 10*ones(10,10);
A(2:4,2:4) = 3;
A(6:8,6:8) = 8

A =

10    10    10    10    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10    10    10    10    10    10    10    10    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10    10    10    10    10    10
10    10    10    10    10    10    10    10    10    10

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

regmin =

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

Find Regional Minima in Simple Sample Image on a GPUCreate a 10-by-10 pixel sample image that contains two
regional minima.A = 10*gpuArray.ones(10,10);
A(2:4,2:4) = 3;       % minima 3 lower than surround
A(6:8,6:8) = 8        % minima 8 lower than surroundA(6:8,6:8) = 7;
A =

10    10    10    10    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10     3     3     3    10    10    10    10    10    10
10    10    10    10    10    10    10    10    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10     8     8     8    10    10
10    10    10    10    10    10    10    10    10    10
10    10    10    10    10    10    10    10    10    10
10    10    10    10    10    10    10    10    10    10Pass 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 0.regmin = imregionalmin(A)regmin =

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