IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Isodata Threshold binarizationSee full documentation
scalarisoDataThreshold (inImg,histogram)
outImg,outThresholdisoDataThresholdImg (inImg)
scalarisoDataThresholdImg (inImg,outBinImg)
outImg,outThresholdisoDataThresholdImg (inImg,histogram)
scalarisoDataThresholdImg (inImg,histogram,outBinImg)

Detailed Description

computation of iso data threshold on one image

Ridler and Calvard's method is used to automatically perform the binarization of an input image. It assumes that the image is bi-modal (pixel intensities can be distinguished in 2 classes: background pixels and foreground pixels) and calculate the optimal threshold that separates these 2 classes. The threshold $T$ is the equidistant value between the average intensities of both classes:

See also
Isodata Threshold computation for more details.

On output, binarized image values are given by:

\[ OutBinImg[i] = \begin{cases} 1, & \text{if } InImg[i] \geq T \\ 0, & \text{otherwise} \end{cases} \]

with $T$ the threshold computed from isodata-based method.

Input and output images must have same size.

Here is an example of automatic isodata image thresholding applied to a 8-bits grey level image (on ouput, computed threshold $ \approx 117.54$) :

isoDataThresholdImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBinarization as bin

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# otsu threshold computation
outImg, isoDataThresholdValue = bin.isoDataThresholdImg(inImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLBinarization/Processor/IsoDataThresholdImg/IsoDataThresholdImg.h>

Code Example

// open input image
ImageGeometryPtr pInputImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg = loadRawImageFile(inPath, *pInputImageGeometry);
// Sample with a generated output image
// ------------------------------------
// compute thresholded output image
IsoDataResult isoDataResult = isoDataThresholdImg(pInImg);
// Sample with a provided output image
// -----------------------------------
// create output image
ImageGeometryPtr pOutputImageGeometry = geometry2d(eImageBufferType::eIBT_Binary, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// compute thresholded output image
ipReal64 fOutThreshold = isoDataThresholdImg(pInImg, pOutImg);