IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Histograms Matching
IntensityLUTmatchHistograms (histo1,histo2)

Detailed Description

compute the LUT that matches 2 histograms

This algorithm computes a LUT that, once applied to input histogram, permits to match the resulting histogram with the reference one.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# opening of input images
inImg1 = PyIPSDK.loadTiffImageFile(inputImgPath1)
inImg2 = PyIPSDK.loadTiffImageFile(inputImgPath2)
# computation of image histograms
histo1 = glbmsr.histogramMsr2d(inImg1)
histo2 = glbmsr.histogramMsr2d(inImg2)
# histogram matching computation
outLut = itrans.matchHistograms(histo1, histo2)

Example of C++ code :

Example informations

Header file

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

Code Example

boost::filesystem::path inPath, refPath;
// initialization of paths
// ...
// restore images stored in input files
image::ImagePtr pInImg = loadTiffImageFile(inPath);
image::ImagePtr pRefImg = loadTiffImageFile(refPath);
// compute histograms on images
imaproc::glbmsr::histogramMsr(pInImg);
imaproc::glbmsr::histogramMsr(pRefImg);
// compute look-up table matching the 2 histograms
imaproc::itrans::matchHistograms(pInHistogram, pRefHistogram);