Processing math: 100%
ImageDev

HysteresisThresholding

Performs a thresholding with a conditional propagation.

Access to parameter description

For an introduction: This algorithm uses a hysteresis loop to provide a more connected threshold result.

Two gray level values λ1 and and λ2 are specified.
The output O is given by: The Figure 1 represents an example of 1-D function. The Figure 2 shows the result of a lower bound threshold with value λ1 and λ2. Figure 3 is the result of a hysteresis thresholding, where the points in the fuzzy area not connected with points in the retained area are rejected.

<b> Figure 1.</b> 1-D function with low and high thresholds
Figure 1. 1-D function with low and high thresholds

<b> Figure 2.</b> Retained area (red), rejected area (blue) and fuzzy area (green)
Figure 2. Retained area (red), rejected area (blue) and fuzzy area (green)

<b> Figure 3.</b> Hysteresis thresholding, unconnected fuzzy area rejected
Figure 3. Hysteresis thresholding, unconnected fuzzy area rejected

This algorithm can be used after an edge detection, which generates, as well as edges, a lot of noise. True edges have a higher chance to be connected to a retained area than pixels corresponding to noise.
By the way, hysteresis thresholding is the last step of the Canny edge detector algorithm, following the non-maximum suppression step.

See also

Function Syntax

This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > hysteresisThresholding( std::shared_ptr< iolink::ImageView > inputImage, iolink::Vector2d thresholdRange, int32_t length, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Grayscale nullptr
input
thresholdRange
The low and high threshold levels. Vector2d Any value {255.f, 128.f}
input
length
The maximum length in pixels allowed for considering points in the fuzzy zone (0:until convergence). Int32 >=0 1
output
outputBinaryImage
The output binary image. Its dimensions are forced to the same values as the input. Image nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

HysteresisThresholding hysteresisThresholdingAlgo;
hysteresisThresholdingAlgo.setInputImage( foam );
hysteresisThresholdingAlgo.setThresholdRange( {128.0, 255.0} );
hysteresisThresholdingAlgo.setLength( 1 );
hysteresisThresholdingAlgo.execute();

std::cout << "outputBinaryImage:" << hysteresisThresholdingAlgo.outputBinaryImage()->toString();

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = hysteresisThresholding( foam, {128.0, 255.0}, 1 );

std::cout << "outputBinaryImage:" << result->toString();