IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Bilateral smoothing 3dSee full documentation
imagebilateral3dImg (inImg,inSpaceSigma,inRangeSigma)
imagebilateral3dImg (inImg,inHalfKnlSize,inSpaceSigma,inRangeSigma)

Detailed Description

bilateral filter on 3d image

The bilateral filter is a non-linear smoothing filter that has good properties of edge-preserving. Each pixel value is replaced by a weighted average of the values of its neighbours. The weight is a product of two gaussian functions, one depending on the euclidian distance between the central pixel and its current neighbour, the other depending on the difference of the intensities of these 2 pixels.

On output image values are given by:

\[ OutImg[x, y, z] = \dfrac { \sum_{o_z=-n}^{n}{\sum_{o_y=-n}^{n}{\sum_{o_x=-n}^{n}{W(x, y, z, o_x, o_y, o_z) \times InImg[x+o_x, y+o_y, z+o_z]}}} } { \sum_{o_z=-n}^{n}{\sum_{o_y=-n}^{n}{\sum_{o_x=-n}^{n}{W(x, y, z, o_x, o_y, o_z)}}} } \]

where:

Input and output images must have same size.

See Bilateral smoothing 2d for an illustration of bilateral filter applied to a 2d image.

See also
http://en.wikipedia.org/wiki/Bilateral_filter

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# bilateral filter 3d computation
outImg = filter.bilateral3dImg(inImg, 5, 3)

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// definition of a custom output geometry
ImageGeometryPtr pOutImageGeometry = geometry3d(
outImageBufferType,
pInImg->getSizeX(),
pInImg->getSizeY(),
pInImg->getSizeZ());
// creation of output image
boost::shared_ptr<MemoryImage> pOutImg = boost::make_shared<MemoryImage>();
pOutImg->init(*pOutImageGeometry);
// compute bilateral filter on input image
bilateral3dImg(pInImg, inHalfKnlSize, inSpaceSigma, inRangeSigma, pOutImg);