导航

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

    diso

    @diso

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

    diso 关注

    diso 发布的帖子

    • 循迹小车中的line.rho()是什么意思?

      按视频的解释是“偏移的距离”,按文档的解释是霍夫变换后直线的p值,个人不是很理解这两句话,可以解释清楚一点吗

      发布在 OpenMV Cam
      D
      diso
    • lcd显示屏图像无法垂直翻转?
      lcd.display(img, x_scale=-1.0, y_scale=-1.0)
      报错原因:ValueError: Vertical flip requires triple buffering!
      发布在 OpenMV Cam
      D
      diso
    • openmv的I2C传输报错:要发送的数据不在缓冲区?
      import sensor, image, time
      import pyb, ustruct # ustruct 用于打包和解压原始数据类型 的 "类"
      import gc
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 300)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      
      K=560#the value should be measure
      
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      bus.deinit() # 完全关闭设备
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      print("Waiting for Arduino...")
      
      
      while(True):
          length=0
          circlex=0
          circley=0
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 100, r_step = 2):
              area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r())
              circlex=c.x()
              circley=c.y()
              img.draw_rectangle(area, color = (255, 255, 255))#将非红色的圆用白色的矩形框出来
              Lm =  2*c.r()
              length = K/Lm
          #print("FPS %f" % clock.fps())
          print("length:",length)
          output_str=[length,circlex,circley]
          for i in range(3):
              data = output_str[i]
              #sensor.shutdown(True)
              #try:
                  #bus.send(4, timeout=10000) # Send the len first (16-bits).
              try:
                  bus.send(data, timeout=10000) # Send the data second.
                  print(data)
                  print("Sent Data!") # Only reached on no error.
              except OSError as err:
                  pass # Don't care about errors - so pass.
                      # Note that there are 3 possible errors. A timeout error, a general purpose error, or
                      # a busy error. The error codes are 116, 5, 16 respectively for "err.arg[0]".
              #except OSError as err:
                  #pass
          del img
          gc.collect()
      ![0_1684415443045_屏幕截图 2023-05-18 211022.png](https://fcdn.singtown.com/95586d9d-64a8-4183-9c0b-5b51f5c9c481.png)
      发布在 OpenMV Cam
      D
      diso
    • RE: openmv想要通过I2C总线发送一个浮点数的数组,怎么做?下图的代码有什么错误?

      没有报错,就是发送不出去

      发布在 OpenMV Cam
      D
      diso
    • openmv想要通过I2C总线发送一个浮点数的数组,怎么做?下图的代码有什么错误?
      import sensor, image, time
      import pyb, ustruct # ustruct 用于打包和解压原始数据类型 的 "类"
      import gc
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 300)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      
      K=560#the value should be measure
      
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      bus.deinit() # 完全关闭设备
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      print("Waiting for Arduino...")
      
      
      while(True):
          length=0
          circlex=0
          circley=0
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 100, r_step = 2):
              area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r())
              circlex=c.x()
              circley=c.y()
              img.draw_rectangle(area, color = (255, 255, 255))#将非红色的圆用白色的矩形框出来
              Lm =  2*c.r()
              length = K/Lm
          print("FPS %f" % clock.fps())
          print("length:",length)
          output_strv=[length,circlex,circley]
          try:
              bus.send(len(output_strv), timeout=10000) # Send the len first (16-bits).
              try:
                  for i in range(3):
                      bus.send(output_strv[i], timeout=10000) # Send the data second.
                      print("Sent Data!") # Only reached on no error.
              except OSError as err:
                  pass # Don't care about errors - so pass.
                  # Note that there are 3 possible errors. A timeout error, a general purpose error, or
                  # a busy error. The error codes are 116, 5, 16 respectively for "err.arg[0]".
          except OSError as err:
              pass
          del img
          gc.collect()
      
      发布在 OpenMV Cam
      D
      diso
    • RE: 在识别小球时,小球和摄像头都静止不动,但是摄像头有时能识别小球,有时不能,怎么解决呢?

      0_1683889372405_微信图片_20230512190242.png

      发布在 OpenMV Cam
      D
      diso
    • RE: 在识别小球时,小球和摄像头都静止不动,但是摄像头有时能识别小球,有时不能,怎么解决呢?

      推测是白色的小球和背景颜色太接近导致

      发布在 OpenMV Cam
      D
      diso
    • 在识别小球时,小球和摄像头都静止不动,但是摄像头有时能识别小球,有时不能,怎么解决呢?
      import sensor, image, time
      import pyb, ustruct # ustruct 用于打包和解压原始数据类型 的 "类"
      from pyb import LED
      import gc
      
      LED(1).on()
      LED(2).on()
      LED(3).on()
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      
      K=560#the value should be measure
      
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      bus.deinit() # 完全关闭设备
      bus = pyb.I2C(2, pyb.I2C.SLAVE, addr=0x12)
      print("Waiting for Arduino...")
      
      
      while(True):
          length=0
          circlex=0
          circley=0
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 2500, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 100, r_step = 2):
              area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r())
              circlex=c.x()-80
              circley=c.y()-60
              img.draw_rectangle(area, color = (255, 255, 255))#将非红色的圆用白色的矩形框出来
              Lm =  2*c.r()
              length = K/Lm
          print("FPS %f" % clock.fps())
          print("length:",length)
          output_str="[%d,%d,%d]" % (length,circlex,circley)
          data = ustruct.pack("<%ds" % len(output_str), output_str)
          #sensor.shutdown(True)
          try:
              bus.send(ustruct.pack("<h", len(data)), timeout=10000) # Send the len first (16-bits).
              try:
                  bus.send(data, timeout=10000) # Send the data second.
                  print("Sent Data!") # Only reached on no error.
              except OSError as err:
                  pass # Don't care about errors - so pass.
                  # Note that there are 3 possible errors. A timeout error, a general purpose error, or
                  # a busy error. The error codes are 116, 5, 16 respectively for "err.arg[0]".
          except OSError as err:
              pass
          del img
          gc.collect()
          #sensor.reset()
          #sensor.set_pixformat(sensor.RGB565)
          #sensor.set_framesize(sensor.QQVGA)
          #sensor.skip_frames(time = 3)
          #sensor.set_auto_gain(False) # must be turned off for color tracking
          #sensor.set_auto_whitebal(False) # must be turned off for color tracking
      
      
      发布在 OpenMV Cam
      D
      diso