.. _Smoothing: Smoothing ========= Apply a smoothing filter to an image Description ----------- This application applies a smoothing filter to an image. Three methods can be used: a mean filter, a gaussian filter based on [1], or an anisotropic diffusion using the Perona-Malik algorithm [2]. Parameters ---------- .. contents:: :local: .. |br| raw:: html
.. |em| raw:: html   **Input Image** :code:`-in image` *Mandatory* |br| Input image to smooth. **Output Image** :code:`-out image [dtype]` *Mandatory* |br| Output smoothed image. **Smoothing Type** :code:`-type [mean|gaussian|anidif]` *Default value: anidif* |br| Smoothing kernel to apply * **Mean** |br| * **Gaussian** |br| * **Anisotropic Diffusion** |br| Mean options ^^^^^^^^^^^^ **Radius** :code:`-type.mean.radius int` *Default value: 2* |br| Kernel's radius (in pixels) Gaussian options ^^^^^^^^^^^^^^^^ **Standard deviation** :code:`-type.gaussian.stdev float` *Default value: 2* |br| Standard deviation of the gaussian kernel used to filter the image **Maximum error** :code:`-type.gaussian.maxerror float` *Default value: 0.01* |br| The algorithm will size the discrete kernel so that the error resulting from truncation of the kernel is no greater than maxerror. **Maximum kernel width** :code:`-type.gaussian.maxwidth int` *Default value: 32* |br| Set the kernel to be no wider than maxwidth pixels, even if type.gaussian.maxerror demands it. Anisotropic Diffusion options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **Time Step** :code:`-type.anidif.timestep float` *Default value: 0.125* |br| Time step that will be used to discretize the diffusion equation **Nb Iterations** :code:`-type.anidif.nbiter int` *Default value: 10* |br| Number of iterations needed to get the result **Conductance** :code:`-type.anidif.conductance float` *Default value: 1* |br| Controls the sensitivity of the conductance term in the diffusion equation. The lower it is the stronger the features will be preserved ------------ **Available RAM (MB)** :code:`-ram int` *Default value: 256* |br| Available memory for processing (in MB). Examples -------- From the command-line: .. code-block:: bash # Image smoothing using a mean filter. otbcli_Smoothing -in Romania_Extract.tif -out smoothedImage_mean.png uchar -type mean # Image smoothing using an anisotropic diffusion filter. otbcli_Smoothing -in Romania_Extract.tif -out smoothedImage_ani.png float -type anidif -type.anidif.timestep 0.1 -type.anidif.nbiter 5 -type.anidif.conductance 1.5 From Python: .. code-block:: python # Image smoothing using a mean filter. import otbApplication app = otbApplication.Registry.CreateApplication("Smoothing") app.SetParameterString("in", "Romania_Extract.tif") app.SetParameterString("out", "smoothedImage_mean.png") app.SetParameterOutputImagePixelType("out", 1) app.SetParameterString("type","mean") app.ExecuteAndWriteOutput() .. code-block:: python # Image smoothing using an anisotropic diffusion filter. import otbApplication app = otbApplication.Registry.CreateApplication("Smoothing") app.SetParameterString("in", "Romania_Extract.tif") app.SetParameterString("out", "smoothedImage_ani.png") app.SetParameterOutputImagePixelType("out", 6) app.SetParameterString("type","anidif") app.SetParameterFloat("type.anidif.timestep", 0.1) app.SetParameterInt("type.anidif.nbiter", 5) app.SetParameterFloat("type.anidif.conductance", 1.5) app.ExecuteAndWriteOutput() See also -------- | :ref:`FastNLMeans` | [1] Tony Lindeberg Discrete Scale-Space Theory and the Scale-Space Primal Sketch. Dissertation. Royal Institute of Technology, Stockholm, Sweden. May 1991 | [2] 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. | itk::MeanImageFilter (mean mode) | itk::DiscreteGaussianImageFilter (gaussian mode) | itk::GradientAnisotropicDiffusionImageFilter (anidif mode).