1. default:
template<int ROWS, int COLS, int SRC_T, int DST_T>
void hls::Dilate( hls::Mat<ROWS, COLS, SRC_T>& src,
                  hls::Mat<ROWS, COLS, DST_T>& dst );
2. custom:
template<int ROWS, int COLS,int SRC_T, int DST_T, int K_ROWS, int K_COLS, typename K_T, int Shape_type, int ITERATIONS>
void hls::Dilate( hls::Mat<ROWS, COLS, SRC_T>& src,
                  hls::Mat<ROWS, COLS, DST_T>& dst,
                  hls::Window<K_ROWS, K_COLS, K_T>& kernel );


  • src – the input image.
  • dst – the output image.
  • kernel – the rectangle of structuring element used for dilation, defined by hls::Window class. Position of the anchor within the element is at (K_ROWS/2, K_COLS/2). A 3x3 rectangular structuring element is used by default.
  • Shape_type – the shape of structuring element:
    • HLS_SHAPE_RECT: a rectangular structuring element
    • HLS_SHAPE_CROSS: a cross-shaped structuring element, cross point is at anchor.
    • HLS_SHAPE_ELLIPSE: an elliptic structuring element, a filled ellipse inscribed into the rectangular element.
  • ITERATIONS – number of times dilation is applied.


Dilates the image src using the specified structuring element constructed within kernel, save the result in dst. The dilation determines the shape of a pixel neighborhood over which the maximum is taken, each channel of image src is processed independently:
Image data must be stored in src, the image data of dst must be empty before invocations. Invoking this function will consume the data in src, and filling the image data of dst.
src and dst must have the same size and number of channels.

OpenCV reference

cvDilate, cv::dilate