Example: 50-OpenMV-Boards/60-Shields/62-Thermopile-Shield/thermal_overlay_lcd.py
import sensor
import image
import time
import fir
import display
drawing_hint = image.BICUBIC | image.CENTER | image.SCALE_ASPECT_KEEP
ALT_OVERLAY = False
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA2)
sensor.skip_frames(time=2000)
fir.init()
lcd = display.SPIDisplay()
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
try:
ta, ir, to_min, to_max = fir.read_ir()
except OSError:
continue
if not ALT_OVERLAY:
fir.draw_ir(img, ir, hint=drawing_hint)
else:
extra_fb.clear()
fir.draw_ir(extra_fb, ir, hint=drawing_hint)
img.blend(extra_fb, alpha=128)
img.draw_string(8, 0, "Ta: %0.2f C" % ta, color=(255, 0, 0), mono_space=False)
img.draw_string(
8, 8, "To min: %0.2f C" % to_min, color=(255, 0, 0), mono_space=False
)
img.draw_string(
8, 16, "To max: %0.2f C" % to_max, color=(255, 0, 0), mono_space=False
)
lcd.write(img)
img.to_jpeg(quality=90)
print(clock.fps())