Median Blur Filter
The function xFMedianBlur 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>
void xFMedianBlur (xF::Mat<TYPE, ROWS, COLS, NPC> & _src, xF::Mat<TYPE, ROWS, COLS, NPC> & _dst)
Parameter Descriptions
The following table describes the template and the function parameters.
| 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 | Type of input pixel. XF_8UC1 is supported. |
| ROWS | Number of rows in the image being processed. |
| COLS | Number of columns in the image being processed. |
| 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 |
| _src | Input image. |
| _dst | Output image. |
Resource Utilization
The following table summarizes the resource utilization of the xFMedianBlur function for XF_NPPC1 and XF_NPPC8 configurations, generated using Vivado HLS 2017.1 version tool for the Xilinx Xc7z020clg484-1 FPGA.
| 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 |
Performance Estimate
The following table summarizes performance estimates of xFMedianBlur function on Vivado HLS 2017.1 version tool for the Xilinx xczu9eg-ffvb1156-1-i-es1 FPGA.
| 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 |