单色 RGB565 色块跟踪示例
import csi
import time
import image
threshold_list = [(70, 100, -30, 40, 20, 100)]
min_temp_in_celsius = 20
max_temp_in_celsius = 40
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QQVGA)
csi0.color_palette(image.PALETTE_IRONBOW)
csi0.ioctl(csi.IOCTL_LEPTON_SET_MODE, True)
csi0.ioctl(csi.IOCTL_LEPTON_SET_RANGE, min_temp_in_celsius, max_temp_in_celsius)
csi0.snapshot(time=5000)
clock = time.clock()
print("Radiometry: " + "Yes" if csi0.ioctl(csi.IOCTL_LEPTON_GET_RADIOMETRY) else "No")
print("Resolution: %dx%d" % (csi0.ioctl(csi.IOCTL_LEPTON_GET_WIDTH), csi0.ioctl(csi.IOCTL_LEPTON_GET_HEIGHT)))
while True:
clock.tick()
img = csi0.snapshot()
for blob in img.find_blobs(
threshold_list, pixels_threshold=200, area_threshold=200, merge=True
):
img.draw_detection(blob)
print(
"FPS %f - Lepton Temp: %f C"
% (clock.fps(), csi0.ioctl(csi.IOCTL_LEPTON_GET_FPA_TEMP))
)