IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Sobel Gradient 2dSee full documentation
xGradImg,yGradImgsobelGradient2dImg (inImg)
xGradImg,yGradImgsobelGradient2dImg (inImg,kernelType,bNormalize)
imagesobelXGradient2dImg (inImg)
imagesobelXGradient2dImg (inImg,kernelType,bNormalize)
imagesobelYGradient2dImg (inImg)
imagesobelYGradient2dImg (inImg,kernelType,bNormalize)

Detailed Description

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

2d Sobel kernels are separable, they can be decomposed as the product of a row vector and a column vector. X gradient kernel equals to the product of the smoothing (column) vector with the derivative (row) vector, while Y gradient kernel equals to the product of the derivative (column) vector with the smoothing (row) vector. Depending on the value of parameter $InOptSobelKernelType$ (default value: eSKT_SobelHalfKnlSz1), smoothing and derivative vectors equal to:

To handle image borders, a mirror extrapolation is used (see Border policy for more details).

Here is an example of a Sobel gradient applied to an 8-bits grey levels input image with default parameters used:

sobelGradient2d.png
See also
https://en.wikipedia.org/wiki/Sobel_operator

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

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

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image from TIFF file
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// applying Sobel gradient to input image
GradientXYImg gradientXY = sobelGradient2dImg(pInImg);