Median Blur Filter - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

The function medianBlur performs a median filter operation on the input image. The median filter acts as a non-linear digital filter which improves noise reduction. A filter size of N would output the median value of the NxN neighborhood pixel values, for each pixel.

API Syntax

template<int FILTER_SIZE, int BORDER_TYPE, int TYPE, int ROWS, int COLS, int NPC, int XFCVDEPTH_IN = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT = _XFCVDEPTH_DEFAULT>
void medianBlur (xf::cv::Mat<TYPE, ROWS, COLS, NPC, XFCVDEPTH_IN> & _src, xf::cv::Mat<TYPE, ROWS, COLS, NPC, XFCVDEPTH_OUT> & _dst)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 649 Table . medianBlur Parameter Description
Parameter Description
FILTER_SIZE Window size of the hardware filter for which the hardware kernel will be built. This can be any odd positive integer greater than 1.
BORDER_TYPE The way in which borders will be processed in the hardware kernel. Currently, only XF_BORDER_REPLICATE is supported.
TYPE Input and Output pixel type. Only 8-bit, unsigned, 1 and 3 channels are supported (XF_8UC1 and XF_8UC3)
ROWS Number of rows in the image being processed.
COLS Number of columns in the image being processed. Must be a multiple of 8, for 8-pixel operation.
NPC Number of pixels to be processed in parallel. Options are XF_NPPC1 (for 1 pixel processing per clock), XF_NPPC8 (for 8 pixel processing per clock
XFCVDEPTH_IN Depth of the input image.
XFCVDEPTH_OUT Depth of the output image.
_src Input image.
_dst Output image.

Resource Utilization

The following table summarizes the resource utilization of the medianBlur function for XF_NPPC1 and XF_NPPC8 configurations, generated using Vivado HLS 2019.1 version tool for the Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 650 Table . medianBlur Function Resource Utilization Summary
Operating Mode FILTER_SIZE

Operating Frequency

(MHz)

Utilization Estimate
LUTs FFs DSPs BRAMs
1 pixel 3 300 1197 771 0 3
8 pixel 3 150 6559 1595 0 6
1 pixel 5 300 5860 1886 0 5

The following table summarizes the resource utilization of the medianBlur function for XF_NPPC1 with 3channel image as input, generated using Vivado HLS 2019.1 version tool for the Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 651 Table . medianBlur Function Resource Utilization Summary
Operating Mode FILTER_SIZE

Operating Frequency

(MHz)

Utilization Estimate
LUTs FFs DSPs BRAMs
1 pixel 3 300 2100 1971 0 9
1 pixel 5 300 13541 9720 0 15

Performance Estimate

The following table summarizes performance estimates of medianBlur function on Vivado HLS 2019.1 version tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 652 Table . medianBlur Function Performance Estimate Summary
Operating Mode FILTER_SIZE

Operating Frequency

(MHz)

Input Image Size Latency Estimate
Max (ms)
1 pixel 3 300 1920x1080 6.99
8 pixel 3 150 1920x1080 1.75
1 pixel 5 300 1920x1080 7.00