gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape (Operator)

Name

gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape — Perform a gray value opening with a selected mask.

Signature

gray_opening_shape(Image : ImageOpening : MaskHeight, MaskWidth, MaskShape : )

Herror gray_opening_shape(const Hobject Image, Hobject* ImageOpening, double MaskHeight, double MaskWidth, const char* MaskShape)

Herror T_gray_opening_shape(const Hobject Image, Hobject* ImageOpening, const Htuple MaskHeight, const Htuple MaskWidth, const Htuple MaskShape)

void GrayOpeningShape(const HObject& Image, HObject* ImageOpening, const HTuple& MaskHeight, const HTuple& MaskWidth, const HTuple& MaskShape)

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

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

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

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

static void HOperatorSet.GrayOpeningShape(HObject image, out HObject imageOpening, HTuple maskHeight, HTuple maskWidth, HTuple maskShape)

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

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

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

Description

gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape applies a gray value opening to the input image ImageImageImageimageimage with the structuring element of shape MaskShapeMaskShapeMaskShapemaskShapemask_shape. The mask's offset values are 0 and its horizontal and vertical size is defined by MaskHeightMaskHeightMaskHeightmaskHeightmask_height and MaskWidthMaskWidthMaskWidthmaskWidthmask_width. The resulting image is returned in ImageOpeningImageOpeningImageOpeningimageOpeningimage_opening.

If the parameters MaskHeightMaskHeightMaskHeightmaskHeightmask_height or MaskWidthMaskWidthMaskWidthmaskWidthmask_width are of the type integer and are even, they are changed to the next larger odd value. In contrast, if at least one of the two parameters is of the type float, the input image ImageImageImageimageimage is transformed with both the next larger and the next smaller odd mask size, and the output image ImageOpeningImageOpeningImageOpeningimageOpeningimage_opening is interpolated from the two intermediate images. Therefore, note that gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape returns different results for mask sizes of, e.g., 4 and 4.0!

In case of the values 'rhombus' and 'octagon' for the MaskShapeMaskShapeMaskShapemaskShapemask_shape control parameter, MaskHeightMaskHeightMaskHeightmaskHeightmask_height and MaskWidthMaskWidthMaskWidthmaskWidthmask_width must be equal. The parameter value 'octagon' for MaskShapeMaskShapeMaskShapemaskShapemask_shape denotes an equilateral octagonal mask which is a suitable approximation for a circular structure. At the border of the image the gray values are mirrored.

The gray value opening of an image i with a structuring element s is defined as i.e., an erosion of the image with s followed by a dilation with s (see gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapegray_erosion_shape and gray_dilation_shapegray_dilation_shapeGrayDilationShapeGrayDilationShapegray_dilation_shape).

Attention

Note that gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape requires considerably more time for mask sizes of type float than for mask sizes of type integer. This is especially true for rectangular masks with different width and height!

gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape can be executed on OpenCL devices. In case of mask sizes of type float the result can vary slightly from the CPU as the interpolation is calculated in single precision on the OpenCL device.

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution Information

Parameters

ImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte* / uint2*) *allowed for compute devices

Image for which the minimum gray values are to be calculated.

ImageOpeningImageOpeningImageOpeningimageOpeningimage_opening (output_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject * (byte / uint2)

Image containing the minimum gray values.

MaskHeightMaskHeightMaskHeightmaskHeightmask_height (input_control)  extent.y HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Height of the filter mask.

Default: 11

Suggested values: 3, 5, 7, 9, 11, 13, 15

Value range: 1.0 ≤ MaskHeight MaskHeight MaskHeight maskHeight mask_height ≤ 511.0

MaskWidthMaskWidthMaskWidthmaskWidthmask_width (input_control)  extent.x HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Width of the filter mask.

Default: 11

Suggested values: 3, 5, 7, 9, 11, 13, 15

Value range: 1.0 ≤ MaskWidth MaskWidth MaskWidth maskWidth mask_width ≤ 511.0

MaskShapeMaskShapeMaskShapemaskShapemask_shape (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Shape of the mask.

Default: 'octagon' "octagon" "octagon" "octagon" "octagon"

List of values: 'octagon'"octagon""octagon""octagon""octagon", 'rectangle'"rectangle""rectangle""rectangle""rectangle", 'rhombus'"rhombus""rhombus""rhombus""rhombus"

Result

gray_opening_shapegray_opening_shapeGrayOpeningShapeGrayOpeningShapegray_opening_shape returns 2 ( H_MSG_TRUE) if all parameters are correct.

Alternatives

gray_openinggray_openingGrayOpeningGrayOpeninggray_opening

See also

gray_dilation_shapegray_dilation_shapeGrayDilationShapeGrayDilationShapegray_dilation_shape, gray_erosion_shapegray_erosion_shapeGrayErosionShapeGrayErosionShapegray_erosion_shape, openingopeningOpeningOpeningopening

Module

Foundation