DJI H20T thermal radiometric jpeg file

Started by Jonathan McGillivray, July 09, 2020, 06:56:25 AM

Previous topic - Next topic

Drone Link

Hey all,

I know im late to the party, but whats the latest on this issue? It seems to me the prevailing options are:
dji_h20t_rpeg_to_tif-main; by tejakattenborn
or traitement_temperature; by Remi

Is there anything more up to date? Would love to be updated on whats happened.
Thanks

pierotofy

I've started digging into this. To get the raw, uncorrected Celsius values one needs to apply the following formula to ThermalData:

celsius = ((raw_int16 >> 2) * 0.0625) - 273.15

from PIL import Image
import numpy as np

im = Image.open("/datasets/dji_thermal/images/DJI_20240520212354_0001_T.JPG")

# concatenate APP3 chunks
a = im.applist[3][1]
for i in range(4, 14):
    a += im.applist[i][1]

raw = np.array(Image.frombytes('I;16L', (640, 512), a), np.int16)
celsius = np.right_shift(raw, 2).astype(np.float32)
celsius *= 0.0625
celsius -= 273.15

Image.fromarray(celsius).save('/datasets/dji_thermal/celsius.tiff')

DJI applies some sort of correction based on temperature, distance, emissivity and humidity. I'm still looking into that.


piero.dev

josemariagarcia

Thanks for your contribution @pierotofy!!

I'm new to this world of processing thermographies and such low-level data and I was getting really frustrated.

Is there any other way to get this Celsius temperature directly from a R-JPEG? I thought that would be possible using the DJI SDK from Python, calling it with subprocess, but all the outputs I managed to produce, they couldn't either be opened by Image Viewer apps nor Python Image Handling modules.

Thanks in advance!

Remo

Very helpful work pierotofy, thank you very much. I applied your formula but still got some irregular differences compared to the values which I got from the DJI Thermal SDK. What exactly is the factor 0.0625? Is it stored in the r-jpg as well, or is it a kind of constant "DJI calibration factor"?