seekthermal / seekcamera-python

Python language bindings for the Seek Thermal SDK
Apache License 2.0
45 stars 22 forks source link

How to get the thermal map? #34

Open mokems opened 2 weeks ago

mokems commented 2 weeks ago

From the examples, I can get the thermal image, but how to get the original thermal map?

andi-spajk commented 2 weeks ago

What do you mean by "thermal map?" Like raw data? Temperatures? You need to set the frame format to obtain different types of images. This docstring in the source code tells you all about the different formats (line 2237 in seekcamera/camera.py, in case the link doesn't work).

For example

def on_event(camera, event_type, event_status, user_data):
    if event_type == SeekCameraManagerEvent.CONNECT:
        camera.capture_session_start(SeekCameraFrameFormat.COLOR_ARGB8888)
# etc...

produces a plain RGB jpeg image. If you want multiple formats, use a bitwise OR:

    camera.capture_session_start(SeekCameraFrameFormat.COLOR_ARGB8888 | SeekCameraFrameFormat.PRE_AGC)

This produces an image of sensor counts and an RGB jpeg. You can save either format to a file, whenever you read a frame.

Don't forget, in the frame callback on_frame you need to access the camera frame with the new format, for example:

def on_frame(camera, camera_frame, file):
   frame_data = camera_frame.thermography_fixed_10_6
# etc...