Main Content

imextendedmax

扩展最大值变换

说明

示例

BW = imextendedmax(I,H) 返回 I 的扩展最大值变换,这是 H 最大值变换的区域最大值。区域最大值是具有同一强度值且其外边界像素强度值均低于该值的连通像素分量。

BW = imextendedmax(I,H,conn) 计算扩展最大值变换,其中 conn 指定像素连通性。

示例

全部折叠

将图像读入工作区。

I = imread('glass.png');

计算扩展最大值变换。

BW = imextendedmax(I,80);

并排显示原始图像和变换后的图像。

imshowpair(I,BW,'montage')

输入参数

全部折叠

输入图像,指定为任意维度的数值数组。

示例: I = imread('glass.png');

数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

H 最大值变换,指定为非负标量。

示例: BW = imextendedmax(I,80);

数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

像素连通性,指定为下表中的值之一。对于二维图像,默认连通性是 8,对于三维图像,默认连通性是 26

意义

二维连通

4

如果像素的边缘相互接触,则这些像素具有连通性。像素的邻域是水平或垂直方向上的相邻像素。

3-by-3 pixel neighborhood with four pixels connected to the center pixel

当前像素以灰色显示。

8

如果像素的边缘或角相互接触,则这些像素具有连通性。像素的邻域是水平、垂直或对角线方向上的相邻像素。

3-by-3 pixel neighborhood with 8 pixels connected to the center pixel

当前像素以灰色显示。

三维连通

6

如果像素的面接触,则这些像素具有连通性。像素的邻域是符合以下条件的相邻像素:

  • 在所列方向之一上连通:内、外、左、右、上、下

3-by-3-by-3 pixel neighborhood with 6 pixels connected to the faces of the center pixel

当前像素以灰色显示。

18

如果像素的面或边缘接触,则这些像素具有连通性。像素的邻域是符合以下条件的相邻像素:

  • 在所列方向之一上连通:内、外、左、右、上、下

  • 在两个方向的组合上连通,如右下或内上

3-by-3-by-3 pixel neighborhood with 6 pixels connected to the faces and 12 pixels connected to the edges of the center pixel

当前像素是立方体的中心。

26

如果像素的面、边缘或角接触,则这些像素具有连通性。像素的邻域是符合以下条件的相邻像素:

  • 在所列方向之一上连通:内、外、左、右、上、下

  • 在两个方向的组合上连通,如右下或内上

  • 在三个方向的组合上连通,如内右上或内左下

3-by-3-by-3 pixel neighborhood with 6 pixels connected to the faces, 12 pixels connected to the edges, and 8 pixels connected to the corners of the center pixel

当前像素是立方体的中心。

对于更高的维度,imextendedmax 使用默认值 conndef(ndims(I),'maximal')

也可以通过指定由 01 组成的 3×3×...×3 矩阵,以更通用的方式来定义任意维度的连通性。值为 1 的元素定义相对于 conn 的中心元素的邻域位置。请注意,conn 必须关于其中心元素对称。有关详细信息,请参阅指定自定义连通性

数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

输出参量

全部折叠

变换后的图像,以与 I 大小相同的逻辑数组形式返回。

参考

[1] Soille, P. Morphological Image Analysis: Principles and Applications. Springer-Verlag, 1999, pp. 170-171.

扩展功能

版本历史记录

在 R2006a 之前推出