MORPH_CLOSE Function (PV-WAVE Extreme Advantage)

Performs the morphologic-close operation for shape processing. The close operation is defined as dilation followed by erosion

Usage

result = MORPH_CLOSE(image, structure[, x0, y0])

Input Parameters

image—The array to be eroded and dilated.

structure—A 1D or 2D array of structuring elements. The elements are interpreted as binary elements (values are either zero or nonzero), unless the Gray keyword is used.

x0—(optional) The x-coordinate of the structure’s origin.

y0—(optional) The y-coordinate of the structure’s origin.

Returned Value

result—The closed image that is of the same size and dimensions as image.

Keywords

Gray—If set, uses grayscale dilation and erosion. (Default: binary dilation and erosion)

Values—An array of values of the structuring element. The Values array must have the same dimensions and number of elements as the structure parameter.

Discussion

Morphological operations are defined for grayscale byte images. If image is not originally of type byte, PV‑WAVE makes a temporary copy of image that is of type byte before using it for the morphological processing.

The morphological closing operation is defined as dilation followed by erosion. These operations are defined for byte data type images only. Closing is typically used to fill in small artifacts in images such as small gaps or holes. Larger gaps and holes can be filled by applying the morphological closing operation multiple times in succession.

Example

morph_struct = BYTARR(3, 3)
morph_struct(*) = 1B
morph_struct(1, 1) = 0B
; Remove the thin parts of the letters.
test_image = IMAGE_READ(!IP_Data + 'vnitext.tif')
close_image = MORPH_CLOSE(test_image('pixels'), morph_struct)
TVSCL, close_image

See Also

HIT_MISS, MORPH_OPEN, MORPH_OUTLINE, SKELETONIZE, TOP_HAT

In the PV‑WAVE Reference:  DILATE,  ERODE