The OpenVX Specification  dba1aa3
Bilateral Filter

Detailed Description

The function applies bilateral filtering to the input tensor.

A bilateral filter is a non-linear, edge-preserving and noise-reducing smoothing filter. The input and output are tensors with the same dimensions and data type. The tensor dimensions are divided to spatial and non spatial dimensions. The spatial dimensions are isometric distance which is Cartesian. And they are the last 2. The non spatial dimension is the first, and we call him the radiometric. The radiometric value at each spatial position is replaced by a weighted average of radiometric values from nearby pixels. This weight can be based on a Gaussian distribution. Crucially, the weights depend not only on Euclidean distance of spatial dimensions, but also on the radiometric differences (e.g. range differences, such as color intensity, depth distance, etc.). This preserves sharp edges by systematically looping through each pixel and adjusting weights to the adjacent pixels accordingly The equations are as follows:

\[h(x,\tau)=\sum f(y,t)g_ {1}(y-x)g_{2}(t-\tau)dydt\]

\[g_{1}=\frac{1}{\sqrt{2\pi\sigma_{y}}}\exp\left(-\frac{1} {2}\left(\frac{y^{2}}{\sigma_{y}^{2}}\right)\right)\]

\[g_{2}(t)=\frac{1}{\sqrt{2\pi\sigma_{t}}}\exp\left(-\frac{1} {2}\left(\frac{t^{2}}{\sigma_{t}^{2}}\right)\right)\]

where \(x\), \(y\) are in the spatial euclidean space. \(t\), \(\tau\) are vectors in radiometric space. Can be color, depth or movement. In case of 3 dimensions the 1st dimension of the vx_tensor. Which can be of size 1 or 2. Or the value in the tensor in the case of tensor with 2 dimensions.

Functions

vx_node VX_API_CALL vxBilateralFilterNode (vx_graph graph, vx_tensor src, vx_int32 diameter, vx_float32 sigmaSpace, vx_float32 sigmaValues, vx_tensor dst)
 [Graph] The function applies bilateral filtering to the input tensor. More...
 
vx_status VX_API_CALL vxuBilateralFilter (vx_context context, vx_tensor src, vx_int32 diameter, vx_float32 sigmaSpace, vx_float32 sigmaValues, vx_tensor dst)
 [Immediate] The function applies bilateral filtering to the input tensor. More...
 

Function Documentation

vx_node VX_API_CALL vxBilateralFilterNode ( vx_graph  graph,
vx_tensor  src,
vx_int32  diameter,
vx_float32  sigmaSpace,
vx_float32  sigmaValues,
vx_tensor  dst 
)

[Graph] The function applies bilateral filtering to the input tensor.

Parameters
[in]graphThe reference to the graph.
[in]srcThe input data a vx_tensor. maximum 3 dimension and minimum 2. The tensor is of type VX_TYPE_UINT8 or VX_TYPE_INT16. dimensions are [radiometric ,width,height] or [width,height].See vxCreateTensor and vxCreateVirtualTensor.
[in]diameterof each pixel neighbourhood that is used during filtering. Values of diameter must be odd. Bigger then 3 and smaller then 10.
[in]sigmaValuesFilter sigma in the radiometric space. Supported values are bigger then 0 and smaller or equal 20.
[in]sigmaSpaceFilter sigma in the spatial space. Supported values are bigger then 0 and smaller or equal 20.
[out]dstThe output data a vx_tensor,Of type VX_TYPE_UINT8 or VX_TYPE_INT16. And must be the same type and size of the input.
Note
The border modes VX_NODE_BORDER value VX_BORDER_REPLICATE and VX_BORDER_CONSTANT are supported.
Returns
vx_node.
Return values
vx_nodeA node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus
vx_status VX_API_CALL vxuBilateralFilter ( vx_context  context,
vx_tensor  src,
vx_int32  diameter,
vx_float32  sigmaSpace,
vx_float32  sigmaValues,
vx_tensor  dst 
)

[Immediate] The function applies bilateral filtering to the input tensor.

Parameters
[in]contextThe reference to the overall context.
[in]srcThe input data a vx_tensor. maximum 3 dimension and minimum 2. The tensor is of type VX_TYPE_UINT8 or VX_TYPE_INT16. dimensions are [radiometric ,width,height] or [width,height]
[in]diameterof each pixel neighbourhood that is used during filtering. Values of diameter must be odd. Bigger then 3 and smaller then 10.
[in]sigmaValuesFilter sigma in the radiometric space. Supported values are bigger then 0 and smaller or equal 20.
[in]sigmaSpaceFilter sigma in the spatial space. Supported values are bigger then 0 and smaller or equal 20.
[out]dstThe output data a vx_tensor,Of type VX_TYPE_UINT8 or VX_TYPE_INT16. And must be the same type and size of the input.
Note
The border modes VX_NODE_BORDER value VX_BORDER_REPLICATE and VX_BORDER_CONSTANT are supported.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSSuccess
*An error occurred. See vx_status_e.