IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Gaussian Smoothing 2d
imagegaussianSmoothing2dImg (inImg,inStdDev)
imagegaussianSmoothing2dImg (inImg,inStdDevX,inStdDevY,inOptSmoothingGaussianCoverage)

Detailed Description

Smooth an input image convolving it with a 2d Gaussian kernel.

Used Gaussian kernel $GaussKnl_{XY}$ coefficients are defined as follow :

\[ GaussKnl_{XY}[o_x, o_y] = \dfrac{1}{2\pi\sigma_x\sigma_y}e^{-\dfrac{1}{2}\left(\dfrac{o_x^2}{\sigma_x^2}+\dfrac{o_y^2}{\sigma_y^2}\right)} \]

where :

Size $[n_x, n_y]$ of this finite kernel is controlled by InOptGradientGaussianCoverage attribute.
This parameter defined the minimum distribution spread ratio which should be reach regards to an infinite Gaussian distribution.
We define for example $n_x$ such that :

\[ n_x = \max(MinHalfKernelSize, \min(\{n\}\in \mathbb{N}^+) / \sum_{o_x=-\dfrac{n_x}{2}}^{\dfrac{n_x}{2}}{GaussKnl_X[o_x]}>= GaussianRatio \times \sum_{o_x=-\infty}^{+\infty}{GaussKnl_X[o_x]}) \]

where :

\[ GaussKnl_X[o_x] = \dfrac{1}{\sqrt{2\pi}\sigma_x}e^{-\dfrac{o_x^2}{2\sigma_x^2}} \]

On output image values are given by:

\[ OutImg[x, y] = \sum_{o_y=-\dfrac{n_y}{2}}^{\dfrac{n_y}{2}}{\sum_{o_x=-\dfrac{n_x}{2}}^{\dfrac{n_x}{2}}{InImg[x+o_x, y+o_y] \times GaussKnl_{XY}[o_x, o_y]}} \]

Input and output images must have same size.

Here is an example of a Gaussian smoothing operation applied to an 8-bits grey levels input image (with $InStdDevX=InStdDevY=7$):

gaussianSmoothing2d.png
See also
http://en.wikipedia.org/wiki/Gaussian_filter
http://en.wikipedia.org/wiki/Gaussian_blur

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# gaussian smoothing filter 2d computation
outImg = filter.gaussianSmoothing2dImg(inImg, 1.5)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLFiltering/Processor/GaussianSmoothing2dImg/GaussianSmoothing2dImg.h>

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// compute gaussian smoothing on input image
ImagePtr pOutImg = gaussianSmoothing2dImg(pInImg, inStdDevX, inStdDevY, createGaussianCoverage(inOptGaussianRatio, minHalfKernelSize));