Composite
Synopsis
The composite module performs full-color blending on ARGB byte images using data from the the foreground image alpha channel.
Input Ports
| Name |
Type |
Description |
|
| foreground |
Image_ARGB |
First image to be blended. Should include alpha channel data. |
| background |
Image_ARGB |
Second image to be blended. |
|
Output Ports
| Name |
Type |
Description |
|
| out_image |
Image_ARGB |
Blended composite of input images. |
| out_obj |
GDobject |
Directly renderable output object. |
|
Description
The composite module performs blending on two full colour AVS images. The data in the foreground image alpha channel is used to control how much of the foreground image and the background image is blended into the final image. Both images must be of exactly the same size. If they are not an error message will be reported and no processing will be performed.
The blending equation for each pixel in the final image is:
alpha = ALPHA
red = (Foreground(red) *ALPHA) + (Background(red) *(1.0-ALPHA))
green = (Foreground(green)*ALPHA) + (Background(green)*(1.0-ALPHA))
blue = (Foreground(blue) *ALPHA) + (Background(blue) *(1.0-ALPHA))
ALPHA is the foreground image's alpha channel value. All data in the background image's alpha channel is ignored. This module is a conversion of the AVS5 "composite" module. The low-level module is implementated in C++ and operates on simple byte arrays rather than fields.
Inputs
foreground : Image_ARGB
The foreground full colour image that should by blended with the background image. The alpha channel data in this image is used to determine how the two images are blended. 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.
background : Image_ARGB
The background full colour image that should by blended with the foreground image. The alpha channel data is ignored and is not transferred to the output image. 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.
Outputs
out_image : Image_ARGB
The output full colour image containing the blended foreground and background images. 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.
Utility Macros
The composite user macro uses the low-level CompositeCore module. This module contains all the C++ code used by the project. No User Interface macro is necessary for this project.
Example
The CompositeEg example application crops an image in two different areas, and shows the blended result in a 2D viewer. It also shows the two original cropped images and the alpha channel information used to blend the two images. The original pixel data is from the mandrill.x image. The alpha channel information was modified by adding a cosine squared wave, running vertically down the image.
Files
iac_proj/comp/compmods.v contains the V definition of the CompositeCore module.
iac_proj/comp/compmacs.v contains the V definitions of the composite user macro and the CompositeEg example application.
Other Notes
The low-level CompositeMods library containing the module does
not specify a process. By default the express process will be
used.
Authors
Sabreen Vig, Ian Curington, Larry Gelberg
Advanced Visual Systems, Inc.
Andrew Dodd, International AVS Centre
Contact
International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL
See Also
AVS5 composite module, from which this one is derived.
|