Main Content

Erosion

Morphological erosion of binary pixel data

  • Library:
  • Vision HDL Toolbox / Morphological Operations

  • Erosion block

Description

The Erosion block replaces each pixel with the local minimum of the neighborhood around the pixel. The block operates on a stream of binary intensity values. You can specify a neighborhood or structuring element of up to 32-by-32 pixels.

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 4 or 8 pixels per clock cycle to support high-frame-rate or high-resolution formats. 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 four or eight 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.

Ports

Input

expand all

This block supports single pixel streaming or multipixel streaming. For single pixel streaming, specify a single input pixel as a scalar Boolean value. For multipixel streaming, specify a vector of four or eight Boolean values. For details of how to set up your model for multipixel streaming, see Filter Multipixel Video Streams.

Data Types: Boolean

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.

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

This block supports single pixel streaming or multipixel streaming. When using single pixel streaming, the block returns a single pixel as a scalar Boolean value. When using multipixel streaming, the block returns a vector of Boolean values. This vector is the same size as the input pixel vector. For details of how to set up your model for multipixel streaming, see Filter Multipixel Video Streams.

Data Types: Boolean

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.

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 are 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 1s and 0s.

The block supports neighborhoods of up to 32-by-32 pixels. To use a structuring element, specify Neighborhood as getnhood (Image Processing Toolbox)(strel (Image Processing Toolbox)(shape)).

When you use multipixel vector input, the neighbourhood must be at least two pixels in each dimension.

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.

Select one of these methods for padding the boundary of the input image. For more information about these methods, see Edge Padding.

  • Constant — The block pads the image with ones. This value prevents erosion at the boundaries of the active frame.

  • None — Exclude padding logic. The block does not set the pixels outside the image frame to any particular value. This option reduces the hardware resources used by the block and the blanking required between frames but affects the accuracy of the output pixels at the edges of the frame. To maintain pixel stream timing, the output frame is the same size as the input frame. However, to avoid using pixels calculated from undefined padding values, mask off the KernelSize/2 pixels around the edge of the frame for downstream operations. For details, see Increase Throughput with Padding None.

Algorithms

expand all

Extended Capabilities

See Also

| |

Topics

Introduced in R2015a