Re: [PyOpenGL-Users] False color images
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2012-02-10 23:26:12
|
On 12-02-10 05:33 PM, Derakon wrote: > I have a program that displays monochrome camera images, obtained as > Numpy arrays of 16-bit integer pixel brightnesses. I'd like to have a > false-color mode that displays low values as blue and high values as > red, to get some extra contrast and make it easier to tell where the > brightest pixels in the image are. I did some searching around and > about all I can find is some discussion on using color-index mode, > with concern that it's really meant for palettized sprites and isn't > really recommended these days. Is that accurate? > > Presumably this task has been done before; what's the recommended way > to do false color? Especially, I want to be able to rescale what value > is considered the darkest and what the brightest on the fly -- for > example, if I get an image where the distance between darkest and > brightest pixel is only 1000 (~10 bits) then I don't want to be > scaling things as if the brightest pixel is 2^16-1 and the darkest is > 0. > > Any advice would be recommended. Thanks. Why not simply do the scaling in the numpy array? That is, to increase the dynamic range array = array - min( array); array = array * (2**16-1/max(array)) (sorry if I messed up the numbers there, hopefully you get the idea, I have a two year old yelling in my ear at the moment). To do the false-color, you can use a shader, or just duplicate the data into RGB channels. Indexed-color mode is pretty poorly tested/supported these days; it may work, but I can't say I've used it in the last decade or so. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |