IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Unsharp Mask 2dSee full documentation
imageunsharpMask2dImg (inImg,inBlurWeight,inStdDev)
imageunsharpMask2dImg (inImg,inBlurWeight,inStdDev,inOptSmoothingGaussianCoverage)

Detailed Description

unsharp mask filtering of input 2d image

Unsharp mask filter is an image sharpening filter which uses a blurred (so unsharped) image to create a mask of the original image. This unsharp mask is then combined with original image to enhance high frequencies (edges) of input image. An undesirable side effect of this filter is an increase of noise in output image.

Given a gaussian smoothing operation on an input image $InImg$ using standard deviation $\sigma=InStdDev$ :

\[ G_{\sigma}(InImg[x, y]) = \sum_{o_y=-\dfrac{n_y}{2}}^{\dfrac{n_y}{2}}{\sum_{o_x=-\dfrac{n_x}{2}}^{\dfrac{n_x}{2}}{InImg[x+o_x, y+o_y] \times GaussKnl^{\sigma}_{XY}[o_x, o_y]}} \]

(see Gaussian Smoothing 2d for more informations)

Unsharp mask filtering of input image with blur weight $w=InBlurWeight \in ]0;1]$ is given by :

\[ OutImg = \dfrac{w+1}{2w}InImg + \dfrac{w-1}{2w}G_{\sigma}(InImg) \]

Here is an example of a unsharp mask operation applied to an 8-bits grey levels input image (with $InStdDev=5$ and $InBlurWeight=0.5$) :

unsharpMask2d.png

(image by Ru_dagon (Own work) [GFDL (http://www.gnu.org/copyLeft/fdl.html), CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/ ), via Wikimedia Commons])

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

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# unsharp mask 2d computation
outImg = filter.unsharpMask2dImg(inImg, 0.7, 1.0)

Example of C++ code :

Example informations

Header file

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

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// compute unsharp mask filter on input image
ImagePtr pOutImg1 = unsharpMask2dImg(pInImg, 0.7f, 1.0f);