LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert 16bit greyscale pictures to 24bit color pictures

Hi,

I am stuck at coloring 16bit greyscale pictures without losing the resolution of 16bit, as it would happen when using the WindMapping-thing (which reduces the displayed resolution to 8bit).

I figured that what I would need is probably an array consisting of 32536 RGB-color clusters to convert all greyscale values to a color, preferrably a rainbow spectrum.

I tried to create such an array via the HSL-model, where the coding of a rainbow spectrum is easier than in RGB, and then converted it to U32 for obtaining the RGB-colors. The problem here is: Although HSL is 24bit in IMAQ, I can only get about 200 different colors when using constant saturation and luminance. I understand that 24bit is made of 3x8bit for H,S and L. - However, as the HSL-model describes colors as Hue (0-359°); Saturation (0-100%) and Luminance (0-100%) I don't really understand, how those 360 Hue-values could possibly be put into U8-representation required by the IMAQ ColorToRGB-vi.

Does anyone have an idea how to obtain a 24bit-rainbow spectrum coded in 32536 distinct colors other than manually creating all the entries?

The reason I need this is to determine whether it will be necessary to process the images all the way through using I16 or if can be done with U8 as well without losing too much of detail.
I couldn't figure out any other way to DISPLAY true 16bit other than the detour using 24bit pictures. It is only about display, not about processing, which can be well done using the IMAQ I16 format...

Thanks for any input!

C.
0 Kudos
Message 1 of 4
(5,524 Views)
Sorry - of course I want the color array to have 65536 values, not 32536
 - I mixed up I16 and U16 a bit Smiley Wink
0 Kudos
Message 2 of 4
(5,517 Views)
Microsoft Windows (up to XP) can't display 16 bit grey.  You have to convert your image to 8 bit grey (24 bit color is 8bit in Red, Greeen, and Blue each) for display.  Meaning loss a lot of grey levels.
 
Take a look this thread:
 
If your grey levels are distributed evenly, the above method should work.
 
George Zou
 
George Zou
0 Kudos
Message 3 of 4
(5,486 Views)
Thanks for the answer and especially the link, George!

Unfortunately our relevant grey values are distributed over a wide range of about 5000, which I would rather use instead of letting them melt down to 256...Of course - being able to distinguish between 5000 different greyscale values with the human eye is another story!
However - a co-worker of mine came up with the idea of coding the grey values in terms of travelling along the axes of the RGB cube, as shown in the attached image.
0 Kudos
Message 4 of 4
(5,476 Views)