IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

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

IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionResult ipsdk::imaproc::itrans::smartShadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipsdk::imaproc::attr::RangeConstPtr &pOutputRange)
 wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range More...
 
IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionInfo ipsdk::imaproc::itrans::smartShadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pWhiteImg, const ipsdk::imaproc::attr::RangeConstPtr &pOutputRange, const image::ImagePtr &pOutImg)
 wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range More...
 
IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionResult ipsdk::imaproc::itrans::smartShadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipsdk::imaproc::attr::RangeConstPtr &pOutputRange)
 wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range More...
 
IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionInfo ipsdk::imaproc::itrans::smartShadingCorrectionImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pBlackImg, const image::ImageConstPtr &pWhiteImg, const ipsdk::imaproc::attr::RangeConstPtr &pOutputRange, const image::ImagePtr &pOutImg)
 wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range More...
 

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.

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::InOptOutputRange [Input Optional] expected output image range X
ipsdk::imaproc::attr::OutOffset [Output] Offset. Used for instance by smart shading correction algorithm X
ipsdk::imaproc::attr::OutFactor [Output] Multiplying factor. Used for instance by smart 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)
# 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

Associated library

IPSDKIPLIntensityTransform

Header file

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;
See also
SmartShadingCorrectionImgLvl1

Function Documentation

◆ smartShadingCorrectionImg() [1/4]

IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionResult ipsdk::imaproc::itrans::smartShadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipsdk::imaproc::attr::RangeConstPtr pOutputRange 
)

wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range

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

◆ smartShadingCorrectionImg() [2/4]

IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionInfo ipsdk::imaproc::itrans::smartShadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pWhiteImg,
const ipsdk::imaproc::attr::RangeConstPtr pOutputRange,
const image::ImagePtr pOutImg 
)

wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range

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

◆ smartShadingCorrectionImg() [3/4]

IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionResult ipsdk::imaproc::itrans::smartShadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipsdk::imaproc::attr::RangeConstPtr pOutputRange 
)

wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range

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

◆ smartShadingCorrectionImg() [4/4]

IPSDKIPLINTENSITYTRANSFORM_API SmartShadingCorrectionInfo ipsdk::imaproc::itrans::smartShadingCorrectionImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pBlackImg,
const image::ImageConstPtr pWhiteImg,
const ipsdk::imaproc::attr::RangeConstPtr pOutputRange,
const image::ImagePtr pOutImg 
)

wrapper function for applies a shading correction to an image, so that output image intensity fits an expected range

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