Re: [PyOpenGL-Users] False color images
Brought to you by:
mcfletch
From: Nicolas R. <Nic...@in...> - 2012-02-11 11:08:45
|
Have a look at glumpy. Colorization is done using a pixel shader and the colormap is stored in a 1D texture. http://code.google.com/p/glumpy/ Nicolas On Feb 11, 2012, at 0:43 , Gordon Wrigley wrote: > I would think the normal approach would be to use a fragment shader to do a texture lookup, using your 16-bit colors brightness values as the texture coordinate. That would allow a totally arbitrary mapping between input brightness and output color. > > On Sat, Feb 11, 2012 at 10:26 AM, Mike C. Fletcher <mcf...@vr...> wrote: > 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 > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |