# MLX90621 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(type=fir.FIR_MLX90621) w = fir.width() * 20 h = fir.height() * 20 # 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())
# 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 * 10 h = h * 10 elif (fir.type() == fir.FIR_MLX90640): w = w * 10 h = h * 10 elif (fir.type() == fir.FIR_AMG8833): w = w * 20 h = h * 20 # FPS clock clock = time.clock() while (True): clock.tick() try:
# Thermal Camera Demo # # This example shows how to use common low-res FIR sensors (like MLX or AMG). # NOTE: Only the AMG8833 is currently enabled for NANO RP2040. import image, time, fir IMAGE_SCALE = 5 # Higher scaling uses more memory. drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor) # Initialize the thermal sensor fir.init() #Auto-detects the connected sensor. w = fir.width() * IMAGE_SCALE h = fir.height() * IMAGE_SCALE # 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.
# The following registers fine-tune the image # sensor window to align it with the FIR sensor. if (sensor.get_id() == sensor.OV2640): sensor.__write_reg(0xFF, 0x01) # switch to reg bank sensor.__write_reg(0x17, 0x19) # set HSTART sensor.__write_reg(0x18, 0x43) # set HSTOP # Initialize the thermal sensor fir.init() # FPS clock clock = time.clock() # fir region of display fir_height = int(fir.height() * sensor.width() // fir.width()) fir_yoffset = (sensor.height() // 2) - (fir_height // 2) fir_region = [0, fir_yoffset, sensor.width(), fir_height] fir_scale = [0, 35] # Our fir threshold range fir_threshold = [32, 95, -18, 40, -22, 92] # Middle L, A, B values. fps_target = 10 fps_delay_max = 500 fps_delay = 50 fps_delay_inc = 1 dbg_row = 0 learn = False
# MLX90640 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(type=fir.FIR_MLX90640) w = fir.width() * 10 h = fir.height() * 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())
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) # Initialize the thermal sensor fir.init(type=fir.FIR_MLX90640, refresh=16) # Hz (higher end OpenMV Cam's may be able to run faster) # Allocate another frame buffer for smoother video. 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() # FPS clock clock = time.clock() while (True): clock.tick() # Capture an image img = sensor.snapshot() # Capture FIR data