例程讲解12-Thermopile-Shield->fir热电堆扩展板

# 热电堆扩展板演示
#
# 注意:要运行这个例子,你需要一个用于你的OpenMV的热电堆扩展板。另外,请在IDE中禁用JPEG模式。
#
# 热电堆扩展板允许您的OpenMV看见热!

import sensor, image, time, fir

# Reset sensor
sensor.reset()

# Set sensor settings
sensor.set_contrast(1)
sensor.set_brightness(0)
sensor.set_saturation(2)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)

# 以下寄存器微调图像传感器窗口,使其与FIR传感器对齐。
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

# 初始化热传感器
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())

星瞳科技OpenMV官方中文文档函数讲解:

results matching ""

    No results matching ""