RT1062接Lepton出现花点,温度值偏差大
-
# This work is licensed under the MIT license. # Copyright (c) 2013-2023 OpenMV LLC. All rights reserved. # https://github.com/openmv/openmv/blob/master/LICENSE # # Lepton Get Object High Temp Example # # This example shows off how to get an object's temperature using color tracking. # By turning the AGC off and setting a max and min temperature range you can make the lepton into # a great sensor for seeing objects of a particular temperature. That said, the FLIR lepton is a # microblobometer and not a thermophile. So, it needs to re-calibrate itself often (which is called # flat-field-correction - FFC). Additionally, microblobmeter devices require pprocessing support # onboard to deal with the effects of temperature drift which is called radiometry support. # FLIR Lepton Shutter Note: FLIR Leptons with radiometry and a shutter will pause the video often # as they heatup to re-calibrate. This will happen less and less often as the sensor temperature # stabilizes. You can force the re-calibration to not happen if you need to via the lepton API. # However, it is not recommended because the image will degrade overtime. # If you are using a LEPTON other than the Lepton 3.5 this script may not work perfectly as other # leptons don't have radiometry support or they don't activate their calibration process often # enough to deal with temperature changes (FLIR 2.5). import sensor import time # Color Tracking Thresholds (Grayscale Min, Grayscale Max) threshold_list = [(100, 255)] # track very hot objects # Set the target temp range here # 500C is the maximum the Lepton 3.5 sensor can measure # At room temperature it's max is ~380C min_temp_in_celsius = 0.0 max_temp_in_celsius = 100.0 print("Resetting Lepton...") # These settings are applied on reset sensor.reset() # Enable measurement mode with high temp sensor.ioctl(sensor.IOCTL_LEPTON_SET_MEASUREMENT_MODE, True, 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) sensor.skip_frames(time=5000) clock = time.clock() # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # camera resolution. "merge=True" merges all overlapping blobs in the image. 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() img = sensor.snapshot() for blob in img.find_blobs( threshold_list, pixels_threshold=200, area_threshold=200, merge=True ): stats = img.get_statistics(thresholds=threshold_list, roi=blob.rect()) img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) img.draw_string( blob.x(), blob.y() - 10, "%.2f C" % map_g_to_temp(stats.mean()), mono_space=False, ) print( "FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)) ) 
是用的IDE版本是4.4.7。固件版本是4.5.9。板子型号是openMV Cam RT1062 Legacy。请问怎么可以使用这个连续测温模式?
-
@3azq 在代码中取消sensor.ioctl(sensor.IOCTL_LEPTON_SET_MEASUREMENT_MODE, True, True),也就是取消测温模式和连续测温后,画面恢复正常,但是温度值明显不对
-
开启sensor.ioctl(sensor.IOCTL_LEPTON_SET_MEASUREMENT_MODE, True, True)后,直接花屏
-
- 必须升级固件,现在是4.6.20
- 运行这个代码:
# 本作品采用MIT许可证授权。 # 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。 # https://github.com/openmv/openmv/blob/master/LICENSE # # Lepton 获取物体温度示例 # # This example shows off how to get an object's temperature using color tracking. # By turning the AGC off and setting a max and min temperature range you can make the lepton into # a great sensor for seeing objects of a particular temperature. That said, the FLIR lepton is a # microblobometer and not a thermophile. So, it needs to re-calibrate itself often (which is called # flat-field-correction - FFC). Additionally, microblobmeter devices require pprocessing support # onboard to deal with the effects of temperature drift which is called radiometry support. # FLIR Lepton Shutter Note: FLIR Leptons with radiometry and a shutter will pause the video often # as they heatup to re-calibrate. This will happen less and less often as the sensor temperature # stabilizes. You can force the re-calibration to not happen if you need to via the lepton API. # However, it is not recommended because the image will degrade overtime. # 如果您使用的LEPTON不是Lepton 3.5,此脚本可能无法完美运行,因为其他 # 其他lepton没有辐射测量支持,或者它们的校准过程不够频繁 # 以应对温度变化(FLIR 2.5)。 import sensor import time import image # 颜色跟踪阈值(灰度最小值,灰度最大值) 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_MODE, True) sensor.ioctl( sensor.IOCTL_LEPTON_SET_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) sensor.skip_frames(time=5000) clock = time.clock() # 只有像素数超过“pixel_threshold”且面积超过“area_threshold”的blob才会被 # “find_blobs”返回。如果更改了“pixels_threshold”和“area_threshold”,请进行相应调整。 # 相机分辨率。"merge=True" 合并图像中所有重叠的斑点。 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() 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=image.PALETTE_IRONBOW) # 为其上色 # 在彩色图像上绘制内容 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 ) print( "FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMP)) )
-
好的,已解决。谢谢!