image = | convolution3dImg (inImg3d,inKnlXYZ,inNormalize) |
image = | convolution3dImg (inImg3d,inKnlXYZ,inNormalize,inOptConvolBorder3d) |
Compute convolution of an input 3d image with a kernel.
See Kernels for a detailled documentation of kernels creation and management tools.
Given an input 3d kernel :
Where :
defines "negative" part of kernel elements along x axis (elements before central element)
defines "positive" part of kernel elements along x axis (elements after central element)
defines "negative" part of kernel elements along y axis (elements before central element)
defines "positive" part of kernel elements along y axis (elements after central element)
defines "negative" part of kernel elements along z axis (elements before central element)
defines "positive" part of kernel elements along z axis (elements after central element)
defines kernel size along x axis
defines kernel size along y axis
defines kernel size along z axis
On output image values are given by:
Input kernel coefficients can be normalized during processing if
value is set to
. In this case previous formula is modified into :
with :
Case of
is handled forcing its value to
to avoid null division.
Neighborhood border policy is controlled by
parameter. This parameter allows to control starting and ending plans/rows/columns provided data during processing (see Border policy for more details).
Here is an example of a normalized convolution operation applied to an 8-bits grey levels input image with input kernel given by :
- See also
- http://en.wikipedia.org/wiki/Kernel_%28image_processing%29
-
http://en.wikipedia.org/wiki/Convolution
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inKnl = PyIPSDK.rectangularKernelXYZ(1, 2, 1, [1.5, 1.2, 1.4,
4.2, 7.0, 2.3,
3.5, 4.8, 7.5,
1.9, 2.3, 6.3,
9.5, 0.2, 4.1,
-1.5, -1.2, -1.4,
-4.2, -7.0, -2.3,
-3.5, -4.8, -7.5,
-1.9, -2.3, -6.3,
-9.5, -0.2, -4.1,
1.5, 1.2, 1.4,
4.2, 7.0, 2.3,
3.5, 4.8, 7.5,
1.9, 2.3, 6.3,
9.5, 0.2, 4.1])
outImg = filter.convolution3dImg(inImg, inKnl, True)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLFiltering/Processor/Convolution3dImg/Convolution3dImg.h>
Code Example
ImagePtr pOutImg;
if (pInOptConvolBorder3d.get() == 0)
pOutImg = convolution3dImg(pInImg, pInKnlXYZ, false);
else
pOutImg = convolution3dImg(pInImg, pInKnlXYZ, false, pInOptConvolBorder3d);