pixelmap()/pixeltransfer()

New Message Reply Date view Thread view Subject view Author view

Drew Hess (dhess++at++vision.arc.nasa.gov)
Sun, 14 May 1995 21:05:30 -0700


We're a little unclear on how pixelmap() and pixeltransfer() work. We would
like to take an RGB image, rendered in a viewport by Performer, and convert it
via the RE2s color lookup tables to a greyscale image. The mapping is
arbitrary (non-linear). For instance, we might want the following mapping:

Color Image (RGB) ---> Greyscale Image (RGB)
----------------- ---------------------
(255, 255, 255) (0, 0, 0)
(255, 255, 250) (127, 127, 127)
... ...
(0, 0, 0) (40, 40, 40)

Our Performer database has a limited number of colors, something on the order
of 30-40 unique RGB values, so the size of the lookup tables is not an issue.

Currently, we do this by lrectread()ing the Perfomer viewport, doing manual
lookup, and then lrectwrite()ing the greyscale image back to the screen.
 Obviously the performance of the manual lookup leaves something to be desired.

Is this possible with pixelmap() and pixeltransfer()? The man page for
pixelmap() is pretty poor, yet this seems to be all the documentation that
exists for it. If it is in fact possible, I'm not quite sure how to go about
it. It seems to me that there is a many-to-one mapping of RGB triads to a
16-bit value, where the table size is either 256 or 4096 entries, and the
interpretation of the 16-bit value is determined by the mode parameter passed
to pixelmap(). In the above example, if I used a MAP_I_TO_I map via
pixelmap(), wouldn't both (255, 255, 255) and (255, 255, 250) map to the same
LUT entry?

Or are there in fact 3 separate lookups going on here, one for each component
of the original RGB pixel?

Thanks in advance,

-dwh-
dhess++at++cs.stanford.edu
dhess++at++vision.arc.nasa.gov


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:29 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.