예제 #1
0
# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    # Capture an image
    img = sensor.snapshot()

    # Capture FIR data
    #   ta: Ambient temperature
    #   ir: Object temperatures (IR array)
    #   to_min: Minimum object temperature
    #   to_max: Maximum object temperature
    try:
        ta, ir, to_min, to_max = fir.read_ir()
    except OSError:
        continue

    if not ALT_OVERLAY:
        # Scale the image and belnd it with the framebuffer
        fir.draw_ir(img, ir, hint=drawing_hint)
    else:
        # Create a secondary image and then blend into the frame buffer.
        extra_fb.clear()
        fir.draw_ir(extra_fb, ir, alpha=256, hint=drawing_hint)
        img.blend(extra_fb, alpha=128)

    # Draw ambient, min and max temperatures.
    img.draw_string(8,
                    0,
예제 #2
0
# Initialize the thermal sensor
fir.init()

# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    # Capture an image
    image = sensor.snapshot()

    # Capture FIR data
    #   ta: Ambient temperature
    #   ir: Object temperatures (IR array)
    #   to_min: Minimum object temperature
    #   to_max: Maximum object temperature
    ta, ir, to_min, to_max = fir.read_ir()

    # Scale the image and belnd it with the framebuffer
    fir.draw_ir(image, ir)

    # Draw ambient, min and max temperatures.
    image.draw_string(0, 0, "Ta: %0.2f"%ta, color = (0xFF, 0x00, 0x00))
    image.draw_string(0, 8, "To min: %0.2f"%to_min, color = (0xFF, 0x00, 0x00))
    image.draw_string(0, 16, "To max: %0.2f"%to_max, color = (0xFF, 0x00, 0x00))

    # Print FPS.
    print(clock.fps())