IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Shading correction (white image represented as a paraboloid)See full documentation
imageparaboloidShadingCorrection2dImg (inImg,whiteImgModel,factor)
imageparaboloidShadingCorrection2dImg (inImg,whiteImgModel,offset,factor)
imageparaboloidShadingCorrection2dImg (inImg,blackImg,whiteImgModel,offset,factor)

Detailed Description

corrects an input image for shading, using an analytic paraboloid model for the white image

Corrects an input image for shading that may be introduced during its acquisition, using an analytic paraboloid model for the white image.

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} \]

with:

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

paraboloidShadingCorrection2dImg.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)
# retrieve white image paraboloid model
paraboloidWhite, bResRead = PyIPSDK.readFromXmlFile(whiteParaboloidPath)
# image shading correction computation
outImg = itrans.paraboloidShadingCorrection2dImg(inImg, paraboloidWhite, 5.025, 254.02)

Example of C++ code :

Example informations

Header file

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

Code Example

// open input image
ImagePtr pInImg = loadTiffImageFile(inPath);
// load white image paraboloid
attr::ParaboloidParams3dPtr pParaboloid = boost::make_shared<attr::ParaboloidParams3d>();
readFromXmlFile(whitePath, *pParaboloid);
// open black image, if exists
ImagePtr pBlackImg;
pBlackImg = loadTiffImageFile(blackPath);
const ipReal64 offset = .0;
const ipReal64 factor = 255.0;
ImagePtr pAutoOutImg = paraboloidShadingCorrection2dImg(pInImg, pBlackImg, pParaboloid, offset, factor);