# [−][src]Function arrayfire::anisotropic_diffusion

pub fn anisotropic_diffusion<T>(

img: &Array<T>,

dt: f32,

k: f32,

iters: u32,

fftype: FluxFn,

diff_kind: DiffusionEq

) -> Array<T::AbsOutType> where

T: HasAfEnum + EdgeComputable,

T::AbsOutType: HasAfEnum,

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.

AF_FLUX_QUADRATIC | \begin{equation} \frac{1}{1 + (\frac{\| \nabla I\|}{K})^2} \end{equation} |

AF_FLUX_EXPONENTIAL | \begin{equation} \exp{-(\frac{\| \nabla I\|}{K})^2} \end{equation} |

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.

# Parameters

`img`

is the noisy input image`dt`

is the timestep for diffusion equation`k`

is the conductance parameter for diffusion`iters`

is the number of iterations diffusion is performed`fftype`

dictates the type of flux flow and it is an enum`diff_kind`

dictates the type of diffusion and it is an enum

# Return Values

Returns an anisotropically smoothed and noise-free image

### References

- 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. - R. Whitaker and X. Xue.
`Variable-Conductance, Level-Set Curvature for Image Denoising`

, International Conference on Image Processing, 2001 pp. 142-145, Vol.3.