@kidswong999 你好固件版本如何查看
M
myv6
@myv6
0
声望
5
楼层
442
资料浏览
0
粉丝
0
关注
myv6 发布的帖子
-
RE: 这个如何解决,之前用着是没有问题着
import sensor, image, time, math from pyb import UART uart = UART(3,115200) threshold_list = [(200, 255)] min_temp_in_celsius = 20.0 max_temp_in_celsius = 40.0 print("Resetting Lepton...") sensor.reset() sensor.ioctl(sensor.IOCTL_LEPTON_SET_MEASUREMENT_MODE, True) sensor.ioctl(sensor.IOCTL_LEPTON_SET_MEASUREMENT_RANGE, min_temp_in_celsius, max_temp_in_celsius) 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.QQVGA) clock = time.clock() def map_g_to_temp(g): return ((g * (max_temp_in_celsius - min_temp_in_celsius)) / 255.0) + min_temp_in_celsius while(True): clock.tick() if (uart.any()): if b'r' in uart.read(): img = sensor.snapshot() blob_stats = [] blobs = img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True) for blob in blobs: blob_stats.append((blob.x(), blob.y(), map_g_to_temp(img.get_statistics(thresholds=threshold_list, roi=blob.rect()).mean()))) img.to_rainbow(color_palette=sensor.PALETTE_IRONBOW) img.to_rainbow() for blob in blobs: img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) for blob_stat in blob_stats: img.draw_string(blob_stat[0], blob_stat[1] - 10, "%.2f C" % blob_stat[2], mono_space=False) uart.write("start") uart.write(str(blob_stats)) uart.write("end") uart.write(img.compressed(quality=50)) print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)))