Example explanation 12-MLX90640_overlay_smoothed MLX90640 overlay smoothing
import sensor, image, time, fir
IR_SCALE = 4
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
fir.init(type=fir.FIR_MLX90640, refresh=32)
ir_buffer = image.Image(fir.width() * IR_SCALE, fir.height() * IR_SCALE, sensor.GRAYSCALE)
x_scale = sensor.width() / ir_buffer.width()
y_scale = sensor.height() / ir_buffer.height()
clock = time.clock()
while (True):
clock.tick()
img = sensor.snapshot()
ta, ir, to_min, to_max = fir.read_ir()
fir.draw_ir(ir_buffer, ir, alpha=256)
ir_buffer.mean(IR_SCALE-1)
img.draw_image(ir_buffer, 0, 0, x_scale=x_scale, y_scale=y_scale, alpha=128, color_palette=sensor.PALETTE_IRONBOW)
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)
img.compress(quality=90)
print(clock.fps())