The replace_alpha module performs an image filter operation, replacing the alpha channel of a full-color byte image with another set of scalar byte data.
Name | Type | Description | |
in | Image_ARGB | original full colour image | |
alpha | Image | replacement alpha image | |
Name | Type | Description | |
out_image | Image_ARGB | new image with altered alpha channel | |
out_obj | GDobject | Directly renderable output object | |
The replace_alpha module modifies an full colour AVS image by replacing the original alpha channel data in the image with byte data from a monochrome image. The module does not alter the Red, Green or Blue channels of the image in any way. The module checks that both input images are of the same size. If they are not an error is raised and no processing is performed. The module is a conversion of the AVS5 "replace_alpha" module. The low-level code has been implemented in C++ and operates on simple byte arrays rather than fields.
The replace_alpha module can be used for a variety of purposes. For instance, the alpha channel of one full colour image could be applied to another full colour image by using the extract_scalar module to create a monochrome image that could be feed into the replace_alpha module. The replace_alpha module could also be used as the basis of other image processing modules.
in : Image_ARGB
The original full colour image that should have its alpha channel data replaced. The data should be a 2D uniform field containing a single component of node data. That node data should contain a vector of 4 byte values. These correspond to the 4 colour channels; alpha, red, green and blue. The read_image module outputs data of this form.
alpha : Image
The monochrome image that should be used to replace the alpha channel data in the original image. The data should be a 2D uniform field containing a single component of node data. That node data should contain a single scalar byte of data. Suitable data can be generated by using the extract_scalar module to extract a single channel from a full colour image.
out_image : Image_ARGB
The output full colour image containing alpha data from the monochrome image input and colour data from the original full colour input. The image is output as a 2D uniform field containing a single component of node data. That node data contains a vector of 4 bytes.
out_obj
The GDobject version of the output, suitable for direct connection to the viewer.
The replace_alpha user macro uses the low-level ReplaceAlphaCore module. This module contains all the C++ code used by the project. No User Interface macro is necessary for this project.
The ReplaceAlphaEg example application is provided with this project. This application reads the mandrill.x image supplied with AVS/Express and extracts a single channel from it. This channel is feed through a clamp module and then used by the replace_alpha module to replace the alpha channel information in the original mandrill image. Finally a second extract_scalar module is used to extract the alpha channel from the new image and display it. By altering the parameters of the clamp module it can be clearly seen that the original alpha channel data is being replaced.
iac_proj/repalpha/ramods.v contains the V definition of the ReplaceAlphaCore module.
iac_proj/repalpha/ramacs.v contains the V definitions of the replace_alpha user macro and the ReplaceAlphaEg example application.
The low-level ReplaceAlphaMods library containing the module does not specify a process. By default the express process will be used.
Sabreen Vig, Ian Curington, Larry Gelberg Advanced Visual Systems, Inc. Andrew Dodd, International AVS Centre
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL
See the AVS5 replace_alpha module, from which this one is derived.