Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

:RESIZE-IMAGE

source files: xcmp.[ch], xg.3d.imageops-cmp.lsp

SYNTAX

(require "xg.3d.imageops-xcmp")

(send <image-grl> :COMPOSITE
      :MASK        <grl:mask-grl>
      :TYPE        { :HUE | :COLOR | :SCALE }
    [ :COLOR       '( <flo:red> <flo:green> <flo:blue> ) ]
    [ :HUE         <flo:hue> ]
    [ :SATURATION  <flo:saturation> ]
    [ :SCALE       <flo:scale> ]
)

A simple image compositing method. At the moment, image-grl and mask-grl are assumed to be same-size greyscale images with intensity information stored in a :PIXEL-GREEN array.

Currently supported compositing types are:

:COLOR
Masked regions are set to the color specified by the :COLOR keyword.
:HUE
The hue of the masked regions is altered, but the approximate brightness is maintained. This has the effect of placing a colored filter over the original image. This composite operation works by using the HLS color space instead of RGB, with the original intensity mapped to lightness (L), and the hue (H) and saturation (S) set by keyword args of the same name. (See p. 596 of the Foley & van Dam graphics book for more detail.) Saturation has a range from 0 to 1. Hue has a range from 0 to 360 degrees; some sample hue/color correspondences are: @multitable {300} {magenta}
HUE @tab COLOR
0 @tab red
60 @tab yellow
120 @tab green
180 @tab cyan
240 @tab blue
300 @tab magenta
360 @tab red
:SCALE
Scale pixels outside the mask by :SCALE. (For example, scaling by 0 will make unmasked regions black.)

NOTE: There's lots that could be added to this method. For example, the current operations treat the mask image as binary; any non-zero entries are considered "on". It would be nice to treat this like an alpha channel and do proper blending. Another handy keyword would be :INVERT, to invert the mask image before filtering.


Go to the first, previous, next, last section, table of contents.