IPSDK 4.2
IPSDK : Image Processing Software Development Kit
Smart shading correction
outImg,offset,factor = smartShadingCorrectionImg (inImg,whiteImg,outputRange)
offset,factor = smartShadingCorrectionImg (inImg,whiteImg,outputRange,outImg)
outImg,offset,factor = smartShadingCorrectionImg (inImg,blackImg,whiteImg,outputRange)
offset,factor = smartShadingCorrectionImg (inImg,blackImg,whiteImg,outputRange,outImg)

Detailed Description

corrects an input image for shading, and normalize output image so that it fits an expected dynamic range

Given:

the algorithm computes $offset$ and $factor$ described in shading correction algorithm, so that output image resulting from shading correction fits in the dynamic range specified by the user.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# definition of targeted image output range
outputRange = PyIPSDK.createRange(0, 255)
# opening of white image
# note : could also be created with operation such as 'whiteImg = filter.meanSmoothing2dImg(inImg, 50, 50)'
whiteImg = PyIPSDK.loadTiffImageFile(whiteImgPath)
# image shading correction computation
outImg, offset, factor = itrans.smartShadingCorrectionImg(inImg, whiteImg, outputRange)

Example of C++ code :

Example informations

Header file

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

Code Example

// Sample with a generated output image
// -----------------------------------
SmartShadingCorrectionResult sscRes;
if(!pBlackImg)
sscRes = smartShadingCorrectionImg(pInImg, pWhiteImg, pRange);
else
sscRes = smartShadingCorrectionImg(pInImg, pBlackImg, pWhiteImg, pRange);
// retrieve results
ImagePtr pAutoOutImg = sscRes._pOutImg;
ipReal64 offset = sscRes._offset;
ipReal64 factor = sscRes._factor;