Skip to content

ximgproc_anisotropicDiffusion

Extended image processingfunctionOpenCV 5.0.0
import { ximgproc_anisotropicDiffusion } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSsrc, dst, alpha, K
FUNCTIONximgproc_anisotropicDiffusion
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Performs anisotropic diffusion on an image.

The function applies Perona-Malik anisotropic diffusion to an image. This is the solution to the partial differential equation:

{\frac  {\partial I}{\partial t}}={\mathrm  {div}}\left(c(x,y,t)\nabla I\right)=\nabla c\cdot \nabla I+c(x,y,t)\Delta I

Suggested functions for c(x,y,t) are:

c\left(\|\nabla I\|\right)=e^{{-\left(\|\nabla I\|/K\right)^{2}}}

or

 c\left(\|\nabla I\|\right)={\frac {1}{1+\left({\frac  {\|\nabla I\|}{K}}\right)^{2}}} 
ximgproc_anisotropicDiffusion(src: Mat, dst: Mat, alpha: number, K: number, niters: number): void;
src

Source image with 3 channels.

dst

Output destination, filled by the native operation. Destination image of the same size and the same number of channels as src .

alpha

The amount of time to step forward by on each iteration (normally, it's between 0 and 1).

K

sensitivity to the edges

niters

The number of iterations

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.