You are here : matlabImage Processingimhmax

# imhmax() - Image Processing

```I2 = imhmax(I,h) suppresses
all maxima in the intensity image I whose height
is less than h, where h is a
scalar. Regional maxima are connected components of pixels with a
constant intensity value, and whose external boundary pixels all have
a lower value. By default, imhmax uses 8-connected
neighborhoods for 2-D images, and 26-connected neighborhoods for 3-D
images. For higher dimensions, imhmax uses conndef(ndims(I),'maximal').I2 = imhmax(I,h,conn) computes
the H-maxima transform, where conn specifies the
connectivity.Code Generation support:
Yes.MATLAB Function Block support:
Yes.```

### Syntax

`I2 = imhmax(I,h) exampleI2 = imhmax(I,h,conn)`

### Example

```Create H-Maxima TransformOpen This Example
Create simple sample array of zeros with several maxima.a = zeros(10,10);
a(2:4,2:4) = 3;
a(6:8,6:8) = 8

a =

0     0     0     0     0     0     0     0     0     0
0     3     3     3     0     0     0     0     0     0
0     3     3     3     0     0     0     0     0     0
0     3     3     3     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     8     8     8     0     0
0     0     0     0     0     8     8     8     0     0
0     0     0     0     0     8     8     8     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0

Calculate the maxima equal to 4 or more. Note how the area of the image set to 3 is not included.b = imhmax(a,4)

b =

0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     4     4     4     0     0
0     0     0     0     0     4     4     4     0     0
0     0     0     0     0     4     4     4     0     0
0     0     0     0     0     0     0     0     0     0
0     0     0     0     0     0     0     0     0     0```