StrataQuest Home StrataQuest Glossary Anisotropic filter
Image Processing & Correction

Anisotropic filter

A partial differential equation evolved over the image — diffusion proceeds in flat regions, conductance vanishes at edges

View
Definition
Anisotropic filter implements the Perona-Malik partial differential equation: ∂I/∂t = ∇ · [g(|∇I|) · ∇I], where I(x, y, t) is the evolving image at time t, ∇I is the spatial gradient, and g is a non-increasing conductance function with g(0) = 1 and g(∞) = 0. The standard choices are g(s) = exp(−s²/K²) (the "exponential" form, used here) or g(s) = 1/(1 + s²/K²) (the "Lorentzian" form). The parameter K is the gradient threshold separating "interior" from "edge" — gradients smaller than K diffuse readily; gradients much larger than K diffuse essentially not at all. The equation is integrated forward in time by explicit finite differences with a step size λ ≤ 0.25 (4-neighbor scheme) for numerical stability; each iteration is one λ time step. Many iterations approach a piecewise-smooth steady state.
Edge-aware conductance — the math that makes it work
Diffusion fast in flat regions, slow at boundaries
K sets the boundary threshold
Smaller K → more edges preserved
Iterations approximate diffusion time
Time-step integration of the PDE
Connection to scale-space
Linear diffusion is the Gaussian; nonlinear diffusion is its edge-aware analog

The math, in two registers

The Perona-Malik equation:

∂I(x, y, t)/∂t = div[g(|∇I|) · ∇I]

Here I(x, y, t) is the evolving image (note the explicit time variable — the image is a function of space and "diffusion time"), ∇I is the 2D spatial gradient (∂I/∂x, ∂I/∂y), and div is the divergence operator (∂/∂x · v_x + ∂/∂y · v_y). The conductance g takes the gradient magnitude and returns a scalar between 0 and 1; the standard exponential form is g(s) = exp(−s²/K²).

Expanding the divergence:

∂I/∂t = ∂/∂x [g(|∇I|) · ∂I/∂x] + ∂/∂y [g(|∇I|) · ∂I/∂y]

The discretization on a 4-neighbor stencil approximates each term by central finite differences. With a time step λ, an iteration of forward Euler is:

I^{t+1}(x, y) = I^t(x, y) + λ · [g(∇N) · ∇N + g(∇S) · ∇S + g(∇E) · ∇E + g(∇W) · ∇W]

where ∇N = I(x, y−1) − I(x, y), and analogously for south/east/west. Each direction is treated independently; the conductance is evaluated separately for each neighbor based on the directed difference. Stability for this scheme requires λ ≤ 0.25 — the standard CFL condition for explicit diffusion schemes.

The mathematical content of the conductance function: g(s) = exp(−s²/K²) has a Gaussian shape in s, dropping smoothly from 1 to 0 as s grows. At s = K, g = 1/e ≈ 0.37. At s = 2K, g ≈ 0.018 — diffusion is essentially zero. K is the natural scale separating the two regimes. The alternative Lorentzian form g(s) = 1/(1 + (s/K)²) has a heavier tail (drops more slowly past K), producing slightly more diffusion across moderate edges. Both forms have the same asymptotic behavior at s = 0 and s = ∞; the choice between them changes the character of diffusion at intermediate gradients.

An interesting theoretical point: the original Perona-Malik formulation is ill-posed in the continuous limit — the equation admits non-unique solutions and can develop instabilities. Practical implementations rely on the discretization providing implicit regularization; a more principled approach uses the Catté regularization, evaluating the conductance on a Gaussian-smoothed gradient instead of the raw gradient, which makes the problem well-posed without much practical effect on the output for reasonable noise levels.

Simplified

The underlying idea is a heat equation with a twist. Ordinary heat conduction smooths a temperature distribution by letting heat flow from hot regions to cold ones at a rate proportional to the temperature gradient. The math is: rate of change at each point = conductivity × (how curved the temperature is locally).

For images, the same equation with constant conductivity produces Gaussian blurring — every edge softens, every fine detail disappears. Perona-Malik's insight: make the conductivity itself depend on the local gradient. Where the gradient is small (a flat region), conductivity is near 1 and diffusion proceeds normally — noise smooths out. Where the gradient is large (an edge), conductivity drops near 0 and almost no diffusion happens — the edge stays sharp.

The parameter K controls the threshold between these regimes. Pick K above the typical noise level but below the typical edge gradient, and the filter cleanly separates one from the other. Then run for some number of iterations — each iteration is one small time step of the diffusion process. More iterations → more smoothing within regions; the edges hold throughout.

How it differs from Bilateral, in practice and in math

Bilateral filterLoading... also preserves edges while smoothing — but via a single-pass weighted average with weights that depend on both spatial distance and intensity similarity. The two approaches are mathematically distinct: Bilateral is a non-iterative kernel filter (each output depends on a fixed neighborhood in the original); Anisotropic is an iterative PDE solver (each output depends on the entire history of evolution).

Practical consequences: Bilateral is single-pass and runs faster per call. Anisotropic produces smoother interiors for the same edge preservation when run for enough iterations — the iterative refinement converges toward a piecewise-constant image. The choice between them is often empirical, but a useful heuristic: prefer Bilateral when the noise is light and the goal is to preserve detail; prefer Anisotropic when the noise is heavy and the goal is segmentation-like smoothing of regions.

Anisotropic also generalizes more naturally to other domains. Variants exist for vector-valued images (color, multi-channel fluorescence), for 3D volumes, and with directional conductance (a tensor instead of a scalar) — leading to coherence-enhancing diffusion for fiber-like structures.

Share This Term
Term Connections