LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array values to color image

Hi,

 

I have developed a code that enables me to read grayscale images from a proprietary file format under Labview (using Vision Development module) and I calculated the real temperature of each pixel given properties of the material or the environment. I have a 2D array of temperatures for one image (320*240) ranging from around 20°C to 850°C and I would like to display that array as a color image.

 

I think that I have to create 3 2D arrays of U8 integers which will represent the R,G,B values, and then use tools from Vision as Imaq ColorValue to Integer to create U32 integers and link this to Imaq ArrayToColorImage. I would like to have the same colors for my temperatures as gives the rainbow palette on images. I found in the NI Vision Concepts Manual, the different ranges of R,G,B for the rainbow palette...

 

But how can I do to set the max temp to a red color, the min temp to a blue color and adpat the range of temperature to a color display ?

 

Thanks for the help.

 

 

PS: I have tried to start with a little example, a small 2D array of values from 0 to 100 and display it as a color image (100 for red, 0 for blue...) but still without success!

0 Kudos
Message 1 of 6
(5,794 Views)

Hi Christoph,

 

what about using a "simple" intensity chart? Here you can define under-/overrange colors easily...

 

See my message (#7) in this thread showing an intensity chart using this feature.

Message Edited by GerdW on 07-08-2009 03:28 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(5,782 Views)

Thanks for your quick reply GerdW. I haven't looked yet at the link but i will after this post.

 

 

To explain better what i am trying to obtain, I post a simple VI that generates a 10*10 array of random numbers. I get the 256 RGB values of the Rainbow Palette but I don't know how to link the values of the array to these...

 

 

 

[EDIT] Thanks again for the idea of using an intensity graph!! It looks like a good way to perform what I need. I will work on it and report if i have more difficulties!

Message Edited by christophe69000 on 07-08-2009 09:08 AM
0 Kudos
Message 3 of 6
(5,763 Views)

Hi Christophe,

 

see attached example. As written in the old thread: color #0 is vor underrange, color #255 for overrange values...

 

(I don't have IMAQ, so replaced your IMAQ function with a control.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(5,753 Views)

I would not recommend using a full color spectrum to represent temperature data.  While it is pretty and flashy, it is also "nonlinear" in that your eye does not interpret a linear change in hue with a linear change in color.  Consider the following images.  The top one is a linear sweep in hue from left to right.  The bottom is a linear sweep in color from light pink to dark navy.  In the top image, note the rapid changes in color around the yellow, cyan, and magenta areas with broad areas of almost the same color in the red, green, and blue areas.  The bottom graph is a smooth transition from one end to the other, allowing even color blind individuals to see the differences due to a change in intensity as well as color.  It also prints on a black/white printer much better.  Both are easy to implement as an intensity graph, but the second should work better for your application.

 

 

 

 

Message Edited by DFGray on 07-08-2009 09:55 AM
Download All
Message 5 of 6
(5,750 Views)

If you want each temperature to have a fixed specific color than you have to remap you temperature data to the range 0-255 and apply a color table to the image display using IMAQ Vision.

 

If you just want the lowest temperature in your image to be blue and the highest temperature value to be red (regardless of the exact value) than you feed you image data into a 32bit grayscale image and display it with an applied colortable.

 

Color tables consist of 255 elements of RGB values (each U8).

 

Do you need more details?

 

 

Message 6 of 6
(5,687 Views)