I'm using a Anafi Parrot Thermal drone which has a thermal camera. It's been quite a struggle to do things with this drone as the support for the Olympe library is quite bad, however, I'm finally able to get a somewhat different image taken with a thermal camera. The thing is that I don't know how to get the temperature values from this image, since it's just a Grayscale image itself, I've seen there are some formulas to do this but I'm quite lost at this point. I'm doing all of this using Python and the Olympe library.
First photo with no hot objects
On this second image I had some fire to compare the images:
I'll include a bit of my code, but I already tried setting different parameters for everything and the best results I can get are with this settings:
def setup_photo_burst_mode(drone):
drone(set_mode(mode="standard")) # command message olympe.messages.thermal.set_mode(mode, _timeout=10, _no_expect=False, _float_tol=(1e-07, 1e-09))
# Thermal modes standard, disabled, blended. Should disable camera? cam_id 1 apparently is for video only.
# No Thermal support for streaming video.
drone(set_rendering(mode="thermal", blending_rate=0))
drone(set_palette_part(red=0, green=0, blue=0, index=0, list_flags=""))
drone(set_palette_settings(mode="relative", lowest_temp=273, highest_temp=314, outside_colorization="limited",
relative_range="unlocked", spot_type="hot", spot_threshold=290))
drone(set_sensitivity(range="low"))
drone(set_emissivity(emissivity=1))
drone(set_camera_mode(cam_id=1, value="photo")).wait()
drone(
set_photo_mode(
cam_id=1,
mode="single",
format="rectilinear",
file_format="dng_jpeg",
burst="burst_14_over_1s",
bracketing="preset_1ev",
capture_interval=0.0,
)
).wait().success()
I've tried different photo modes in the Python program itself, and also doing some Gray16 conversions but so far I've got nothing.
I'll preface this by saying: I'm not familiar with Olympe or your system. The documentation certainly seem quite confusing.
So, in the absence of any indication on the type of thermal camera you have on your drone, I can only assume that the scale is linear.
If you know the minimum and maximum temperatures admissible in your photo (which you should be able to get either by setting them yourself, as you do in your code snippet; or by looking at the palette_settings
message event thing when you take your photo), you should be able to just linearly scale the pixel values to get their temperature as follows :
pixel_temp = (pixel_value / 255.) * (highest_temp - lowest_temp) + lowest_temp