Blending and Combining Images
A number of ImageGear's image processing functions combine data from two or more HIGEAR images, altering one with the result that it is a "blend" or other combination of the original images. These functions invariably take at least two HIGEAR handles as arguments. The functions in this group include:
IG_IP_blend_with_LUT() |
Performs weighted blend of image 2 into image 1, with the weighting factor determined by looking up the pixel/color value in your LUT. |
IG_FX_chroma_key() |
This Special Effects function replaces image 1 by image 2 only where the image 1 pixels are within a specified hue range. |
IG_IP_color_combine_ex() |
Combines the pixel values from separate 8-bit images to form a single 24-bit color image. |
IG_IP_color_separate() |
The opposite of IG_IP_color_combine_ex(). Separates a 24-bit image's Red, Green, and Blue color values, producing separate 8-bit grayscale images (each with their own HIGEAR handle). |
IG_IP_blend_percent() |
Blends together the pixel values (if grayscale) or color values (if 24-bit) of the two images, according to a percent parameter that you specify. You can specify, for example, to combine 80% of image 1's value, with 20% of image 2's value. For a 24-bit image, you can specify that only one color channel (Red, Green, or Blue), or that all three color channels, are to be blended. |
When you use IG_IP_blend_with_LUT(), you provide the address of a 256-byte Look-Up Table (LUT). ImageGear looks up image 1's pixel value or color value in your LUT to determine the percentages to blend for that pixel.
A different kind of blend is provided by Special Effects function IG_FX_chroma_key(). This function searches for pixels in image 1 that are within a color hue range that you specify. Only pixels within that color hue range are replaced from image 2. Arguments are provided for you to control the smoothness of the transition where replacement occurs, and a threshold pixel darkness below which replacement will not occur. You might use this to remove a person's picture from a plain background and to replace the original background with a new one. TV stations often use this technique to overlay the weather reporter onto a background of a weather map.
IG_IP_color_combine_ex() and IG_IP_color_separate() let you, respectively, assemble a 24-bit image from separate 8-bit gray level images, or disassemble a 24-bit image into separate 8-bit gray level images. In both cases, you can specify whether the 24-bit combination is standard RGB, or whether or not the 24-bit value is to be interpreted in terms of a different color space scheme. You may specify IG_COLOR_SPACE_RGB, or IG_COLOR_SPACE_IHS, or others. The complete list of supported color space schemes is provided in the file accucnst.h.