LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

colour map inversion

Hello All,

 

I am working with a thermal camera and managed to acquire a simple 5 second video. The camera only displays the max and minimum values of the present temperature range on a colour bar.

Is there a way in LabVIEW to invert the displayed colourmap recorded in the video and get exact temperature values for each colour? 

 

Thank you for your help in advance!

Attila

0 Kudos
Message 1 of 10
(4,916 Views)

Yes, almost certainly. But before you do, are you certain you can't get the data directly via a different function from the camera?

 

If you really need to invert, it should be possible to get the colour values of the image and use some spatial interpolation between limiting values along the scale to get a lookup dictionary. 

 

I don't know of a way to create a colour based interpolation though - maybe someone else knows a way but if not you'll need to get a value from the scale for every included colour.


GCentral
0 Kudos
Message 2 of 10
(4,890 Views)

Unfortunately, I can't. It only displays the max and min value but no interim values. Thank you for your help though. 

0 Kudos
Message 3 of 10
(4,864 Views)

@fg.attila wrote:

Unfortunately, I can't. It only displays the max and min value but no interim values. Thank you for your help though. 


There isn't a scale bar?


GCentral
0 Kudos
Message 4 of 10
(4,856 Views)

So you have a colormap, most likely U8, for 256 colors and you have a min and max. It is a simple matter of looking up a color value in the map to get its index (0..255), then linearly (presumably) interpolate between max&min according to the fractional value

 

T = Tmin + (Tmax-Tmin) * (color_index/255)

 

... or similar. 

Message 5 of 10
(4,853 Views)

Perhaps you could share a frame of this video so that we're all on the same page? It would likely also improve the chances of us being able to prototype some code or give feedback on your code.


GCentral
0 Kudos
Message 6 of 10
(4,838 Views)

Thank you for your help so far!

Here is a frame from the video that might help, as suggested 🙂

The video was recorded in grayscale, however the grayscale setting was done on the camera itself. I have attached zip containing a bmp and a png with vision info of the same frame. I hope this helps and will be able to help me.

Thank you for your help!

 

0 Kudos
Message 7 of 10
(4,822 Views)

Hi fg,

 

using grayscale simplifies your problem quite a lot…

 

The "smallest" color in your image/scale bar is 0x181818 (9% dark gray), the highest 0xE6E6E6 (90% light gray). All you need to do is to scale each pixel gray value using the numbers in the image!

temp = (pixel-value - 0x18) × (27.2 - 23.1) / (0xE6 - 0x18) + 23.1 (simple linear scaling!)

 

(Hint: apply additional rules for pixel values outside the color bar range.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,818 Views)

Some quick example code is attached. I just took the maximum and minimum values for the reference points, but these (at least, the ones found) aren't actually in the scale bar, so take care to get real values for your actual code.

The equation used is, as altenbach and GerdW pointed out already, only a linear scaling between two points.

I made the found indices blink and used a zoom factor to allow you to find them (the minimum is on the bottom edge and the maximum is close to the 7).

Apologies if the front panel is a little large for your resolution (I don't know what resolution you have).


GCentral
Message 9 of 10
(4,808 Views)

Thank you all for your help. It seems that your ideas/suggestions helped!

0 Kudos
Message 10 of 10
(4,779 Views)