Grayscale Erosion

Morphological erosion of grayscale pixel data

  • Library:
  • Vision HDL Toolbox / Morphological Operations

  • Grayscale Erosion block

Description

The Grayscale Erosion block performs morphological erosion on a stream of pixel intensity values. You can specify a neighborhood or structuring element of up to 32-by-32 pixels. For line, square, or rectangle structuring elements more than 8 pixels wide, the block uses the Van Herk algorithm to find the minimum pixel value. This algorithm uses only three comparators to find the minimum pixel values of all the rows, then uses a comparison tree to find the minimum pixel value of the row results.

For structuring elements less than 8 pixels wide, or that contain zero elements, the block implements a pipelined comparison tree for each row of the neighborhood. An additional comparison tree finds the minimum pixel value of the row results. If the structuring element contains zeros that mask off pixels, the algorithm saves hardware resources by not implementing comparators for those pixel locations.

Ports

This block uses a streaming pixel interface with a pixelcontrol bus for frame control signals. This interface enables the block to operate independently of image size and format. All Vision HDL Toolbox™ blocks use the same streaming interface. The block accepts and returns a scalar pixel value and a bus that contains five control signals. The control signals indicate the validity of each pixel and its location in the frame. To convert a frame (pixel matrix) into a serial pixel stream and control signals, use the Frame To Pixels block. For a full description of the interface, see Streaming Pixel Interface.

Input

expand all

Single image pixel in a pixel stream, specified as a scalar that represents grayscale intensity.

double and single data types are supported for simulation, but not for HDL code generation.

Data Types: uint8 | uint16 | uint32 | int8 | int16 | int32 | fixed point | Boolean | double | single

Specify a pixelcontrol bus that contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

Data Types: bus

Output

expand all

Single output pixel transformed by a morphological operation, returned as a scalar value.

The data type of this output pixel is the same as the data type of the input pixel.

Data Types: single | double | uint8 | uint16 | uint32 | Boolean | fixdt(0,N,M)

Control signals associated with the pixel stream, returned as a pixelcontrol bus that contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

Data Types: bus

Parameters

expand all

Pixel neighborhood, specified as a vector or matrix of 1s and 0s.

The block supports flat neighborhoods of up to 32-by-32 pixels. To use a structuring element, specify the Neighborhood as getnhood (Image Processing Toolbox)(strel (Image Processing Toolbox)(shape)). The minimum neighborhood size is a 2-by-2 matrix, or a 2-by-1 column vector. If the neighborhood is a row vector, it must be at least 8 columns wide and contain no zeros.

Specify a power of two that accommodates the number of active pixels in a single horizontal line.

If you specify a value that is not a power of two, the block uses the next largest power of two. The block allocates (neighborhood lines – 1)-by-Line buffer size memory locations to store the pixels.

Algorithms

expand all

The block pads the image with ones for the erosion operation. For more information, see Edge Padding.

Extended Capabilities

See Also

| | | (Computer Vision Toolbox)

Topics

Introduced in R2016a