Bilateral Filter
The bilateral filter applied on an image is:

Where

and
is a gaussian
filter with variance
.
The gaussian filter is given by: and
API Syntax
template<int FILTER_SIZE, int BORDER_TYPE, int TYPE, int ROWS, int COLS, int NPC=1>
void xFBilateralFilter (
xF::Mat<int TYPE, int ROWS, int COLS, int NPC> src,
xF::Mat<int TYPE, int ROWS, int COLS, int NPC> dst,
float sigma_space, float sigma_color )
Parameter Descriptions
The following table describes the template and the function parameters.
| Parameter | Description |
|---|---|
| FILTER_SIZE | Filter size. Filter size of 3 (XF_FILTER_3X3), 5 (XF_FILTER_5X5) and 7 (XF_FILTER_7X7) are supported |
| BORDER_TYPE | Border type supported is XF_BORDER_CONSTANT |
| TYPE | Input and output pixel type. Only 8-bit, unsigned, 1 channel is supported (XF_8UC1) |
| ROWS | Maximum height of input and output image (must be a multiple of 8) |
| COLS | Maximum width of input and output image (must be a multiple of 8) |
| NPC | Number of pixels to be processed per cycle; this function supports only XF_NPPC1 or 1 pixel per cycle operations. |
| src | Input image |
| dst | Output image |
| sigma_space | Standard deviation of filter is spatial domain |
| sigma_color | Standard deviation of filter used in color space |
Resource Utilization
The following table summarizes the resource utilization of the kernel in different configurations, generated using Vivado HLS 2017.1 version tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA, to progress a grayscale HD (1080x1920) image.
| Operating Mode | Filter Size |
Operating Frequency (MHz) |
Utilization Estimate | |||
|---|---|---|---|---|---|---|
| BRAM_18K | DSP_48Es | FF | LUT | |||
| 1 pixel | 3x3 | 300 | 6 | 22 | 4934 | 4293 |
| 5x5 | 300 | 12 | 30 | 5481 | 4943 | |
| 7x7 | 300 | 37 | 48 | 7084 | 6195 | |
Performance Estimate
The following table summarizes a performance estimate of the kernel in different configurations, as generated using Vivado HLS 2017.1 tool for Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image.
| Operating Mode | Filter Size | Latency Estimate |
|---|---|---|
| 168 MHz | ||
| Max (ms) | ||
| 1 pixel | 3x3 | 7.18 |
| 5x5 | 7.20 | |
| 7x7 | 7.22 |
Deviation from OpenCV
Unlike OpenCV, xfOpenCV only supports filter sizes of 3, 5 and 7.