导航

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

    bw4c

    @bw4c

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

    bw4c 关注

    bw4c 发布的帖子

    • RE: 脱机与连电脑得到的值不同

      @kidswong999

      import sensor, image, time
      from pyb import UART,LED
      import json
      write_threshold=(0, 19, 28, -33, 122, -2)
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((504,480))
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      quyu=[278,278,278,278,278,278,278,278,278,278]
      LED(1).on()
      LED(2).on()
      LED(3).on()
      lx=0
      x=0
      k=0
      t=0
      m=0
      last=0
      l=0
      uart=UART(3,115200)
      def find_max(blobs):
       max_size=0
       for blob in blobs:
        if blob.pixels()>max_size:
         max_blob=blob
         max_size = blob.pixels()
        return max_blob
      while(True):
        clock.tick()
        img=sensor.snapshot ()
        for n in range(0,10):
         blobs = img.find_blobs([write_threshold],roi=[193,480-48*(n+1),172,48],x_stride=20,y_stride=20,x_stride=400)
         img.draw_rectangle((193,480-48*(n+1),172,48),color=(231,188,105))
         max_blob=find_max(blobs)
         if blobs:
          for blob in blobs:
           img.draw_cross(max_blob.cx(), max_blob.cy())
           quyu[n]=max_blob.cx()
           m+=1
           if m>=2:
            k+=(max_blob.cx()-lx)/48
           lx=max_blob.cx()
         x=x+quyu[n]
        blobs = img.find_blobs([write_threshold],roi=[53,80,100,80])
        max_blob=find_max(blobs)
        if blobs:
         for blob in blobs:
          img.draw_cross(max_blob.cx(), max_blob.cy())
          t+=max_blob.cx()
        blobs = img.find_blobs([write_threshold],roi=[53,240,452,80])
        max_blob=find_max(blobs)
        if blobs:
         for blob in blobs:
          l=max_blob.w()
        if m!=0:
         last=x/10+k*30/m
        if l>200:
         t=666
        if k>1:
         k=1
        if k<-1:
         k=-1
        print(last-278,t)
        output_str="%.3d, %.3d" % (last,t)
        lx=0
        x=0
        k=0
        t=0
        m=0
        uart.write('\n'+output_str+'\r')
        img.draw_rectangle((53,80,100,80),color=(231,188,105))
        img.draw_rectangle((53,240,452,80), color=(231,188,105))
      
      发布在 OpenMV Cam
      B
      bw4c
    • RE: 脱机与连电脑得到的值不同
      import sensor, image, time
      from pyb import UART,LED
      import json
      write_threshold=(0, 19, 28, -33, 122, -2)
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((504,480))
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      quyu=[278,278,278,278,278,278,278,278,278,278]
      LED(1).on()
      LED(2).on()
      LED(3).on()
      lx=0
      x=0
      k=0
      t=0
      m=0
      last=0
      l=0
      uart=UART(3,115200)
      def find_max(blobs):
       max_size=0
       for blob in blobs:
        if blob.pixels()>max_size:
         max_blob=blob
         max_size = blob.pixels()
        return max_blob
      while(True):
        clock.tick()
        img=sensor.snapshot ()
        for n in range(0,10):
         blobs = img.find_blobs([write_threshold],roi=[193,480-48*(n+1),172,48],x_stride=20,y_stride=20,x_stride=400)
         img.draw_rectangle((193,480-48*(n+1),172,48),color=(231,188,105))
         max_blob=find_max(blobs)
         if blobs:
          for blob in blobs:
           img.draw_cross(max_blob.cx(), max_blob.cy())
           quyu[n]=max_blob.cx()
           m+=1
           if m>=2:
            k+=(max_blob.cx()-lx)/48
           lx=max_blob.cx()
         x=x+quyu[n]
        blobs = img.find_blobs([write_threshold],roi=[53,80,100,80])
        max_blob=find_max(blobs)
        if blobs:
         for blob in blobs:
          img.draw_cross(max_blob.cx(), max_blob.cy())
          t+=max_blob.cx()
        blobs = img.find_blobs([write_threshold],roi=[53,240,452,80])
        max_blob=find_max(blobs)
        if blobs:
         for blob in blobs:
          l=max_blob.w()
        if m!=0:
         last=x/10+k*30/m
        if l>200:
         t=666
        if k>1:
         k=1
        if k<-1:
         k=-1
        print(last-278,t)
        output_str="%.3d, %.3d" % (last,t)
        lx=0
        x=0
        k=0
        t=0
        m=0
        uart.write('\n'+output_str+'\r')
        img.draw_rectangle((53,80,100,80),color=(231,188,105))
        img.draw_rectangle((53,240,452,80), color=(231,188,105))
      
      
      发布在 OpenMV Cam
      B
      bw4c
    • 脱机与连电脑得到的值不同

      为什么使用openmv求寻迹偏差值的时候脱机运行和连电脑时得到的值不同,连电脑的时候很完美,脱机错误很大

      发布在 OpenMV Cam
      B
      bw4c