Main Content

Grayscale Dilation

Morphological dilation of grayscale pixel data

  • Grayscale Dilation block

Libraries:
Vision HDL Toolbox / Morphological Operations

Description

The Grayscale Dilation block performs morphological dilation 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 maximum pixel value. This algorithm uses only three comparators to find the maximums of all the rows, and then uses a comparison tree to find the maximum 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 maximum pixel value of the row results. If the structuring element contains zeros that exclude pixels, the algorithm saves hardware resources by not implementing comparators for those pixel locations.

Ports

This block uses a streaming pixel interface with a bus for frame control signals. This interface enables the block to operate independently of image size and format. The pixel ports on this block support single pixel streaming or multipixel streaming. Single pixel streaming accepts and returns a single pixel value each clock cycle. Multipixel streaming accepts and returns a vector of M pixels per clock cycle to support high-frame-rate or high-resolution formats. The M value corresponds to the Number of pixels parameter of the Frame To Pixels block. Along with the pixel, the block accepts and returns a pixelcontrol bus that contains five control signals. The control signals indicate the validity of each pixel and their location in the frame. For multipixel streaming, one set of control signals applies to all pixels in the vector. 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

For single pixel streaming, specify pixel as an unsigned scalar value that represents grayscale intensity. For multipixel streaming, specify pixel as a column vector of Number of pixels pixel intensity values. Number of pixels can be two, four, or eight.

The software supports double and single data types for simulation, but not for HDL code generation.

Data Types: uint8 | uint16 | uint32 | uint64 | double | single | fi(0,N,0)

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

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Output

expand all

The dimensions of the output pixel match the dimensions of the input pixel. The block returns the output pixel as a scalar or a column vector of Number of pixels values.

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

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

For multipixel streaming, each vector of pixel values has one set of control signals. Because the vector has only one valid signal, the pixels in the vector must be either all valid or all invalid. The hStart and vStart signals apply to the pixel with the lowest index in the vector. The hEnd and vEnd signals apply to the pixel with the highest index in the vector.

Data Types: bus

Parameters

expand all

Pixel neighborhood, specified as a vector or matrix of binary values.

The block supports flat neighborhoods of up to 32-by-32 pixels. To use a structuring element, set the Neighborhood parameter to getnhood (Image Processing Toolbox)(strel (Image Processing Toolbox)(shape)), where shape is specified by the input arguments to the strel (Image Processing Toolbox) function. 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.

Size of the line memory buffer, specified as a positive integer. Choose a power of two that accommodates the number of active pixels in a horizontal line. If you specify a value that is not a power of two, the buffer uses the next largest power of two.

When you use multipixel input, this value must accommodate (Active pixels per line)/(Number of pixels) + 2.

The block allocates (n – 1)-by-Line buffer size memory locations to store the pixels, where n is the number of lines in the Neighborhood parameter value.

Tips

  • When you use a block with an internal line buffer inside an Enabled Subsystem (Simulink), the enable signal pattern must maintain the timing of the pixel stream, including the minimum blanking intervals. If the enable pattern corrupts the timing of the pixel stream, you might see partial output frames, corrupted pixel stream control signals, or mismatches between Simulink® and HDL simulation results. You may need to extend the blanking intervals to accommodate for cycles when the enable is low. For more information, see Configure Blanking Intervals.

Algorithms

expand all

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

Extended Capabilities

Version History

Introduced in R2016a

expand all

See Also

(Computer Vision Toolbox) | | |

Topics