IPSDK 4.2
IPSDK : Image Processing Software Development Kit
Shading correction
image = shadingCorrectionImg (inImg,whiteImg,factor)
image = shadingCorrectionImg (inImg,blackImg,whiteImg,factor)
image = shadingCorrectionImg (inImg,whiteImg,offset,factor)
image = shadingCorrectionImg (inImg,blackImg,whiteImg,offset,factor)

Detailed Description

corrects an input image for shading

Corrects an input image for shading that may be introduced during its acquisition.

Given:

Values of output image resulting from shading correction are computed as follows:

\[ OutImg[i] = \begin{cases} offset + factor.{\dfrac {InImg[i]-BlackImg[i]} {WhiteImg[i]-BlackImg[i]}} & \text { if } WhiteImg[i]-BlackImg[i] \ne 0 \\ offset & \text { otherwise} \end{cases} \]

Here is an example of shading correction applied to a 8-bits grey level image on which an artificial vignetting has been applied:

shadingCorrectionImg.png

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)
# 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 = itrans.shadingCorrectionImg(inImg, whiteImg, 200)

Example of C++ code :

Example informations

Header file

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

Code Example

// Sample with a generated output image
// -----------------------------------
ImagePtr pAutoOutImg;
if(!pBlackImg)
pAutoOutImg = shadingCorrectionImg(pInImg, pWhiteImg, factor);
else
pAutoOutImg = shadingCorrectionImg(pInImg, pBlackImg, pWhiteImg, factor);