openmv/scripts/examples/Arduino/Nano 33 BLE Sense/04-Thermal/thermal_camera.py
2021-01-06 16:48:10 -08:00

40 lines
842 B
Python

# Thermal Camera Demo
#
# This example shows off how to overlay a heatmap onto your OpenMV Cam's
# live video output from the main camera.
import image, time, fir
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
# Initialize the thermal sensor
fir.init()
w = fir.width()
h = fir.height()
if (fir.type() == fir.FIR_MLX90621):
w = w * 5
h = h * 5
elif (fir.type() == fir.FIR_MLX90640):
w = w * 5
h = h * 5
elif (fir.type() == fir.FIR_AMG8833):
w = w * 10
h = h * 10
# FPS clock
clock = time.clock()
while (True):
clock.tick()
try:
img = fir.snapshot(x_size=w, y_size=h,
color_palette=fir.PALETTE_IRONBOW, hint=drawing_hint,
copy_to_fb=True)
except OSError:
continue
# Print FPS.
print(clock.fps())