Navigation

    • Login
    • Search
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. Home
    2. k5r1
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    • mipush

    k5r1

    @k5r1

    0
    Reputation
    4
    Posts
    44
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

    k5r1 Follow

    Posts made by k5r1

    • 我的a明明定义了 为什么老是会报 a,b,c没有定义的错误啊
      import sensor, image, time
      from pyb import UART
      # 为了使色彩追踪效果真的很好,你应该在一个非常受控制的照明环境中。
      BLUE_threshold   = (   0,   80,  -70,   -10,   -0,   30)
      # 设置蓝色的阈值
      
      
      sensor.reset() # 初始化sensor
      
      sensor.set_pixformat(sensor.RGB565) # use RGB565.
      
      sensor.set_framesize(sensor.QQVGA)
      #设置图像像素大小
      
      sensor.skip_frames(10) # 让新的设置生效。
      sensor.set_auto_whitebal(False)
      clock = time.clock()
      
      uart = UART(3,115200)
      uart.init(115200, bits=8, parity=None, stop=1)  #通信
      
      K=5000#自取
      
      while(True):
          clock.tick()
          img = sensor.snapshot() # 拍一张照片并返回图像。
          blobs = img.find_blobs([BLUE_threshold])
          if len(blobs) == 1:
              # Draw a rect around the blob.
              b = blobs[0]
              img.draw_rectangle(b[0:4]) # rect
              img.draw_cross(b[5], b[6]) # cx, cy
              Lm = (b[2]+b[3])/2
              length = K/Lm
              print(length)
              c=int(length)
      
          if blobs:
          #如果找到了目标颜色
              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
                  #在目标颜色区域的中心画十字形标记
                  print(b[5], b[6])
                  #输出目标物体中心坐标
              print("1")
              a=1
          else:
              print("2")
              b=2
          data = bytearray([0xb3,a,b,c,0x5b])
      
      posted in OpenMV Cam
      k5r1
    • RE: openmv怎么控制syn6288模块

      @zn4s 大佬实现了吗

      posted in OpenMV Cam
      k5r1
    • 我要把黑色和圆形同时作为判断条件,应该怎么加
      import sensor, image, time
      
      from pyb import UART
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      uart = UART(3,115200)
      uart.init(115200, bits=8, parity=None, stop=1)
      
      while(True):
          clock.tick()
      
          img = sensor.snapshot().lens_corr(strength = 1.8, zoom = 1.0)
          for c in img.find_circles(threshold = 2200, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 15, r_step = 2,roi=(53,33,196,203)):
              img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))#画圆  用红线框出
              x=int(c.x())
              y=int(c.y())
              data = bytearray([0xb3,x,y,0x5b])
              uart.write(data)
              print(x,y)
      
      
      posted in OpenMV Cam
      k5r1
    • 我只想识别我roi区域的那一块,可是我的roi加进去好像没起到作用
      import sensor, image, time
      
      from pyb import UART
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      uart = UART(3,115200)
      uart.init(115200, bits=8, parity=None, stop=1)
      area= (66, 100, -31, 85, -8, 94)
      
      
      
      
      while(True):
          clock.tick()
      
      
          img = sensor.snapshot().lens_corr(strength = 1.8, zoom = 1.0)
          for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 15, r_step = 2):
              roi=(18,7,113,106)      #感兴趣区域
              img.draw_circle(area,c.x(), c.y(), c.r(), color = (255, 0, 0))#画圆  用红线框出
              x=int(c.x())
              y=int(c.y())
              data = bytearray([0xb3,x,y,0x5b])
              uart.write(data)
              print(x,y)
      
      
      posted in OpenMV Cam
      k5r1