LJMUAstroecology / flirpy

Python library to interact with FLIR camera cores
Other
186 stars 54 forks source link

How to convert thermal image to temperature values? #97

Closed aatefi2 closed 3 days ago

aatefi2 commented 1 week ago

Hi,

I have a MicaSense Altum-PT camera which uses "320 x 256 FLIR Boson" as its thermal sensor. The saved thermal images are completely gray color. The raw temperature data is 16 bit (for example: 31399, 31436, 31415,...). From the metadata of the thermal image, I was able to extract 6 values for Thermal Calibration Parameters : 1, 315.60000000000002, 1192951.5, 1509.95947265625, 1, 13831.46484375. using meta.get_item('XMP:ThermalCalibrationParameters'. I am wondering is there any python code from flirpy to calculate the temperature of all pixels of an image? How can I interpret these 6 values of Thermal Calibration Parameters for that code? are the calculated temperature values compensated for atmospheric/air temperature?

Thank you, Abbas

jveitchmichaelis commented 1 week ago

MicaSense has some info here: https://support.micasense.com/hc/en-us/articles/360036377834-Altum-and-Altum-PT-Thermal-Band-FAQ see if that helps!

Most thermal cameras output Kelvin with a scale factor. You shouldn't need to worry about the onboard calibration unless you have concerns that what you're imaging has a significantly different emissivity or as you say. You can look into the Boson-R software IDD document which should have more detail on the metadata.

https://f.hubspotusercontent10.net/hubfs/20335613/boson-sdk-documentation-february-2019.pdf

When processing your thermal data in Pix4D and Agisoft, you may notice that your thermal (LWIR) band output has much higher than expected values. This is because the output units are centi-Kelvin. In order to convert the temperature values from centi-Kelvin to a unit that is easier to interpret, you will need to divide the output by 100 (which gives you Kelvin) and then subtract 273.15 to convert to Celsius.

On Tue, 9 Jul 2024 at 07:02, aatefi2 @.***> wrote:

Hi,

I have a MicaSense Altum-PT camera which uses "320 x 256 FLIR Boson" as its thermal sensor. The saved thermal images are completely gray color. The raw temperature data is 16 bit (for example: 31399, 31436, 31415,...). From the metadata of the thermal image, I was able to extract 6 values for Thermal Calibration Parameters : 1, 315.60000000000002, 1192951.5, 1509.95947265625, 1, 13831.46484375. using meta.get_item('XMP:ThermalCalibrationParameters'. I am wondering is there any python code from flirpy to calculate the temperature of all pixels of an image? How can I interpret these 6 values of Thermal Calibration Parameters for that code? are the calculated temperature values compensated for atmospheric/air temperature?

Thank you, Abbas

— Reply to this email directly, view it on GitHub https://github.com/LJMUAstroecology/flirpy/issues/97, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJY6ELJP34TBHUMF6Q3ZLLO4JAVCNFSM6AAAAABKRM7AXKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4TMMZUHAYTENY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

aatefi2 commented 1 week ago

MicaSense has some info here: https://support.micasense.com/hc/en-us/articles/360036377834-Altum-and-Altum-PT-Thermal-Band-FAQ see if that helps! Most thermal cameras output Kelvin with a scale factor. You shouldn't need to worry about the onboard calibration unless you have concerns that what you're imaging has a significantly different emissivity or as you say. You can look into the Boson-R software IDD document which should have more detail on the metadata. https://f.hubspotusercontent10.net/hubfs/20335613/boson-sdk-documentation-february-2019.pdf When processing your thermal data in Pix4D and Agisoft, you may notice that your thermal (LWIR) band output has much higher than expected values. This is because the output units are centi-Kelvin. In order to convert the temperature values from centi-Kelvin to a unit that is easier to interpret, you will need to divide the output by 100 (which gives you Kelvin) and then subtract 273.15 to convert to Celsius. On Tue, 9 Jul 2024 at 07:02, aatefi2 @.> wrote: Hi, I have a MicaSense Altum-PT camera which uses "320 x 256 FLIR Boson" as its thermal sensor. The saved thermal images are completely gray color. The raw temperature data is 16 bit (for example: 31399, 31436, 31415,...). From the metadata of the thermal image, I was able to extract 6 values for Thermal Calibration Parameters : 1, 315.60000000000002, 1192951.5, 1509.95947265625, 1, 13831.46484375. using meta.get_item('XMP:ThermalCalibrationParameters'. I am wondering is there any python code from flirpy to calculate the temperature of all pixels of an image? How can I interpret these 6 values of Thermal Calibration Parameters for that code? are the calculated temperature values compensated for atmospheric/air temperature? Thank you, Abbas — Reply to this email directly, view it on GitHub <#97>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJY6ELJP34TBHUMF6Q3ZLLO4JAVCNFSM6AAAAABKRM7AXKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4TMMZUHAYTENY . You are receiving this because you are subscribed to this thread.Message ID: @.>

Hi jveitchmichaelis,

Thank you for your comment. I looked at the links, but still could not find a detailed information to map thermal image to pixel temperature values using a python code. I just found this link https://flir.custhelp.com/app/answers/detail/a_id/3321/%7E/flir-cameras---temperature-measurement-formula, but still I am not sure how to use these extracted values in the formula from that link. The issue is, I have already asked MicaSense in this regard, but they suggested me to get the calibration equation from FLIR; I asked FLIR, but they did not answer me yet and I could not find any information for FLIR BOSON camera in this matter.

jveitchmichaelis commented 1 week ago

Unless I'm missing something obvious, have you tried making that conversion?

# Assume frame is a 16-bit numpy array with your data

temps = (frame.astype(np.float32)/100.0) - 273.15

The images should already be calibrated.

(31399/100)-273.15 would map to about 40 C if that's a sensible value for what you're imaging.

aatefi2 commented 1 week ago

Unless I'm missing something obvious, have you tried making that conversion?

# Assume frame is a 16-bit numpy array with your data

temps = (frame.astype(np.float32)/100.0) - 273.15

The images should already be calibrated.

(31399/100)-273.15 would map to about 40 C if that's a sensible value for what you're imaging.

Thank you for your prompt reply. I think your equation is correct since it gives me similar results to temperature data from another camera which had overlap with MicaSense images. The values from that camera is high as well (for example 38, 39, 40,41,... C).

jveitchmichaelis commented 1 week ago

Great, this is just using what MicaSense says in their documentation. The Boson itself has a huge array of radiometry settings that currently aren't supported by Flirpy (something like 60 pages of documented commands), but in most cases you don't need to touch it because the camera will output (scaled) temperature values when in TLINEAR mode.