IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Functions

Binarize an input image by thresholding, given minimum and maximum input thresholds. More...

Functions

IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::darkThresholdImg (const image::ImageConstPtr &pInImg, const ipReal64 inMaxThreshold)
 wrapper function for binary threshold on one image with retrieval of 'dark area' More...
 
IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::lightThresholdImg (const image::ImageConstPtr &pInImg, const ipReal64 inMinThreshold)
 wrapper function for binary threshold on one image with retrieval of 'light area' More...
 
IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::thresholdImg (const image::ImageConstPtr &pInImg, const ipReal64 inMinThreshold, const ipReal64 inMaxThreshold)
 wrapper function for binary threshold on one image More...
 
IPSDKIPLBINARIZATION_API void ipsdk::imaproc::bin::thresholdImg (const image::ImageConstPtr &pInImg, const ipReal64 inMinThreshold, const ipReal64 inMaxThreshold, const image::ImagePtr &pOutBinImg)
 wrapper function for binary threshold on one image More...
 

Detailed Description

Binarize an input image by thresholding, given minimum and maximum input thresholds.

On output image values are given by:

\[ OutBinImg[i] = \begin{cases} 1, & \text{if } InThresholdMin \leq InImg[i] \leq InThresholdMax \\ 0, & \text{otherwise} \end{cases} \]

(with $InThresholdMin$ and $InThresholdMax$ corresponding to the minimum and maximum output thresholds)

Input and output images must have same size and buffer type.

Warning
The behaviour of this algorithm is undetermined if InThresholdMin or InThresholdMax is out of input image data type range.

Here is an example of a binary threshold operation applied to an 8-bits grey levels input image (with $InThresholdMin=127$ and $InThresholdMax=200$):

thresholdImg.png
See also
http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InThresholdMax [Input] maximum for binary threshold image operation X
ipsdk::imaproc::attr::InThresholdMin [Input] minimum for binary threshold image operation X
ipsdk::imaproc::attr::OutBinImg [Output] binary image for processing operation ipsdk::imaproc::duplicateInOut (_pOutBinImg, _pInImg, image::eImageBufferType::eIBT_Binary)

Global Rule description

Global rule description for algorithm :
((ipsdk::imaproc::matchSize (_pInImg,_pOutBinImg)) && (_pInThresholdMin<=_pInThresholdMax) && 
 (matchImageRange (_pInImg,_pInThresholdMin)) && 
 (matchImageRange (_pInImg,_pInThresholdMax)))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBinarization as bin

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# threshold computation
outImg = bin.thresholdImg(inImg, 50, 127)

Example of C++ code :

Example informations

Associated library

IPSDKIPLBinarization

Header file

Code Example

// open input image
ImageGeometryPtr pInputImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg = loadRawImageFile(inPath, *pInputImageGeometry);
// Sample with a generated output image
// ------------------------------------
// thresholding of input image
ImagePtr pAutoOutImg = thresholdImg(pInImg, fInMinThreshold, fInMaxThreshold);
// 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);
// thresholding of input image
thresholdImg(pInImg, fInMinThreshold, fInMaxThreshold, pOutImg);
See also
ThresholdImgLvl1

Function Documentation

◆ darkThresholdImg()

IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::darkThresholdImg ( const image::ImageConstPtr pInImg,
const ipReal64  inMaxThreshold 
)

wrapper function for binary threshold on one image with retrieval of 'dark area'

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lightThresholdImg()

IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::lightThresholdImg ( const image::ImageConstPtr pInImg,
const ipReal64  inMinThreshold 
)

wrapper function for binary threshold on one image with retrieval of 'light area'

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ thresholdImg() [1/2]

IPSDKIPLBINARIZATION_API image::ImagePtr ipsdk::imaproc::bin::thresholdImg ( const image::ImageConstPtr pInImg,
const ipReal64  inMinThreshold,
const ipReal64  inMaxThreshold 
)

wrapper function for binary threshold on one image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ thresholdImg() [2/2]

IPSDKIPLBINARIZATION_API void ipsdk::imaproc::bin::thresholdImg ( const image::ImageConstPtr pInImg,
const ipReal64  inMinThreshold,
const ipReal64  inMaxThreshold,
const image::ImagePtr pOutBinImg 
)

wrapper function for binary threshold on one image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure