导航

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

    sygb

    @sygb

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

    sygb 关注

    sygb 发布的帖子

    • RE: 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现?

      @kidswong999 0_1681135831480_36f1c7a638218166fb721b45dc95950.png
      你的代码还是报错了,再帮我们看一下吧

      发布在 OpenMV Cam
      S
      sygb
    • RE: 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现?

      @kidswong999 在 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现? 中说:

      import sensor, image, time

      import time
      from servo import Servos
      from machine import I2C, Pin

      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # 灰度更快(160x120 max on OpenMV-M7)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()

      i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))
      servo = Servos(i2c, address=0x40, freq=50, min_us=500, max_us=2500, degrees=180)
      rects = img.find_rects(threshold = 10000)

      while(True):
      clock.tick()
      img = sensor.snapshot()

      # 下面的`threshold`应设置为足够高的值,以滤除在图像中检测到的具有
      # 低边缘幅度的噪声矩形。最适用与背景形成鲜明对比的矩形。
      
      rects = img.find_rects(threshold = 10000):
      for f in rects:
          img.draw_rectangle(r.rect(), color = (255, 0, 0))
          for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
          print(r)
      
      if rects:
          servo.position(0, 0)
          time.sleep_ms(500)
          servo.position(0, 180)
          time.sleep_ms(500)
      
      
      print("FPS %f" % clock.fps())
      

      0_1681135433198_36f1c7a638218166fb721b45dc95950.png
      还是运行不了啊,再帮我们看一下吧

      发布在 OpenMV Cam
      S
      sygb
    • RE: 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现?

      @kidswong999 识别到矩形后,舵机也没有转动,这是全部代码,两个功能分别都可以实现,但合起来无法联动,帮我看一下哪有问题?

      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # 灰度更快(160x120 max on OpenMV-M7)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
      
          # 下面的`threshold`应设置为足够高的值,以滤除在图像中检测到的具有
          # 低边缘幅度的噪声矩形。最适用与背景形成鲜明对比的矩形。
      
          for r in img.find_rects(threshold = 10000):
              img.draw_rectangle(r.rect(), color = (255, 0, 0))
              for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
              print(r)
      
          print("FPS %f" % clock.fps())
      
      import time
      from servo import Servos
      from machine import I2C, Pin
      
      i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))
      servo = Servos(i2c, address=0x40, freq=50, min_us=500, max_us=2500, degrees=180)
      rects = img.find_rects(threshold = 10000)
      if rects:
      
          
          servo.position(0, 0)
          time.sleep_ms(500)
          servo.position(0, 180)
          time.sleep_ms(500)
      
      
      发布在 OpenMV Cam
      S
      sygb
    • RE: 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现?

      矩形识别到后会返回几个值,是不是把控制舵机的while true改成while什么就可以?

      发布在 OpenMV Cam
      S
      sygb
    • 我想实现openmv识别到矩形后,舵机开始转动,请问这样的代码如何实现?

      控制舵机

      # Servo Shield Example.
      #
      # This example demonstrates the servo shield. Please follow these steps:
      #
      #   1. Connect a servo to any PWM output.
      #   2. Connect a 3.7v battery (or 5V source) to VIN and GND.
      #   3. Copy pca9685.py and servo.py to OpenMV and reset it.
      #   4. Connect and run this script in the IDE.
      
      import time
      from servo import Servos
      from machine import I2C, Pin
      
      i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))
      servo = Servos(i2c, address=0x40, freq=50, min_us=500, max_us=2500, degrees=180)
      
      while True:
          for i in range(0, 8):
              servo.position(i, 0)
          time.sleep_ms(500)
          for i in range(0, 8):
              servo.position(i, 180)
          time.sleep_ms(500)
      

      矩形识别

      # Find Rects Example
      #
      # 这个例子展示了如何使用april标签代码中的四元检测代码在图像中找到矩形。 四元检测算法以非常稳健的方式检测矩形,并且比基于Hough变换的方法好得多。 例如,即使镜头失真导致这些矩形看起来弯曲,它仍然可以检测到矩形。 圆角矩形是没有问题的!
      # (但是,这个代码也会检测小半径的圆)...
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # 灰度更快(160x120 max on OpenMV-M7)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
      
          # 下面的`threshold`应设置为足够高的值,以滤除在图像中检测到的具有
          # 低边缘幅度的噪声矩形。最适用与背景形成鲜明对比的矩形。
      
          for r in img.find_rects(threshold = 10000):
              img.draw_rectangle(r.rect(), color = (255, 0, 0))
              for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
              print(r)
      
          print("FPS %f" % clock.fps())
      
      
      发布在 OpenMV Cam
      S
      sygb
    • openmv能不能和微信小程序相连接,就是openmv识别出二维码的相应信息后,传到小程序上面

      openmv能不能和微信小程序相连接,就是openmv识别出二维码的相应信息后,传到小程序上面

      发布在 OpenMV Cam
      S
      sygb
    • 在控制多个舵机的教程中,为什么会出现这样的问题,难道是我的插线哪里错误了吗?

      2_1667487473786_微信图片_20221103225743.jpg 1_1667487473786_微信图片_20221103225739.jpg 0_1667487473784_微信图片_20221103225734.jpg

      发布在 OpenMV Cam
      S
      sygb
    • 请问用openmv4数据集编辑器收集出来的照片为什么是这样的?是什么都没有白色的?

      0_1667453002351_00000.jpg

      发布在 OpenMV Cam
      S
      sygb