Skip to content

gray_opening_rectGrayOpeningRectGrayOpeningRectgray_opening_rectgray_opening_rect🔗

Short description🔗

gray_opening_rectGrayOpeningRectGrayOpeningRectgray_opening_rectgray_opening_rect — Perform a gray value opening with a rectangular mask.

Signature🔗

gray_opening_rect( image Image, out image ImageOpening, extent.y MaskHeight, extent.x MaskWidth )void GrayOpeningRect( const HObject& Image, HObject* ImageOpening, const HTuple& MaskHeight, const HTuple& MaskWidth )static void HOperatorSet.GrayOpeningRect( HObject image, out HObject imageOpening, HTuple maskHeight, HTuple maskWidth )def gray_opening_rect( image: HObject, mask_height: int, mask_width: int ) -> HObject

Herror gray_opening_rect( const Hobject Image, Hobject* ImageOpening, const Hlong MaskHeight, const Hlong MaskWidth )

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

HImage HImage::GrayOpeningRect( Hlong MaskHeight, Hlong MaskWidth ) const

HImage HImage.GrayOpeningRect( int maskHeight, int maskWidth )

Description🔗

gray_opening_rectGrayOpeningRect applies a gray value opening to the input image Imageimageimage with a rectangular mask of size (MaskHeightmaskHeightmask_height, MaskWidthmaskWidthmask_width). The resulting image is returned in ImageOpeningimageOpeningimage_opening. If the parameters MaskHeightmaskHeightmask_height or MaskWidthmaskWidthmask_width are even, they are changed to the next larger odd value. At the border of the image the gray values are mirrored.

The gray value opening of an image \(i\) with a rectangular structuring element \(s\) is defined as

\[\begin{eqnarray*} i \circ s = (i \ominus s) \oplus s \enspace , \end{eqnarray*}\]

i.e., an erosion of the image with \(s\) followed by a dilation with \(s\) (see gray_erosion_rectGrayErosionRect and gray_dilation_rectGrayDilationRect).

Attention🔗

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🔗

Execution information
  • Supports OpenCL compute devices.

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte / direction / cyclic / uint2 / int2 / int4 / real)HObject (byte / direction / cyclic / uint2 / int2 / int4 / real)HImage (byte / direction / cyclic / uint2 / int2 / int4 / real)HObject (byte / direction / cyclic / uint2 / int2 / int4 / real)Hobject (byte / direction / cyclic / uint2 / int2 / int4 / real)

Input image.

ImageOpeningimageOpeningimage_opening (output_object) (multichannel-)image(-array) → object (byte / direction / cyclic / uint2 / int2 / int4 / real)HObject (byte / direction / cyclic / uint2 / int2 / int4 / real)HImage (byte / direction / cyclic / uint2 / int2 / int4 / real)HObject (byte / direction / cyclic / uint2 / int2 / int4 / real)Hobject * (byte / direction / cyclic / uint2 / int2 / int4 / real)

Gray-opened image.

MaskHeightmaskHeightmask_height (input_control) extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the filter mask.

Default: 1111
Suggested values: 3, 5, 7, 9, 11, 13, 153, 5, 7, 9, 11, 13, 15
Value range: 3 ≤ MaskHeight ≤ 511
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskHeight) && MaskHeight < height(Image) * 2

MaskWidthmaskWidthmask_width (input_control) extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the filter mask.

Default: 1111
Suggested values: 3, 5, 7, 9, 11, 13, 153, 5, 7, 9, 11, 13, 15
Value range: 3 ≤ MaskWidth ≤ 511
Minimum increment: 2
Recommended increment: 2
Restriction: odd(MaskWidth) && MaskWidth < width(Image) * 2

Result🔗

gray_opening_rectGrayOpeningRect returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Alternatives

gray_openingGrayOpening, gray_opening_shapeGrayOpeningShape

See also

opening_rectangle1OpeningRectangle1, gray_dilation_rectGrayDilationRect, gray_erosion_rectGrayErosionRect

Module🔗

Foundation