导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 18800120366
    1
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    18800120366

    @18800120366

    0
    声望
    2
    楼层
    1135
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    18800120366 关注

    18800120366 发布的帖子

    • RE: Openmv巡线程序问题

      @18800120366 # Fast Linear Regression Example

      This example shows off how to use the get_regression() method on your OpenMV Cam

      to get the linear regression of a ROI. Using this method you can easily build

      a robot which can track lines which all point in the same general direction

      but are not actually connected. Use find_blobs() on lines that are nicely

      connected for better filtering options and control.

      This is called the fast linear regression because we use the least-squares

      method to fit the line. However, this method is NOT GOOD FOR ANY images that

      have a lot (or really any) outlier points which corrupt the line fit...

      #设置阈值,(0,100)检测黑色线
      THRESHOLD = (0, 100) # Grayscale threshold for dark things...

      #设置是否使用img.binary()函数进行图像分割
      BINARY_VISIBLE = True # Does binary first so you can see what the linear regression
      # is being run on... might lower FPS though.

      import sensor, image, time
      from pyb import UART
      uart = UART(3, 9600)
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(100)
      clock = time.clock()
      time.sleep(1000)
      while(True):
      clock.tick()
      img = sensor.snapshot().binary([THRESHOLD]) if BINARY_VISIBLE else sensor.snapshot()
      time.sleep(100)
      line = img.get_regression([(255,255) if BINARY_VISIBLE else THRESHOLD])
      if (line): img.draw_line(line.line(), color = 127)
      print("FPS %f, mag = %s" % (clock.fps(), str(line.magnitude()) if (line) else "N/A"))
      print(line.theta())
      output_str="%03d"%(line.theta())
      time.sleep(300)

      uart.write(output_str)
      

      About negative rho values:

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

      发布在 OpenMV Cam
      1
      18800120366
    • Openmv巡线程序问题

      本人在测试openmv巡线例程时,当摄像头视野范围内没有线时,程序就会死掉,请大神帮忙看一眼怎么改一下程序就没有线的时候程序也不崩溃。👏

      发布在 OpenMV Cam
      1
      18800120366