You could take the grayscale image and create scale factors, e.g.
0.0 -> 1.0 for black -> white, then multiply, pixel by pixel, the
RGB color pixels by the grayscale pixels scale . This should imprint
the grayscale image over the color. If you use this scale ( 0.0 ->
1.0 ), the black in the grayscale will create black in the final RGB
color picture ( 0 times anything is 0). So if you didn't want black
in the grayscale to create black in the final RGB picture, you could
scale the grayscale scale factors to say .25 -> 1.0 for black to
white. i.e. (Scale = .25 + (1.0 - .25 ) * GrayPixelValue / 255)
assuming white is 255. Hope this makes some sense.
Just a thought
Lou
On Jan 28, 2007, at 9:54 PM, Peter K. Stys wrote:
Frequently in scientific imaging you need to draw a red, grn and/or
blu image on top of a grayscale image to emulate a 4th "color"
channel.
Building an RGB pic from raw pixel values is easy but what is the
correct math to "add" a grayscale channel to an RGB image? Simply
adding the RGB components of the grayscale image (which are all equal
by definition) to the exisiting R, G and B values of the color image
does not give nice results.
Anyone have any ideas?
Thx,
Peter.
--
----------------------------------------------------------------------
---------
Peter K. Stys, MD
Professor of Medicine(Neurology), Senior Scientist
Ottawa Health Research Institute, Div. of Neuroscience
Ottawa Hospital / University of Ottawa
Ontario, CANADA
tel: (613)761-5444
fax: (613)761-5330
http://www.ohri.ca/profiles/stys.asp
----------------------------------------------------------------------
---------
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>