例程讲解27-Lepton-> lepton_hotspot_rgb565_color_tracking 热点彩色颜色追踪

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

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



import sensor, image, time, math

# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
threshold_list = [( 70, 100,  -30,   40,   20,  100)]

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"))
# Make the color palette cool
sensor.set_color_palette(sensor.PALETTE_IRONBOW)

sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time=5000)
clock = time.clock()

# 只有像素数大于“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())
        img.draw_cross(blob.cx(), blob.cy())
    print(clock.fps())

results matching ""

    No results matching ""