A high-performance general-purpose compute library

Anisotropic Smoothing Filter. More...

Functions

AFAPI array anisotropicDiffusion (const af::array &in, const float timestep, const float conductance, const unsigned iterations, const fluxFunction fftype=AF_FLUX_EXPONENTIAL, const diffusionEq diffusionKind=AF_DIFFUSION_GRAD)
 C++ Interface for gradient anisotropic(non-linear diffusion) smoothing. More...
 
AFAPI af_err af_anisotropic_diffusion (af_array *out, const af_array in, const float timestep, const float conductance, const unsigned iterations, const af_flux_function fftype, const af_diffusion_eq diffusion_kind)
 C Interface for anisotropic diffusion. More...
 

Detailed Description

Anisotropic Smoothing Filter.

Anisotropic diffusion algorithm aims at removing noise in the images while preserving important features such as edges. The algorithm essentially creates a scale space representation of the original image, where image from previous step is used to create a new version of blurred image using the diffusion process. Standard isotropic diffusion methods such as gaussian blur, doesn't take into account the local content(smaller neighborhood of current processing pixel) while removing noise. Anisotropic diffusion uses the flux equations given below to achieve that. Flux equation is the formula used by the diffusion process to determine how much a pixel in neighborhood should contribute to the blurring operation being done at the current pixel at a given iteration.

The flux function can be either exponential or quadratic.

Available Flux Functions
AF_FLUX_QUADRATIC \( \frac{1}{1 + (\frac{\| \nabla I\|}{K})^2} \)
AF_FLUX_EXPONENTIAL \( \exp{-(\frac{\| \nabla I\|}{K})^2} \)

Please be cautious using the time step parameter to the function. Appropriate time steps for solving this type of p.d.e. depend on the dimensionality of the image and the order of the equation. Stable values for most 2D and 3D functions are 0.125 and 0.0625, respectively. The time step values are automatically constrained to the stable value.

Another input parameter to be cautious about is the conductance parameter, lower values strongly preserve image features and vice-versa. For human vision, this value ranges from 0.5 to 2.0.

Reference

Pietro Perona and Jitendra Malik, Scale-space and edge detection using anisotropic diffusion, IEEE Transactions on Pattern Analysis Machine Intelligence, vol. 12, pp. 629-639, 1990.

Reference

R. Whitaker and X. Xue. Variable-Conductance, Level-Set Curvature for Image Denoising, International Conference on Image Processing, 2001 pp. 142-145, Vol.3.


Function Documentation

◆ af_anisotropic_diffusion()

AFAPI af_err af_anisotropic_diffusion ( af_array out,
const af_array  in,
const float  timestep,
const float  conductance,
const unsigned  iterations,
const af_flux_function  fftype,
const af_diffusion_eq  diffusion_kind 
)

C Interface for anisotropic diffusion.

It can do both gradient and curvature based anisotropic smoothing.

Parameters
[out]outis an af_array containing anisotropically smoothed image pixel values
[in]inis the input image, expects non-integral (float/double) typed af_array
[in]timestepis the time step used in solving the diffusion equation.
[in]conductanceparameter controls the sensitivity of conductance in diffusion equation.
[in]iterationsis the number of times the diffusion step is performed.
[in]fftypeindicates whether quadratic or exponential flux function is used by algorithm.
[in]diffusion_kindwill let the user choose what kind of diffusion method to perform. It will take any value of enum af_diffusion_eq
Returns
AF_SUCCESS if the moment calculation is successful, otherwise an appropriate error code is returned.

◆ anisotropicDiffusion()

AFAPI array anisotropicDiffusion ( const af::array in,
const float  timestep,
const float  conductance,
const unsigned  iterations,
const fluxFunction  fftype = AF_FLUX_EXPONENTIAL,
const diffusionEq  diffusionKind = AF_DIFFUSION_GRAD 
)

C++ Interface for gradient anisotropic(non-linear diffusion) smoothing.

Parameters
[in]inis the input image, expects non-integral (float/double) typed af::array
[in]timestepis the time step used in solving the diffusion equation.
[in]conductanceparameter controls the sensitivity of conductance in diffusion equation.
[in]iterationsis the number of times the diffusion step is performed.
[in]fftypeindicates whether quadratic or exponential flux function is used by algorithm.
[in]diffusionKindwill let the user choose what kind of diffusion method to perform. It will take any value of enum diffusionEq
Returns
A filtered image that is of same size as the input.