BlendAlphaChannelWithValue
Blends an RGBA input image with a padding color into an RGB output image.
Access to parameter description
For an introduction to color image filters: section Color Transforms.
BlendAlphaChannelWithValue combines an image with a background, defined by a single color, taking into account the alpha channel. Considering all $\alpha$ values between 0 and 1, the resulting intensity of each color component is computed with the following formula:
$O=I_i*\alpha + I_p*\left (1-\alpha \right )$ where
See also
Access to parameter description
For an introduction to color image filters: section Color Transforms.
BlendAlphaChannelWithValue combines an image with a background, defined by a single color, taking into account the alpha channel. Considering all $\alpha$ values between 0 and 1, the resulting intensity of each color component is computed with the following formula:
$O=I_i*\alpha + I_p*\left (1-\alpha \right )$ where
- $O$: Intensity of the output image
- $I_i$: Intensity of the input image
- $I_p$: Intensity of the padding color
- $\alpha $: Value of the alpha channel
See also
Function Syntax
This function returns outputRgbImage.
// Function prototype
std::shared_ptr< iolink::ImageView > blendAlphaChannelWithValue( std::shared_ptr< iolink::ImageView > inputRgbaImage, iolink::Vector3i32 paddingColor, std::shared_ptr< iolink::ImageView > outputRgbImage = NULL );
This function returns outputRgbImage.
// Function prototype. blend_alpha_channel_with_value( input_rgba_image, padding_color = [0, 0, 0], output_rgb_image = None )
This function returns outputRgbImage.
// Function prototype. public static IOLink.ImageView BlendAlphaChannelWithValue( IOLink.ImageView inputRgbaImage, int[] paddingColor = null, IOLink.ImageView outputRgbImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputRgbaImage |
The RGBA input image. | Image | Multispectral | nullptr |
![]() |
paddingColor |
The padding color. | Vector3i32 | Any value | {0, 0, 0} |
![]() |
outputRgbImage |
The RGB output image. Its spatial dimensions and type are forced to the same values as the inputs. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
input_rgba_image |
The RGBA input image. | image | Multispectral | None |
![]() |
padding_color |
The padding color. | vector3i32 | Any value | [0, 0, 0] |
![]() |
output_rgb_image |
The RGB output image. Its spatial dimensions and type are forced to the same values as the inputs. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputRgbaImage |
The RGBA input image. | Image | Multispectral | null |
![]() |
paddingColor |
The padding color. | Vector3i32 | Any value | {0, 0, 0} |
![]() |
outputRgbImage |
The RGB output image. Its spatial dimensions and type are forced to the same values as the inputs. | Image | null |
Object Examples
std::shared_ptr< iolink::ImageView > icon = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "icon.png" ); BlendAlphaChannelWithValue blendAlphaChannelWithValueAlgo; blendAlphaChannelWithValueAlgo.setInputRgbaImage( icon ); blendAlphaChannelWithValueAlgo.setPaddingColor( {255, 255, 255} ); blendAlphaChannelWithValueAlgo.execute(); std::cout << "outputRgbImage:" << blendAlphaChannelWithValueAlgo.outputRgbImage()->toString();
icon = ioformat.read_image(imagedev_data.get_image_path("icon.png")) blend_alpha_channel_with_value_algo = imagedev.BlendAlphaChannelWithValue() blend_alpha_channel_with_value_algo.input_rgba_image = icon blend_alpha_channel_with_value_algo.padding_color = [255, 255, 255] blend_alpha_channel_with_value_algo.execute() print( "output_rgb_image:", str( blend_alpha_channel_with_value_algo.output_rgb_image ) )
ImageView icon = ViewIO.ReadImage( @"Data/images/icon.png" ); BlendAlphaChannelWithValue blendAlphaChannelWithValueAlgo = new BlendAlphaChannelWithValue { inputRgbaImage = icon, paddingColor = new int[]{255, 255, 255} }; blendAlphaChannelWithValueAlgo.Execute(); Console.WriteLine( "outputRgbImage:" + blendAlphaChannelWithValueAlgo.outputRgbImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > icon = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "icon.png" ); auto result = blendAlphaChannelWithValue( icon, {255, 255, 255} ); std::cout << "outputRgbImage:" << result->toString();
icon = ioformat.read_image(imagedev_data.get_image_path("icon.png")) result = imagedev.blend_alpha_channel_with_value( icon, [255, 255, 255] ) print( "output_rgb_image:", str( result ) )
ImageView icon = ViewIO.ReadImage( @"Data/images/icon.png" ); IOLink.ImageView result = Processing.BlendAlphaChannelWithValue( icon, new int[]{255, 255, 255} ); Console.WriteLine( "outputRgbImage:" + result.ToString() );