例程讲解27-Lepton-> lepton_hotspot_grayscale_color_tracking_lcd 热点灰度颜色追踪LCD显示

# 单颜色灰度色块追踪示例
#
# 此示例展示了如何使用灰度颜色跟踪获取对象的温度。

# FLIR Lepton快门注意事项:带有辐射测量和快门的FLIR Leptons会在加热重新校准时经常暂停视频。
# 随着传感器温度的稳定,这种情况会越来越少发生。
# 如果通过Lepton API,您可以强制重新校准。
# 但是,建议不要这样做,因为图像会随着时间的推移而降低。


import sensor, image, time, math, lcd

# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)]

print("Resetting Lepton...")
# These settings are applied on reset
sensor.reset()
print("Lepton Res (%dx%d)" % (sensor.ioctl(sensor.IOCTL_LEPTON_GET_WIDTH),
                              sensor.ioctl(sensor.IOCTL_LEPTON_GET_HEIGHT)))
print("Radiometry Available: " + ("Yes" if sensor.ioctl(sensor.IOCTL_LEPTON_GET_RADIOMETRY) else "No"))

sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time=5000)
clock = time.clock()
lcd.init()

# 只有像素数大于“pixel_threshold”且面积大于“area_threshold”的blob才会被下面的“find_blobs”返回。
# 如果更改相机分辨率,请更改“pixels_threshold”和“area_threshold”。
# “merge = True”合并图像中的所有重叠blob。


while(True):
    clock.tick()
    img = sensor.snapshot()
    for blob in img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True):
        img.draw_rectangle(blob.rect(), color=127)
        img.draw_cross(blob.cx(), blob.cy(), color=127)
    lcd.display(img)
    print(clock.fps())

results matching ""

    No results matching ""