Temperature value of each pixel captured by LEPTON

Discussion related to "under the hood" OpenMV topics.
jubi5312
Posts: 19
Joined: Tue Jul 09, 2019 2:05 pm

Temperature value of each pixel captured by LEPTON

Postby jubi5312 » Mon Dec 30, 2019 4:46 pm

Hi,

I use Lepton 3.5 with OpenMV board. I wanted to get the temperature values of each pixel of the frame captured(160*120). Are there any available codes for this. Could the pixel data be accessed in excel?

~Jubin
User avatar
kwagyeman
Posts: 3823
Joined: Sun May 24, 2015 2:10 pm

Re: Temperature value of each pixel captured by LEPTON

Postby kwagyeman » Mon Dec 30, 2019 5:34 pm

Hi, you need to put the camera into a target temperature range mode (see the flir example scripts) and then comment out the code in the example scripts that markup the image with blob locations.

You can then save the image to an SD card or save the image in OpenMV IDE by right clicking on the screen. Please make sure to keep the FLIR Lepton in grayscale mode when doing this do that you have a linear mapping of pixels with value 0-255 as the min/max temperature range you set the FLIR lepton to look for.
Nyamekye,
jubi5312
Posts: 19
Joined: Tue Jul 09, 2019 2:05 pm

Re: Temperature value of each pixel captured by LEPTON

Postby jubi5312 » Fri Jan 03, 2020 2:04 pm

Hi,

I wanted to add the spot-meter feature and read the temperature value of a precise spot(roi) under measurement. I accessed the FLIR LEPTON IDD documentation and it has an example SDK interface code for obtaining spot-meter value, I have attached the snapshot of this). Could you kindly guide me on how to use this code in the OpenMV IDE for the OpenMV Lepton module to work with spot-meter feature. The spot-meter ability on an IR camera enables to measure specific temperature values of an object under study!

Thanking you,
~Jubin
Attachments
Spotmeter C SDK Interface.JPG
jubi5312
Posts: 19
Joined: Tue Jul 09, 2019 2:05 pm

Re: Temperature value of each pixel captured by LEPTON

Postby jubi5312 » Fri Jan 03, 2020 7:44 pm

Hi,

The saved image does not give temperature for each pixel. Is there any way to get temperature for each pixel in the frame?

Thanking you,
Jubin
User avatar
kwagyeman
Posts: 3823
Joined: Sun May 24, 2015 2:10 pm

Re: Temperature value of each pixel captured by LEPTON

Postby kwagyeman » Fri Jan 03, 2020 8:10 pm

Hi, do something like this to get the SPOT-O-Meter value:

Code: Select all

import sensor, struct
data = sensor.ioctl(sensor.IOCTL_LEPTON_GET_ATTRIBUTE, 0x4ED0, 4)
radSpotmeterValue, radSpotmeterMaxValue, radSpotmeterMinValue, radSpotmeterPopulation = struct.unpack("<HHHH", data)
For other commands, you just need to pass the ID hex number and then the size in 16-bit shorts that are read from the device. Then you just have to unpack the data which will be in the order of the struct for the FLIR SDK. For the set operation you'd do a similar thing where you'd call the set attribute and then pass the SDK ID hex number along with a byte array of packed bytes which are the struct in the SDK document to send.
Nyamekye,
User avatar
kwagyeman
Posts: 3823
Joined: Sun May 24, 2015 2:10 pm

Re: Temperature value of each pixel captured by LEPTON

Postby kwagyeman » Fri Jan 03, 2020 8:12 pm

If you want to get the temperature per pixel please run the "lepton target temp hot spot color tracking" example under the FLIR lepton examples. You can set the min and max range which all pixels are mapped to in the image. Then pixels will go from 0-255 within your range you set. To get the temp per pixel you can look at the code in the example.
Nyamekye,
GL-ITC
Posts: 22
Joined: Tue Feb 25, 2020 7:09 am

Re: Temperature value of each pixel captured by LEPTON

Postby GL-ITC » Tue Feb 25, 2020 7:31 am

Hi,

I have a question regarding the colour thresholds and the min and max temperature range. If I set the colour threshold to (120, 255), the minimum temperature to 25 degrees and the maximum temperature to 45 degrees does this mean my minimum temperature is mapped to the 120 greyscale colour or is the minimum temperature mapped to a greyscale value of 0?
User avatar
kwagyeman
Posts: 3823
Joined: Sun May 24, 2015 2:10 pm

Re: Temperature value of each pixel captured by LEPTON

Postby kwagyeman » Tue Feb 25, 2020 2:30 pm

It would be 0. The thresholds are applied on the mapped image. You set a min and max temperature range which maps all pixels on the image to 0 to 255 which represent the min and max temperature range. This is just simple scaling...
Nyamekye,
GL-ITC
Posts: 22
Joined: Tue Feb 25, 2020 7:09 am

Re: Temperature value of each pixel captured by LEPTON

Postby GL-ITC » Tue Feb 25, 2020 2:31 pm

Ok thank you
matiasandina
Posts: 14
Joined: Mon Mar 02, 2020 1:33 pm

Re: Temperature value of each pixel captured by LEPTON

Postby matiasandina » Thu Mar 26, 2020 12:47 pm

Hello,

Just a follow up question.

My script saves .jpg images. If I understood correctly, the max and min temps I selected will be mapped to 0 and 255 into an rgb image. Does this mean that the same rgb image could be actually encoding different temperatures if taken on two sessions with different max and min parameters ?

I think that I will add saving of parameters to be able to rescale everything to a common scale later.
User avatar
kwagyeman
Posts: 3823
Joined: Sun May 24, 2015 2:10 pm

Re: Temperature value of each pixel captured by LEPTON

Postby kwagyeman » Thu Mar 26, 2020 1:32 pm

Yes, I would open a file in python. Just use standard python code to open a text file and write out the file name and the temperature scale you used to that text file log. You can open the file in append mode so that you just append to it.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: MSN [Bot] and 5 guests