IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Linear normalizationSee full documentation
imagenormalizeImg (inImg,inputRange,outputRange)
imagenormalizeImg (inImg,outputRange)

Detailed Description

normalizes the intensity of an image from an optional given input range $InOptInputRange = [inMin, inMax]$ to a given output range $InOutputRange = [outMin, outMax]$

Note
If optional input range is not provided, image minimum and maximum intensities are used.

On output image, values are given by:

\[ OutImg[i] = \begin{cases} outMin & \text { if } inImg[i] < inMin \\ outMax & \text { if } inImg[i] > inMax \\ (InImg[i] - inMin) * \dfrac {outMax - outMin} {inMax - inMin} + outMin & \text { otherwise} \end{cases} \]

with $[inMin, inMax]$ and $[outMin, outMax]$ respectively the input and output ranges specified by the user.

Here is an example of intensity normalization applied to a 8-bits grey level image with $[outMin, outMax]=[0, 255]$:

normalizeImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# definition of targeted image output range
outputRange = PyIPSDK.createRange(50, 200)
# image normalization computation
outImg = itrans.normalizeImg(inImg, outputRange)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLIntensityTransform/Processor/NormalizeImg/NormalizeImg.h>

Code Example

// Sample with a generated output image
// ------------------------------------
ImagePtr pAutoOutImg;
if(pInRange.get() != 0) {
// Sample with a generated output image
// ------------------------------------
pAutoOutImg = normalizeImg(pInImg, pInRange, pOutRange);
// Sample with a provided output image
// -----------------------------------
// normalize input image
itrans::normalizeImg(pInImg, pInRange, pOutRange, pOutImg);
}
else {
// Sample with a generated output image
// ------------------------------------
pAutoOutImg = normalizeImg(pInImg, pOutRange);
// Sample with a provided output image
// -----------------------------------
// create output image
ImageGeometryPtr pOutputImageGeometry = geometry2d(outType, sizeX, sizeY);
pOutImg = boost::make_shared<MemoryImage>();
pOutImg->init(*pOutputImageGeometry);
// normalize input image
normalizeImg(pInImg, pOutRange, pOutImg);
}