gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapegray_closing_shape灰度闭形状(算子)

名称

gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapegray_closing_shape — 使用选定的掩模执行灰度值闭。

签名

gray_closing_shape(Image : ImageClosing : MaskHeight, MaskWidth, MaskShape : )

Herror gray_closing_shape(const Hobject Image, Hobject* ImageClosing, double MaskHeight, double MaskWidth, const char* MaskShape)

Herror T_gray_closing_shape(const Hobject Image, Hobject* ImageClosing, const Htuple MaskHeight, const Htuple MaskWidth, const Htuple MaskShape)

void GrayClosingShape(const HObject& Image, HObject* ImageClosing, const HTuple& MaskHeight, const HTuple& MaskWidth, const HTuple& MaskShape)

HImage HImage::GrayClosingShape(const HTuple& MaskHeight, const HTuple& MaskWidth, const HString& MaskShape) const

HImage HImage::GrayClosingShape(double MaskHeight, double MaskWidth, const HString& MaskShape) const

HImage HImage::GrayClosingShape(double MaskHeight, double MaskWidth, const char* MaskShape) const

HImage HImage::GrayClosingShape(double MaskHeight, double MaskWidth, const wchar_t* MaskShape) const   ( Windows only)

static void HOperatorSet.GrayClosingShape(HObject image, out HObject imageClosing, HTuple maskHeight, HTuple maskWidth, HTuple maskShape)

HImage HImage.GrayClosingShape(HTuple maskHeight, HTuple maskWidth, string maskShape)

HImage HImage.GrayClosingShape(double maskHeight, double maskWidth, string maskShape)

def gray_closing_shape(image: HObject, mask_height: Union[int, float], mask_width: Union[int, float], mask_shape: str) -> HObject

描述

gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape 对输入图像 ImageImageImageImageimageimage 应用灰度值闭运算,结构元素为形状掩模 MaskShapeMaskShapeMaskShapeMaskShapemaskShapemask_shape。该掩模的偏移量为 0,其水平和垂直尺寸由 MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_heightMaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width 定义。结果图像通过 ImageClosingImageClosingImageClosingImageClosingimageClosingimage_closing 返回。

如果参数 MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_heightMaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width 为整数类型且为偶数,则将其转换为下一个更大的奇数值。相反,若这两个参数中至少有一个为浮点类型,则输入图像 ImageImageImageImageimageimage 将同时应用下一个更大和下一个更小的奇数掩模尺寸进行变换,输出图像 ImageClosingImageClosingImageClosingImageClosingimageClosingimage_closing 则通过插值生成于这两个中间图像之间。因此请注意:当掩模尺寸为 44.0时,gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape 会返回不同的结果!

MaskShapeMaskShapeMaskShapeMaskShapemaskShapemask_shape 控制参数取值为'rhombus'或'octagon'时,MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_heightMaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width 必须相等。参数值'octagon'用于 MaskShapeMaskShapeMaskShapeMaskShapemaskShapemask_shape 时,表示一个等边八边形掩模,该形状可作为圆形结构的合理近似。在图像边界处,灰度值将被镜像处理。

图像 i 在结构化元素 s 作用下的灰度值闭定义为: 即:先对图像进行 s 值的膨胀操作,再进行 s 值的腐蚀操作(参见 gray_dilation_shapegray_dilation_shapeGrayDilationShapeGrayDilationShapeGrayDilationShapegray_dilation_shapegray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapeGrayErosionShapegray_erosion_shape)。

注意

请注意,对于浮点型掩模尺寸,gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape 的计算时间远多于整数型掩模尺寸。对于宽高不同的矩形掩模,这种差异尤为显著!

gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape 可在 OpenCL 设备上执行。当掩模尺寸为浮点类型时,由于插值在 OpenCL 设备上以单精度计算,结果可能与 CPU 计算结果存在细微差异。

请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte* / uint2*) *允许用于计算设备

需计算最小灰度值的图像。

ImageClosingImageClosingImageClosingImageClosingimageClosingimage_closing (输出对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte / uint2)

包含最小灰度值的图像。

MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_height (输入控制)  extent.y HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

滤波掩模的高度。

默认值: 11

建议值: 3, 5, 7, 9, 11, 13, 15

值范围: 1.0 ≤ MaskHeight MaskHeight MaskHeight MaskHeight maskHeight mask_height ≤ 511.0

MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width (输入控制)  extent.x HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

滤波掩模的宽度。

默认值: 11

建议值: 3, 5, 7, 9, 11, 13, 15

值范围: 1.0 ≤ MaskWidth MaskWidth MaskWidth MaskWidth maskWidth mask_width ≤ 511.0

MaskShapeMaskShapeMaskShapeMaskShapemaskShapemask_shape (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

掩模的形状。

默认值: 'octagon' "octagon" "octagon" "octagon" "octagon" "octagon"

值列表: 'octagon'"octagon""octagon""octagon""octagon""octagon", 'rectangle'"rectangle""rectangle""rectangle""rectangle""rectangle", 'rhombus'"rhombus""rhombus""rhombus""rhombus""rhombus"

结果

gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape 在所有参数正确时返回 2 (H_MSG_TRUE)。

替代

gray_closinggray_closingGrayClosingGrayClosingGrayClosinggray_closing

另见

gray_dilation_shapegray_dilation_shapeGrayDilationShapeGrayDilationShapeGrayDilationShapegray_dilation_shape, gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapeGrayErosionShapegray_erosion_shape, closingclosingClosingClosingClosingclosing

模块

基础