IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

adjust image dynamic range from a reference using statistics matching More...

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::matchStatsImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pRefImg, const ipsdk::imaproc::attr::eMatchStatsCriterion &criterion)
 wrapper function for adjust image dynamic range from a reference using statistics matching More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::matchStatsImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pRefImg, const ipsdk::imaproc::attr::eMatchStatsCriterion &criterion, const image::ImagePtr &pOutImg)
 wrapper function for adjust image dynamic range from a reference using statistics matching More...
 
IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::matchStatsImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::StatsResultConstPtr &pRefStats, const ipsdk::imaproc::attr::eMatchStatsCriterion &criterion)
 wrapper function for adjust image dynamic range from a reference using statistics matching More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::matchStatsImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::StatsResultConstPtr &pRefStats, const ipsdk::imaproc::attr::eMatchStatsCriterion &criterion, const image::ImagePtr &pOutImg)
 wrapper function for adjust image dynamic range from a reference using statistics matching More...
 

Detailed Description

adjust image dynamic range from a reference using statistics matching

This algorithm applies a LUT to the input image so that the set of statistical indicators chosen by the user computed on the input image matches with associated indicators in the reference image.

If the user wants to match the minimum and maximum values:

\[ OutImg[i] = \begin{cases} refMin & \text { if } inImg[i] < refMin \\ refMax & \text { if } inImg[i] > refMax \\ (InImg[i] - inMin) * \dfrac {refMax - refMin} {inMax - inMin} + refMin & \text { otherwise} \end{cases} \]

with $inMin$ and $inMax$ respectively the minimum and maximum pixel values in input image and $refMin$ and $refMax$ respectively the minimum and maximum pixel values in reference image.

If the user wants to match the mean and and the standard deviation:

\[ OutImg[i] = \frac{refStdDev*InImg[i]}{inStdDev} + refMean - \frac{inMean*refStdDev}{inStdDev} \]

with $inStdDev$ and $inMean$ respectively the standard deviation and the mean of the pixel values in input image, and $refStdDev$ and $refMean$ respectively the standard deviation and mean of the pixel values in reference image.

Input and output images must have same size.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InOptRefImg [Input Optional] reference image X
ipsdk::imaproc::attr::InOptRefStatsIndicators [Input Optional] statistical indicators of reference X
ipsdk::imaproc::attr::InMatchStatsCriterion [Input] criterion used to adjust image dynamic 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::If (
   ipsdk::processor::isSet (_pInOptRefImg),
   (ipsdk::processor::Not (
     ipsdk::processor::isSet (_pInOptRefStatsIndicators))),
   (ipsdk::processor::isSet (_pInOptRefStatsIndicators)))))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans

Code Example

# opening of input images
inImg1 = PyIPSDK.loadTiffImageFile(inputImgPath1)
inImg2 = PyIPSDK.loadTiffImageFile(inputImgPath2)
# image statistics matching computation
outImg = itrans.matchStatsImg(inImg1, inImg2, PyIPSDK.eMatchStatsCriterion.eMeanStdDev)

Example of C++ code :

Example informations

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

boost::filesystem::path inPath, refPath;
// initialization of paths
// ...
ImagePtr pInImg = loadTiffImageFile(inPath);
ImagePtr pRefImg = loadTiffImageFile(refPath);
// launch "mean/standard deviation" matching operation
See also
MatchStatsImgLvl1

Function Documentation

◆ matchStatsImg() [1/4]

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::matchStatsImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pRefImg,
const ipsdk::imaproc::attr::eMatchStatsCriterion criterion 
)

wrapper function for adjust image dynamic range from a reference using statistics matching

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ matchStatsImg() [2/4]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::matchStatsImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pRefImg,
const ipsdk::imaproc::attr::eMatchStatsCriterion criterion,
const image::ImagePtr pOutImg 
)

wrapper function for adjust image dynamic range from a reference using statistics matching

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ matchStatsImg() [3/4]

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::matchStatsImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::StatsResultConstPtr pRefStats,
const ipsdk::imaproc::attr::eMatchStatsCriterion criterion 
)

wrapper function for adjust image dynamic range from a reference using statistics matching

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ matchStatsImg() [4/4]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::matchStatsImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::StatsResultConstPtr pRefStats,
const ipsdk::imaproc::attr::eMatchStatsCriterion criterion,
const image::ImagePtr pOutImg 
)

wrapper function for adjust image dynamic range from a reference using statistics matching

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure