• 免费好用的星瞳AI云服务上线!简单标注,云端训练,支持OpenMV H7和OpenMV H7 Plus。可以替代edge impulse。 https://forum.singtown.com/topic/9519
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 各位大佬,如何使用Mlx90640模块测温测5s/或10s后,输出这期间测的平均值,之前写的这个感觉并不能解决问题



    •  i=10
          t=1
          dist = 0
          for t in range(1, i+1):
              #d1为温度值 
              dist = to_max + dist #计算d0 d1即样本图像与被检测人脸的特征差异度。
              t=t+1
              #print("Average Temp : %0.2f"% to_max/i)
      


    • 请提供全部的,可以执行的代码,否则我没办法调试。



    •  while (True):
                  clock.tick()
      
                  # 捕捉图像
                  img = sensor.snapshot()
      
                  # Capture FIR data
                  # 捕捉FIR数据
                  #   ta: Ambient temperaturev 环境温度
                  #   ir: Object temperatures (IR array) 物体温度(IR 阵列)
                  #   to_min: Minimum object temperature 最小物体温度
                  #   to_max: Maximum object temperature 最大物体温度
                  ta, ir, to_min, to_max = fir.read_ir()
                  to_max=to_max/0.92
                  # 创建一个副图像,然后混合到帧缓冲区中。
      
                  # 转换FIR数据为灰度图像并缩放
                  fir.draw_ir(ir_buffer, ir, alpha=256)
      
                  # 平滑缩放后的图像
                  ir_buffer.mean(IR_SCALE-1)
      
                  # 使用调色板将灰度FIR图像转换为彩色,并与相机图像相结合
                  img.draw_image(ir_buffer, 200, 0, alpha=256,color_palette=sensor.PALETTE_IRONBOW)
      
                  # 绘制环境温度、最小温度和最大温度。
                  #img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0),scale = 2,  mono_space = False)
                  #img.draw_string(8, 16, "To min: %0.2f C" % to_min, color = (255, 0, 0),scale = 2,  mono_space = False)
                  img.draw_string(200, 96, "Temp: %0.2f C"% to_max, color = (255, 0, 0),scale = 2,  mono_space = False)
                  i=1600
                  t=1
                  dist = 0
                  for t in range(1, i+1):
                      #d1为温度值
                      dist = to_max + dist #计算d0 d1即样本图像与被检测人脸的特征差异度。
                      t=t+1
                   
                      print("%0.2f °C"% float(dist/2))
      

      我想做到将mlx90640这5s内或10s内测的温,然后输出这5s内测出的平均值。大佬,怎么实现,我这个没实现成功。



    • 你的代码不全所以没法测试,大概就是下面的代码的意思:

      温度数组 = []
      while (True):
                  clock.tick()
                  img = sensor.snapshot()
                  ta, ir, to_min, to_max = fir.read_ir()
                  to_max=to_max/0.92
                  fir.draw_ir(ir_buffer, ir, alpha=256)
                  ir_buffer.mean(IR_SCALE-1)
                  img.draw_image(ir_buffer, 200, 0, alpha=256,color_palette=sensor.PALETTE_IRONBOW)
                  #img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0),scale = 2,  mono_space = False)
                  #img.draw_string(8, 16, "To min: %0.2f C" % to_min, color = (255, 0, 0),scale = 2,  mono_space = False)
                  img.draw_string(200, 96, "Temp: %0.2f C"% to_max, color = (255, 0, 0),scale = 2,  mono_space = False)
                  温度数组.append(ta)
                  if(len(温度数组) > 100):
                      温度数组.pop(0)
                  平均数 = sum(温度数组)/len(温度数组)
                  print(平均数)
      


    • # MLX90640叠加演示与红外平滑
      # 将热图覆盖到主摄像头的OpenMV摄像头的实时视频输出上。
      
      import sensor, image, time, fir
      import utime
      
      
      IR_SCALE = 4
      
      sensor.reset()
      #初始化摄像头,reset()是sensor模块里面的函数
      
      sensor.set_pixformat(sensor.RGB565)
      #设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种
      
      sensor.set_framesize(sensor.QVGA)
      #设置图像像素大小
      
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      #垂直方向翻转180°,水平方向翻转180°
      
      sensor.skip_frames(time = 2000)
      
      # 初始化热传感器
      fir.init(type=fir.FIR_MLX90640, refresh=16) # 16Hz, 32Hz or 64Hz.
      
      # 为更流畅的视频分配另一个帧缓冲。
      ir_buffer = image.Image(fir.width() * IR_SCALE, fir.height() * IR_SCALE, sensor.GRAYSCALE)
      
      # FPS clock
      clock = time.clock()
      #y = 1
      TEMP = []
      while (True):
      
          clock.tick()
          # 捕捉图像
          img = sensor.snapshot()
      
          # Capture FIR data
          # 捕捉FIR数据
          #   ta: Ambient temperaturev 环境温度
          #   ir: Object temperatures (IR array) 物体温度(IR 阵列)
          #   to_min: Minimum object temperature 最小物体温度
          #   to_max: Maximum object temperature 最大物体温度
          ta, ir, to_min, to_max = fir.read_ir()
          to_max=to_max/0.92
          # 创建一个副图像,然后混合到帧缓冲区中。
      
          # 转换FIR数据为灰度图像并缩放
          fir.draw_ir(ir_buffer, ir, alpha=256)
      
          # 平滑缩放后的图像
          ir_buffer.mean(IR_SCALE-1)
      
          # 使用调色板将灰度FIR图像转换为彩色,并与相机图像相结合
          img.draw_image(ir_buffer, 200, 0, alpha=256,color_palette=sensor.PALETTE_IRONBOW)
      
          # 绘制环境温度、最小温度和最大温度。
          #img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0),scale = 2,  mono_space = False)
          #img.draw_string(8, 16, "To min: %0.2f C" % to_min, color = (255, 0, 0),scale = 2,  mono_space = False)
          img.draw_string(200, 96, "Temp: %0.2f C"% to_max, color = (255, 0, 0),scale = 2,  mono_space = False)
          TEMP.append(to_max)
          if(len(TEMP) > 1000):
              TEMP.pop(0)
          avg = sum(TEMP)/len(TEMP)
          AVG = []
          AVG.append(avg)
          if(len(AVG) > 50):
              AVG.pop(0)
          tyt = sum(AVG)/len(AVG)
          print(tyt)
      

      照您的方法写了以后 还是在一直输出数据,如何做到测5s 3s的只输出一个平均值,然后跳出循环。



    • 温度数组 = []
      while (True):
                  clock.tick()
                  img = sensor.snapshot()
                  ta, ir, to_min, to_max = fir.read_ir()
                  to_max=to_max/0.92
                  fir.draw_ir(ir_buffer, ir, alpha=256)
                  ir_buffer.mean(IR_SCALE-1)
                  img.draw_image(ir_buffer, 200, 0, alpha=256,color_palette=sensor.PALETTE_IRONBOW)
                  #img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0),scale = 2,  mono_space = False)
                  #img.draw_string(8, 16, "To min: %0.2f C" % to_min, color = (255, 0, 0),scale = 2,  mono_space = False)
                  img.draw_string(200, 96, "Temp: %0.2f C"% to_max, color = (255, 0, 0),scale = 2,  mono_space = False)
                  温度数组.append(ta)
                  if(len(温度数组) > 100):
                      平均数 = sum(温度数组)/len(温度数组)
                      print(平均数)
                      break
      print("跳出循环")