image = | morphoGradient3dImg (inImg3d,inSEXYZ) |
gradient computation on a 3d image using morphological operations
A morphological gradient is the difference between the dilation and the erosion of a given image. It is a fast way to compute the gradient of an image. Output image pixel values, given a structuring element
, are given by the following formula :
- Note
- Behavior of this algorithm is specialized using specific morphological structuring elements (see 3d structuring elements for more informations about these shapes).
Please refer to Usage for examples of usage of different types of specific structuring elements during morphological operations.
An example of morphological gradient operation is illustrated in 2d case : see Morphological Gradient 2d.
- See also
- http://en.wikipedia.org/wiki/Morphological_gradient
- Note
- This algorithm is associated with two temporary working images ipsdk::imaproc::attr::OutOptWk1Img and ipsdk::imaproc::attr::OutWk1Img.
- The first one (ipsdk::imaproc::attr::OutOptWk1Img) is only used in special processing cases defined via ipsdk::imaproc::morpho::eSEProcessingCase enumerate. Such situation can be tested using ipsdk::imaproc::morpho::getSEProcessingCase function and associated image buffer type can be retrieved using ipsdk::imaproc::morpho::getSEWkImageBufferType. This working temporary image can be provided by user or will be automatically allocated when requested.
- The second one (ipsdk::imaproc::attr::OutWk1Img) is systematically needed for internal processing. This working temporary image can be provided by user or will be automatically allocated.
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLBasicMorphology as morpho
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inSE = PyIPSDK.sphericalSEXYZInfo(2)
outImg = morpho.morphoGradient3dImg(inImg, inSE)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLBasicMorphology/Processor/MorphoGradient3dImg/MorphoGradient3dImg.h>
Code Example
ImagePtr pOutImg = morphoGradient3dImg(pInImg, pInSEXYZ);