BlendAlphaChannelWithImage
Blends an RGBA input image with a background RGB image into an RGB output image.
Access to parameter description
For an introduction to color image filters: section Color Transforms.
BlendAlphaChannelWithImage combines an image with a background, defined by an RGB image, 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_b*\left (1-\alpha \right )$ where
See also
Access to parameter description
For an introduction to color image filters: section Color Transforms.
BlendAlphaChannelWithImage combines an image with a background, defined by an RGB image, 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_b*\left (1-\alpha \right )$ where
- $O$: Intensity of the output image
- $I_i$: Intensity of the input image
- $I_b$: Intensity of the background image
- $\alpha $: Value of the alpha channel
See also
Function Syntax
This function returns outputRgbImage.
// Function prototype
std::shared_ptr< iolink::ImageView > blendAlphaChannelWithImage( std::shared_ptr< iolink::ImageView > inputRgbaImage, std::shared_ptr< iolink::ImageView > inputBackgroundImage, std::shared_ptr< iolink::ImageView > outputRgbImage = NULL );
This function returns outputRgbImage.
// Function prototype. blend_alpha_channel_with_image( input_rgba_image, input_background_image, output_rgb_image = None )
This function returns outputRgbImage.
// Function prototype. public static IOLink.ImageView BlendAlphaChannelWithImage( IOLink.ImageView inputRgbaImage, IOLink.ImageView inputBackgroundImage, IOLink.ImageView outputRgbImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputRgbaImage |
The RGBA input image. | Image | Multispectral | nullptr | |
inputBackgroundImage |
The background input image. Its spatial dimensions and type must be the same as the RGBA input image. If the image has an alpha channel, it is ignored. Its dimensions and type must be the same as the RGBA input image. | Image | Multispectral | nullptr | |
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 | |
input_background_image |
The background input image. Its spatial dimensions and type must be the same as the RGBA input image. If the image has an alpha channel, it is ignored. Its dimensions and type must be the same as the RGBA input image. | image | Multispectral | None | |
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 | |
inputBackgroundImage |
The background input image. Its spatial dimensions and type must be the same as the RGBA input image. If the image has an alpha channel, it is ignored. Its dimensions and type must be the same as the RGBA input image. | Image | Multispectral | null | |
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" ); std::shared_ptr< iolink::ImageView > icon_rainbow = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "icon_rainbow.png" ); BlendAlphaChannelWithImage blendAlphaChannelWithImageAlgo; blendAlphaChannelWithImageAlgo.setInputRgbaImage( icon ); blendAlphaChannelWithImageAlgo.setInputBackgroundImage( icon_rainbow ); blendAlphaChannelWithImageAlgo.execute(); std::cout << "outputRgbImage:" << blendAlphaChannelWithImageAlgo.outputRgbImage()->toString();
icon = ioformat.read_image(imagedev_data.get_image_path("icon.png")) icon_rainbow = ioformat.read_image(imagedev_data.get_image_path("icon_rainbow.png")) blend_alpha_channel_with_image_algo = imagedev.BlendAlphaChannelWithImage() blend_alpha_channel_with_image_algo.input_rgba_image = icon blend_alpha_channel_with_image_algo.input_background_image = icon_rainbow blend_alpha_channel_with_image_algo.execute() print( "output_rgb_image:", str( blend_alpha_channel_with_image_algo.output_rgb_image ) )
ImageView icon = ViewIO.ReadImage( @"Data/images/icon.png" ); ImageView icon_rainbow = ViewIO.ReadImage( @"Data/images/icon_rainbow.png" ); BlendAlphaChannelWithImage blendAlphaChannelWithImageAlgo = new BlendAlphaChannelWithImage { inputRgbaImage = icon, inputBackgroundImage = icon_rainbow }; blendAlphaChannelWithImageAlgo.Execute(); Console.WriteLine( "outputRgbImage:" + blendAlphaChannelWithImageAlgo.outputRgbImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > icon = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "icon.png" ); std::shared_ptr< iolink::ImageView > icon_rainbow = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "icon_rainbow.png" ); auto result = blendAlphaChannelWithImage( icon, icon_rainbow ); std::cout << "outputRgbImage:" << result->toString();
icon = ioformat.read_image(imagedev_data.get_image_path("icon.png")) icon_rainbow = ioformat.read_image(imagedev_data.get_image_path("icon_rainbow.png")) result = imagedev.blend_alpha_channel_with_image( icon, icon_rainbow ) print( "output_rgb_image:", str( result ) )
ImageView icon = ViewIO.ReadImage( @"Data/images/icon.png" ); ImageView icon_rainbow = ViewIO.ReadImage( @"Data/images/icon_rainbow.png" ); IOLink.ImageView result = Processing.BlendAlphaChannelWithImage( icon, icon_rainbow ); Console.WriteLine( "outputRgbImage:" + result.ToString() );