IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Mean Smoothing 2dSee full documentation
imagemeanSmoothing2dImg (inImg,inHalfKnlSizeX,inHalfKnlSizeY)

Detailed Description

Smooth an input 2d image computing local mean of pixels.

This low-pass 2d filter, also known as "box blur filter" or "box linear filter", computes for each pixel the average value of its neighboring pixels.

On output image values are given by:

\[ OutImg[x, y] = \dfrac{\sum_{o_y=-n_y}^{n_y}{\sum_{o_x=-n_x}^{n_x}{InImg[x+o_x, y+o_y]}}}{(2n_x+1)(2n_y+1)} \]

where :

Input and output images must have same size.

Here is an example of a Mean smoothing operation applied to an 8-bits grey levels input image (with $InHalfKnlSizeX=InHalfKnlSizeY=7$) :

meanSmoothing2d.png
See also
http://en.wikipedia.org/wiki/Box_blur

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# mean smoothing filter 2d computation
outImg = filter.meanSmoothing2dImg(inImg, 3, 3)

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image
ImageGeometryPtr pImageGeometry = geometry2d(imageBufferType, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pInImg(boost::make_shared<MemoryImage>());
pInImg->init(*pImageGeometry);
randomImg(createRange(0, 150), pInImg);
// compute gaussian smoothing on input image
ImagePtr pOutImg = meanSmoothing2dImg(pInImg, inHalfKnlSizeX, inHalfKnlSizeY);