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 );
This function returns outputBinaryImage.
// Function prototype. color_thresholding( input_color_image, threshold_range_red = [128, 255], threshold_range_green = [128, 255], threshold_range_blue = [128, 255], output_binary_image = None )
This function returns outputBinaryImage.
// Function prototype. public static IOLink.ImageView ColorThresholding( IOLink.ImageView inputColorImage, double[] thresholdRangeRed = null, double[] thresholdRangeGreen = null, double[] thresholdRangeBlue = null, 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 |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
input_color_image |
The input color image. | image | Multispectral | None | |
threshold_range_red |
The low and high thresholds for the first channel (red for an RGB image). | vector2d | Any value | [128, 255] | |
threshold_range_green |
The low and high thresholds for the second channel (green for an RGB image). | vector2d | Any value | [128, 255] | |
threshold_range_blue |
The low and high thresholds for the third channel (blue for an RGB image). | vector2d | Any value | [128, 255] | |
output_binary_image |
The output binary image. Its dimensions are forced to the same values as the input. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputColorImage |
The input color image. | Image | Multispectral | null | |
thresholdRangeRed |
The low and high thresholds for the first channel (red for an RGB image). | Vector2d | Any value | {128f, 255f} | |
thresholdRangeGreen |
The low and high thresholds for the second channel (green for an RGB image). | Vector2d | Any value | {128f, 255f} | |
thresholdRangeBlue |
The low and high thresholds for the third channel (blue for an RGB image). | Vector2d | Any value | {128f, 255f} | |
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | null |
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();
ateneub = ioformat.read_image(imagedev_data.get_image_path("ateneub.jpg")) color_thresholding_algo = imagedev.ColorThresholding() color_thresholding_algo.input_color_image = ateneub color_thresholding_algo.threshold_range_red = [128.0, 255.0] color_thresholding_algo.threshold_range_green = [128.0, 255.0] color_thresholding_algo.threshold_range_blue = [128.0, 255.0] color_thresholding_algo.execute() print( "output_binary_image:", str( color_thresholding_algo.output_binary_image ) )
ImageView ateneub = ViewIO.ReadImage( @"Data/images/ateneub.jpg" ); ColorThresholding colorThresholdingAlgo = new ColorThresholding { inputColorImage = ateneub, thresholdRangeRed = new double[]{128.0, 255.0}, thresholdRangeGreen = new double[]{128.0, 255.0}, thresholdRangeBlue = new double[]{128.0, 255.0} }; colorThresholdingAlgo.Execute(); Console.WriteLine( "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();
ateneub = ioformat.read_image(imagedev_data.get_image_path("ateneub.jpg")) result = imagedev.color_thresholding( ateneub, [128.0, 255.0], [128.0, 255.0], [128.0, 255.0] ) print( "output_binary_image:", str( result ) )
ImageView ateneub = ViewIO.ReadImage( @"Data/images/ateneub.jpg" ); IOLink.ImageView result = Processing.ColorThresholding( ateneub, new double[]{128.0, 255.0}, new double[]{128.0, 255.0}, new double[]{128.0, 255.0} ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );