IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Gaussian Gradient 2dSee full documentation
xGradImg,yGradImggaussianGradient2dImg (inImg,inStdDev)
xGradImg,yGradImggaussianGradient2dImg (inImg,inStdDevX,inStdDevY,inOptGradientGaussianCoverage)
imagegaussianXGradient2dImg (inImg,inStdDev)
imagegaussianYGradient2dImg (inImg,inStdDev)

Detailed Description

Compute X and Y gradients of an input image convolving it with 2d Gaussian kernels.

Used Gaussian gradient kernel $GaussKnl^{X}_{XY}$ and $GaussKnl^{Y}_{XY}$ coefficients are defined as follow :

\[ GaussKnl^{X}_{XY}[o_x, o_y] = -\dfrac{o_x}{2\pi\sigma^4}e^{-\dfrac{o_x^2+o_y^2}{2\sigma^2}} \]

\[ GaussKnl^{Y}_{XY}[o_x, o_y] = -\dfrac{o_y}{2\pi\sigma^4}e^{-\dfrac{o_x^2+o_y^2}{2\sigma^2}} \]

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}e^{-\dfrac{o_x^2}{2\sigma^2}} \]

On output image values are given by:

\[ OutOptGradXImg[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^{X}_{XY}[o_x, o_y]}} \]

\[ OutOptGradYImg[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^{Y}_{XY}[o_x, o_y]}} \]

A detailled analysis of this filter has been done in J. Canny (1986) "A computational approach to edge detection", IEEE Trans. Pattern Analysis and Machine Intelligence, vol 8, pages 679-714.

Output images OutOptGradXImg and OutOptGradYImg are optional (at least one must be provided). Input and output images must have same size.

Here is an example of a Gaussian gradient operation applied to an 8-bits grey levels input image (with $InStdDev=3$):

gaussianGradient2d.png
See also
http://en.wikipedia.org/wiki/Edge_detection#cite_note-8

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# gaussian gradient filter 2d computation
outGxImg, outGyImg = filter.gaussianGradient2dImg(inImg, 1.5)

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// compute gaussian gradient on input image
GradientXYImg gradientXY = gaussianGradient2dImg(pInImg, inStdDev, inStdDev, createGaussianCoverage(inOptGaussianRatio, minHalfKernelSize));