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



    • AttributeError:'module' object has no attribute 'draw_circle'

      识别自己在直线例程

      这个例子展示了如何在图像中查找线条。对于在图像中找到的每个线对象,

      都会返回一个包含线条旋转的线对象。

      注意:线条检测是通过使用霍夫变换完成的:

      http://en.wikipedia.org/wiki/Hough_transform

      请阅读以上关于“theta”和“rho”的更多信息。

      find_lines()找到无限长度的线。使用find_line_segments()

      来查找非无限线。

      enable_lens_corr = False # turn on for straighter lines...

      import sensor, image, time

      lim1=[1,2,3,4]
      lim2=[1,2,3,4]
      sum=0
      flag=0
      i=0
      li=(0,1,2,3,)
      x=0
      y=0
      zan=()
      sensor.reset()

      sensor.set_pixformat(sensor.RGB565) # grayscale is faster

      sensor.set_framesize(sensor.QQVGA)

      sensor.skip_frames(time = 2000)

      clock = time.clock()

      所有的线对象都有一个theta()方法来获取它们的旋转角度。

      您可以根据旋转角度来过滤线条。

      min_degree = 0

      max_degree = 179

      所有线段都有 x1(), y1(), x2(), and y2() 方法来获得他们的终点

      一个 line() 方法来获得所有上述的四个元组值,可用于 draw_line().

      while(True):

      clock.tick()
      
      img = sensor.snapshot()
      
      if enable_lens_corr: img.lens_corr(1.8) # for 2.8mm lens...
      
      
      
      # `threshold` controls how many lines in the image are found. Only lines with
      
      # edge difference magnitude sums greater than `threshold` are detected...
      
      
      
      # `threshold`控制从霍夫变换中监测到的直线。只返回大于或等于阈值的
      
      # 直线。应用程序的阈值正确值取决于图像。注意:一条直线的大小是组成
      
      # 直线所有索贝尔滤波像素大小的总和。
      
      
      
      # `theta_margin`和`rho_margin`控件合并相似的直线。如果两直线的
      
      # theta和ρ值差异小于边际,则它们合并。
      
      
      sum=0
      flag=0;
      for l in img.find_lines(threshold = 3000, y_stride=2,y_stride=2,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))
      
              # print(l)
          if flag==0:
              sum=l.theta()
              flag=1
              lim1=l
              y= lim1[1]
          else :
              sum-=l.theta()
              lim2=l
              x= lim2[0]
      
      if sum<110 and sum>70:
          for i in range(0,3):
              print(lim1[i],lim2[i])
      #x=0
      #y=0
      
      if x!=0 or y!=0:
          image.draw_cross(x=100, y=100, size=5, color=White)     
          #image.draw_circle(x=100,y=100, radius=100,color=(0,255,0))
      print("FPS %f" % clock.fps())
      print(sum)
      

      About negative rho values:

      A [theta+0:-rho] tuple is the same as [theta+180:+rho].

      0_1562675202228_捕获.PNG
      之前在看了几个帖子要升级固件,特地看了下固件应该是没啥问题 0_1562675233592_1.PNG
      求大佬指点迷津



    • 是img.draw_cross,不是image.draw_cross



    • 改完后出现了新错误

      0_1562721196389_2.PNG