导航

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

    vr3i

    @vr3i

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

    vr3i 关注

    vr3i 发布的帖子

    • 只识别下面和右面两个ROI区域,但是结果是只要目标物体出现在set_windowing内,就显示已经识别到
      THRESHOLD = (0, 45, 19, -100, -24, 27) # Grayscale threshold for dark things...
      roi1=  [(0,0,80,60),
              (26,45,25,11),#down
               (61,27,16,8)]#right
      n=0
      a=0
      import sensor, image, time
      from pyb import LED
      
      #LED(1).on()
      #LED(2).on()
      #LED(3).on()
      
      sensor.reset()
      #sensor.set_vflip(True)#垂直翻转
      #sensor.set_hmirror(True)#打开水平镜像
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      sensor.set_windowing([0,0,80,60])
      sensor.skip_frames(time = 2000)     # WARNING: If you use QQVGA it may take seconds
      clock = time.clock()                # to process a frame sometimes.
      
      while(True):
          clock.tick()
          down_flag=right_flag=0
          img = sensor.snapshot().binary([THRESHOLD])#阈值进行二进制
          line = img.get_regression([(100,100)], robust = True)#线性回归计算
          for rec in roi1:
                  img.draw_rectangle(rec, color=(255,0,0))#颜色
          if (line):
              rho_err = abs(line.rho())-img.width()/2
              if line.theta()>90:
                  theta_err = line.theta()-180
              else:
                  theta_err = line.theta()
              img.draw_line(line.line(), color = 127)#画线
              #print(rho_err,line.magnitude(),rho_err)
              if img.find_blobs([(0, 45, 19, -100, -24, 27)],roi=(26,45,25,11)):
                  down_flag=1
                  n=1
                  print(n)
                  if img.find_blobs([(0, 45, 19, -100, -24, 27)],roi=(61,27,16,8)):
                   right_flag=1
                   a=2
                   print(a)
      

      0_16889g

      发布在 OpenMV Cam
      V
      vr3i