IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

bilateral filter on 2d image More...

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::bilateral2dImg (const image::ImageConstPtr &pInImg, const ipReal64 inSpaceSigma, const ipReal64 inRangeSigma)
 wrapper function for bilateral filter on 2d image (tabulated exponential implementation) More...
 
IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::bilateral2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSize, const ipReal64 inSpaceSigma, const ipReal64 inRangeSigma)
 wrapper function for bilateral filter on 2d image (tabulated exponential implementation) More...
 
IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::bilateral2dImg (const image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSize, const ipReal64 inSpaceSigma, const ipReal64 inRangeSigma, const image::ImagePtr &pOutImg)
 wrapper function for bilateral filter on 2d image (tabulated exponential implementation) More...
 

Detailed Description

bilateral filter on 2d 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] = \dfrac { \sum_{o_y=-n}^{n}{\sum_{o_x=-n}^{n}{W(x, y, o_x, o_y)*InImg[x+o_x, y+o_y]}} } { \sum_{o_y=-n}^{n}{\sum_{o_x=-n}^{n}{W(x, y, o_x, o_y)}} } \]

where:

Input and output images must have same size.

Here is an example of a bilaterial filter applied to an 8-bits grey levels input image (with $\sigma_S=10.0$ and $\sigma_R=50.0$) :

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InRangeSigma [Input] sigma for range gaussian function X
ipsdk::imaproc::attr::InSpaceSigma [Input] sigma for spatial gaussian function X
ipsdk::imaproc::attr::InOptHalfKnlSize [Input Optional] half kernel size (square or cubic kernel) X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg,_pOutImg)

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 2d computation
outImg = filter.bilateral2dImg(inImg, 5, 3)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFiltering

Header file

Code Example

// definition of a custom output geometry
ImageGeometryPtr pOutImageGeometry =
geometry2d(outImageBufferType,
pInImg->getSizeX(),
pInImg->getSizeY());
// creation of output image
boost::shared_ptr<MemoryImage> pOutImg = boost::make_shared<MemoryImage>();
pOutImg->init(*pOutImageGeometry);
// compute bilateral filter on input image
bilateral2dImg(pInImg, inHalfKnlSize, inSpaceSigma, inRangeSigma, pOutImg);
See also
Bilateral2dImgLvl1
Bilateral2dImgLvl2
Bilateral2dImgLvl3

Function Documentation

◆ bilateral2dImg() [1/3]

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::bilateral2dImg ( const image::ImageConstPtr pInImg,
const ipReal64  inSpaceSigma,
const ipReal64  inRangeSigma 
)

wrapper function for bilateral filter on 2d image (tabulated exponential implementation)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ bilateral2dImg() [2/3]

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::bilateral2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSize,
const ipReal64  inSpaceSigma,
const ipReal64  inRangeSigma 
)

wrapper function for bilateral filter on 2d image (tabulated exponential implementation)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ bilateral2dImg() [3/3]

IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::bilateral2dImg ( const image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSize,
const ipReal64  inSpaceSigma,
const ipReal64  inRangeSigma,
const image::ImagePtr pOutImg 
)

wrapper function for bilateral filter on 2d image (tabulated exponential implementation)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure