IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

corrects an input image for shading More...

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 factor)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 factor, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 factor)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 factor, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 offset, const ipReal64 factor)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 offset, const ipReal64 factor, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 offset, const ipReal64 factor)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipReal64 offset, const ipReal64 factor, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for Computes a shading-corrected image given in particular an offset and a factor More...
 

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InOptBlackImg [Input Optional] Black image, usually obtained by closing all optical ports of the camera, or by turning off all the light sources. Used by shading correction algorithm X
ipsdk::imaproc::attr::InWhiteImg [Input] White image. Used by shading correction algorithm X
ipsdk::imaproc::attr::InOptOffset [Input Optional] Offset. Used for instance by shading correction algorithm X
ipsdk::imaproc::attr::InFactor [Input] Multiplying factor. Used for instance by shading correction algorithm X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg,_pOutImg) && 
ipsdk::processor::ifIsSet (_pInOptBlackImg,
 ipsdk::imaproc::matchSizeAndType (_pInImg,_pInOptBlackImg)) && 
ipsdk::imaproc::matchSizeAndType (_pInImg,_pInWhiteImg)

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

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

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

Function Documentation

◆ shadingCorrectionImg() [1/8]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  factor 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [2/8]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  factor,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [3/8]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  factor 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [4/8]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  factor,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [5/8]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  offset,
const ipReal64  factor 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [6/8]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  offset,
const ipReal64  factor,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [7/8]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  offset,
const ipReal64  factor 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure

◆ shadingCorrectionImg() [8/8]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::shadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipReal64  offset,
const ipReal64  factor,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for Computes a shading-corrected image given in particular an offset and a factor

Exceptions
ipsdk::imaproc::util::IPSDKIPLUtilityExceptionon failure