导航

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

    zvgd

    @zvgd

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

    zvgd 关注

    zvgd 发布的帖子

    • RE: apriltag跟随小车无法实现

      这个算是基本能实现跟踪apriltag标签了,但是我想要的是通过云台来搜索标签在来控制小车的运动,请问这个可以实现吗

      发布在 OpenMV Cam
      Z
      zvgd
    • RE: apriltag跟随小车无法实现

      @yuan

      
      

      Blob Detection Example

      This example shows off how to use the find_blobs function to find color

      blobs in the image. This example in particular looks for dark green objects.

      import sensor, image, time
      import car
      from pid import PID

      You may need to tweak the above settings for tracking green things...

      Select an area in the Framebuffer to copy the color settings.

      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      sensor.skip_frames(30)
      sensor.set_auto_gain(False) # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False) # turn this off.
      clock = time.clock() # Tracks FPS.

      For color tracking to work really well you should ideally be in a very, very,

      very, controlled enviroment where the lighting is constant...

      f_x = (2.8 / 3.984) * 160 # 默认值
      f_y = (2.8 / 2.952) * 120 # 默认值
      c_x = 160 * 0.5 # 默认值(image.w * 0.5)
      c_y = 120 * 0.5 # 默认值(image.h * 0.5)

      translation=-6
      x_pid = PID(p=0.005, i=1, imax=100)
      h_pid = PID(p=0.005, i=0.1, imax=50)

      def find_tag(tags):
      size=0
      for apriltag in tags:
      print(apriltag)
      if apriltag[2]*apriltag[3] > size:
      tag=apriltag
      size = apriltag[2]*apriltag[3]
      return tag

      while(True):
      clock.tick() # Track elapsed milliseconds between snapshots().
      img = sensor.snapshot() # Take a picture and return the image.

      tags = img.find_apriltags(fx=f_x, fy=f_y, cx=c_x, cy=c_y) # 默认为TAG36H11
      #print(tags)
      
      if tags:
          tag = find_tag(tags)
          #print(tag)        
          tag_id=tag[4]
          if (tag_id==2):
              print(tag[6])
              x_error = tag[6]-img.width()/2
              h_error = (tag[14]-translation)*200
              #print(tag[14])
              #print(h_error)
              #print("x error: ", x_error)
              '''
              for b in blobs:
                  # Draw a rect around the blob.
                  img.draw_rectangle(b[0:4]) # rect
                  img.draw_cross(b[5], b[6]) # cx, cy
              '''
              img.draw_rectangle(tag[0:4], color = (255, 0, 0))
              img.draw_cross(tag[6], tag[7], color = (0, 255, 0))
              x_output=x_pid.get_pid(x_error,1)
              h_output=h_pid.get_pid(h_error,1)
              print("x_output",x_output)
              print("h_output",h_output)
              car.run(-h_output-x_output,-h_output+x_output)
      
      else:
          car.run(0,0)
      
      
      
      发布在 OpenMV Cam
      Z
      zvgd
    • apriltag跟随小车无法实现

      0_1534487265541_1.png
      程序错误代码为list index out of range
      但是输出的tag列表没有超范围,求助

      发布在 OpenMV Cam
      Z
      zvgd
    • RE: 如何实现小车跟随apriltag!!?急急急!!!

      我的也是,我用的是坐标跟踪,算法要改点

      发布在 OpenMV Cam
      Z
      zvgd