ColorThresholding
Transforms a color image into a binary image.
Access to parameter description
For an introduction:
See also
See related example
Access to parameter description
For an introduction:
- section Image Segmentation
- section Binarization
See also
See related example
Function Syntax
This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > colorThresholding( std::shared_ptr< iolink::ImageView > inputColorImage, iolink::Vector2d thresholdRangeRed, iolink::Vector2d thresholdRangeGreen, iolink::Vector2d thresholdRangeBlue, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputColorImage |
The input color image. | Image | Multispectral | nullptr |
![]() |
thresholdRangeRed |
The low and high thresholds for the first channel (red for an RGB image). | Vector2d | Any value | {128.f, 255.f} |
![]() |
thresholdRangeGreen |
The low and high thresholds for the second channel (green for an RGB image). | Vector2d | Any value | {128.f, 255.f} |
![]() |
thresholdRangeBlue |
The low and high thresholds for the third channel (blue for an RGB image). | Vector2d | Any value | {128.f, 255.f} |
![]() |
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > ateneub = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "ateneub.jpg" ); ColorThresholding colorThresholdingAlgo; colorThresholdingAlgo.setInputColorImage( ateneub ); colorThresholdingAlgo.setThresholdRangeRed( {128.0, 255.0} ); colorThresholdingAlgo.setThresholdRangeGreen( {128.0, 255.0} ); colorThresholdingAlgo.setThresholdRangeBlue( {128.0, 255.0} ); colorThresholdingAlgo.execute(); std::cout << "outputBinaryImage:" << colorThresholdingAlgo.outputBinaryImage()->toString();
Function Examples
std::shared_ptr< iolink::ImageView > ateneub = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "ateneub.jpg" ); auto result = colorThresholding( ateneub, {128.0, 255.0}, {128.0, 255.0}, {128.0, 255.0} ); std::cout << "outputBinaryImage:" << result->toString();