Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# imdiffuseest

Estimate parameters for anisotropic diffusion filtering

## Syntax

``[gradientThreshold,numberOfIterations] = imdiffuseest(I)``
``[gradientThreshold,numberOfIterations] = imdiffuseest(I,Name,Value)``

## Description

example

````[gradientThreshold,numberOfIterations] = imdiffuseest(I)` estimates the gradient threshold and number of iterations required to filter the grayscale image `I` using anisotropic diffusion.```
````[gradientThreshold,numberOfIterations] = imdiffuseest(I,Name,Value)` uses name-value pairs to change the behavior of the anisotropic diffusion algorithm.```

## Examples

collapse all

Read a grayscale image, then apply strong Gaussian noise to it. Display the noisy image.

```I = imread('pout.tif'); Inoisy = imnoise(I,'gaussian',0,0.005); imshow(Inoisy) title('Noisy Image')```

Estimate the gradient threshold and number of iterations needed to perform anisotropic diffusion filtering of the image.

`[gradThresh,numIter] = imdiffuseest(Inoisy)`
```gradThresh = 1x5 uint8 row vector 64 50 39 34 29 ```
```numIter = 5 ```

Filter the noisy image by using anisotropic diffusion with the estimated parameters.

```Idiffuseest = imdiffusefilt(Inoisy,'GradientThreshold', ... gradThresh,'NumberOfIterations',numIter);```

For comparison, also filter the noisy image by using anisotropic diffusion with the default parameters. The default gradient threshold is 25.5 because the data type of the image is `uint8`, and the default number of iterations is 5.

`Idiffusedef = imdiffusefilt(Inoisy);`

Visually compare the two filtered images.

``` montage({Idiffusedef,Idiffuseest},'ThumbnailSize',[]) title(['Anisotropic Diffusion Filtering Using ' ... 'Default Parameters (Left) vs. Estimated Parameters (Right)'])```

Some noise remains in the image that was filtered using default parameters. The noise is almost completely absent from the image that was filtered using estimated parameters. The sharpness of edges in both images, especially high-contrast edges such as the trellis and white collar, is preserved.

## Input Arguments

collapse all

Image to be filtered, specified as a 2-D grayscale image.

Data Types: `single` | `double` | `int16` | `uint8` | `uint16`

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `imdiffuseest(I,'Connectivity','minimal')` estimates parameters required for anisotropic diffusion on image `I`, using minimal connectivity.

Connectivity of a pixel to its neighbors, specified as the comma-separated pair consisting of `'Connectivity'` and `'maximal'` or `'minimal'`. Maximal connectivity considers eight nearest neighbors and minimal connectivity considers four nearest neighbors.

Conduction method, specified as the comma-separated pair consisting of `'ConductionMethod'` and `'exponential'` or `'quadratic'`. Exponential diffusion favors high-contrast edges over low-contrast edges. Quadratic diffusion favors wide regions over smaller regions.

## Output Arguments

collapse all

Gradient threshold, returned as a numeric vector of the same data type as the input image, `I`. The length of the vector is equal to `numberOfIterations`.

Number of iterations to use in the diffusion process, returned as a positive integer.

## References

[1] Perona, P., and J. Malik. "Scale-space and edge detection using anisotropic diffusion." IEEE® Transactions on Pattern Analysis and Machine Intelligence. Vol. 12, No. 7, July 1990, pp. 629–639.

[2] Tsiotsios, C., and M. Petrou. "On the choice of the parameters for anisotropic diffusion in image processing." Pattern Recognition. Vol. 46, No. 5, May 2013, pp. 1369–1381.