gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapegray_erosion_shape(算子)

名称

gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapegray_erosion_shape — 确定选定掩模内的最小灰度值。

签名

gray_erosion_shape(Image : ImageMin : MaskHeight, MaskWidth, MaskShape : )

Herror gray_erosion_shape(const Hobject Image, Hobject* ImageMin, double MaskHeight, double MaskWidth, const char* MaskShape)

Herror T_gray_erosion_shape(const Hobject Image, Hobject* ImageMin, const Htuple MaskHeight, const Htuple MaskWidth, const Htuple MaskShape)

void GrayErosionShape(const HObject& Image, HObject* ImageMin, const HTuple& MaskHeight, const HTuple& MaskWidth, const HTuple& MaskShape)

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

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

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

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

static void HOperatorSet.GrayErosionShape(HObject image, out HObject imageMin, HTuple maskHeight, HTuple maskWidth, HTuple maskShape)

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

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

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

描述

gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapeGrayErosionShapegray_erosion_shape calculates the minimum gray value of the input image ImageImageImageImageimageimage within a mask of shape MaskShapeMaskShapeMaskShapeMaskShapemaskShapemask_shape, vertical size MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_height and horizontal size MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width for each image point. The resulting image is returned in ImageMinImageMinImageMinImageMinimageMinimage_min

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

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

注意

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

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

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

执行信息

参数

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

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

ImageMinImageMinImageMinImageMinimageMinimage_min (输出对象)  (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

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

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_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapeGrayErosionShapegray_erosion_shape 在所有参数正确时返回 2 (H_MSG_TRUE)。

替代

gray_erosiongray_erosionGrayErosionGrayErosionGrayErosiongray_erosion, gray_erosion_rectgray_erosion_rectGrayErosionRectGrayErosionRectGrayErosionRectgray_erosion_rect

另见

gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapeGrayOpeningShapegray_opening_shape, gray_closing_shapegray_closing_shapeGrayClosingShapeGrayClosingShapeGrayClosingShapegray_closing_shape, gray_skeletongray_skeletonGraySkeletonGraySkeletonGraySkeletongray_skeleton

模块

基础