• 星瞳AI VISION软件内测!可以离线标注,训练,并生成OpenMV的模型。可以替代edge impulse https://forum.singtown.com/topic/8206
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 代码运行后闪退,并显示MicroPython: ca3d3e9。



    • import sensor, image, time
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      
      clock = time.clock()
      
      def find_center(img):
          my_place=[120,160]
          heng=[]
          shu=[]
          center = []
          min_degree = 80
          max_degree = 100
          count=[]
      ###################找最靠近飞机坐标点的两条横线从而得出方框中心点纵坐标
          for l in img.find_lines(roi=(50,30,220,180),threshold = 900, theta_margin = 25, rho_margin = 25):
              if (min_degree <= l.theta()) and (l.theta() <= max_degree):
                  img.draw_line(l.line(), color = (255, 0, 0))
                  heng.append(l)
         # print("横线p值"heng.rho())
          if len(heng)>=2:
              heng1 = heng[0]
              for l in heng:
                  if abs(l.rho()-my_place[0])<abs(heng1.rho()-my_place[0]):
                      heng1 = l
              heng.pop(heng.index(heng1))
              #print(heng)
              heng2 = heng[0]
              for l in heng:
                  if abs(l.rho()-my_place[0])<abs(heng2.rho()-my_place[0]):
                      heng2 = l
              count.append(1)
              #center_y = (heng1.rho()+heng2.rho())/2
              #center.append(center_y)
              #print(heng1,heng2,center_y)
      ##########################找中心横坐标
          for l in img.find_lines(roi=(50,30,220,180),threshold = 1000,theta_margin = 35, rho_margin = 25):
              if (30 >= l.theta()) or (l.theta() >= 150):
                  img.draw_line(l.line(), color = (255, 0, 0))
                  shu.append(l)
          #print("竖线坐标"shu)
          if len(shu)>=2:
              shu1 = shu[0]
              for l in shu:
                  if abs(abs(l.rho())-my_place[1])<abs(abs(shu1.rho())-my_place[1]):
                      shu1 = l
              shu.pop(shu.index(shu1))
             # print(shu)
              shu2 = shu[0]
              for l in shu:
                  if abs(abs(l.rho())-my_place[1])<abs(abs(shu2.rho())-my_place[1]):
                      shu2 = l
              count.append(1)
          if  len(count)==2:
      
              center_y_1=(math.cos(shu1.theta()/180*3.14159)*heng1.rho()-math.cos(heng1.theta()/180*3.14159)*shu1.rho())/(math.sin(heng1.theta()/180*3.14159)*math.cos(shu1.theta()/180*3.14159)-math.sin(shu1.theta()/180*3.14159)*math.cos(heng1.theta()/180*3.14159))
              center_x_1=(math.sin(shu1.theta()/180*3.14159)*heng1.rho()-math.sin(heng1.theta()/180*3.14159)*shu1.rho())/(math.cos(heng1.theta()/180*3.14159)*math.sin(shu1.theta()/180*3.14159)-math.cos(shu1.theta()/180*3.14159)*math.sin(heng1.theta()/180*3.14159))
              center_y_2=(math.cos(shu2.theta()/180*3.14159)*heng2.rho()-math.cos(heng2.theta()/180*3.14159)*shu2.rho())/(math.sin(heng2.theta()/180*3.14159)*math.cos(shu2.theta()/180*3.14159)-math.sin(shu2.theta()/180*3.14159)*math.cos(heng2.theta()/180*3.14159))
              center_x_2=(math.sin(shu2.theta()/180*3.14159)*heng2.rho()-math.sin(heng2.theta()/180*3.14159)*shu2.rho())/(math.cos(heng2.theta()/180*3.14159)*math.sin(shu2.theta()/180*3.14159)-math.cos(shu2.theta()/180*3.14159)*math.sin(heng2.theta()/180*3.14159))
              center_x=(abs(center_x_1)+abs(center_x_2))/2
              center_y=(abs(center_y_1)+abs(center_y_2))/2
              print("中心x",center_x_1,center_x_2)
              print("中心y",center_y_1,center_y_2)
              return int(center_x), int(center_y)
              img.draw_cross(my_place[1], my_place[0], size=3,color=(0))
              img.draw_cross(int(center_x), int(center_y), size=5,color=(0))
              img.draw_arrow(my_place[1],  my_place[0], int(center_x), int(center_y), color = (0), size = 10, thickness = 2)
      
      

      0_1658201961564_屏幕截图 2022-07-19 113837.png

      想要进行识别方块,中心坐标 在运行后屏幕卡住,并弹出屏幕截图的显示。0_1658202078703_cbe5dc70-568a-4c14-ba89-cccdc0bb5771-image.png



    • 你使用的是什么硬件?升级到最新的固件4.3.1