• 免费好用的星瞳AI云服务上线!简单标注,云端训练,支持OpenMV H7和OpenMV H7 Plus。可以替代edge impulse。 https://forum.singtown.com/topic/9519
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 在使用for遍历之前加上while之后帧缓存区卡死,程序仍在进行?



    • c=1
      while c<=6:
          #print(type(s))
          a=s.replace('+','')
          #print(a)
          if c==1:
              num=a[0]
              print(num)
          if c==2:
              num=a[1]
              print(num)
          if c==3:
              num=a[2]
              print(num)
          if c==4:
              num=a[3]
              print(num)
          if c==5:
              num=a[4]
              print(num)
          if c==6:
              num=a[5]
              print(num)
      
          clock = time.clock()
          img = sensor.snapshot().lens_corr(1.8)
          blobs = img.find_blobs([red_threshold_01], pixels_threshold=100, area_threshold=100, merge=True, margin=10);
          blobs1 = img.find_blobs([green_threshold_01], pixels_threshold=100, area_threshold=100, merge=True, margin=10);
          blobs2 = img.find_blobs([blue_threshold_01], pixels_threshold=100, area_threshold=100, merge=True, margin=10);
          cx=0;cy=0;cx1=0;cy1=0;cx2=0;cy2=0;
      
          for R in img.find_rects(threshold = 10000):
              for p in R.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
              area = (R.x(),R.y(),R.w(),R.h())
              statistics = img.get_statistics(roi=area)#像素颜色统计
              #print(statistics)
              if num=='1':   #red
                  while(1):
                      print('red')
                      if 0<statistics.l_mode()<100 and 7<statistics.a_mode()<127 and -128<statistics.b_mode()<127:#若矩形是红色
                          img.draw_rectangle(R.x(), R.y(), R.w(),R.h(), color = (255, 0, 0))
                          if blobs:             #定位
                              #如果找到了目标颜色
                              for blob in blobs:
                                  img.draw_cross(blob[5], blob[6]) # cx, cy
                                  img.draw_cross(160, 120) # 在中心点画标记
                              #在目标颜色区域的中心画十字形标记
                                  cx=blob[5];
                                  cy=blob[6];
                                  img.draw_line((160,120,cx,cy), color=(127));
                                  img.draw_string(cx, cy, "(%d, %d)"%(cx,cy), color=(127));
                                  word=print(cx,cy)
                                  #uart.write(cx,cy)
                                  word_0='word'
                                  time.sleep_ms(5000)
      


    • 你的代码不是完整代码,不能运行的。