导航

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

    ns6x

    @ns6x

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

    ns6x 关注

    ns6x 发布的帖子

    • 使用openmv识别Aruco码然后控制引脚输出,但是openmvIDE无法导入Aruco库
      import sensor, image, time,image
      from pyb import Pin
      
      # 设置引脚对象
      pin1 = Pin('P0', Pin.OUT_PP)
      pin2 = Pin('P1', Pin.OUT_PP)
      pin3 = Pin('P2', Pin.OUT_PP)
      pin4 = Pin('P3', Pin.OUT_PP)
      
      # 初始化摄像头对象
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      
      # 定义Aruco的字典
      aruco_dict = image.aruco_custom_dict(6, 3)
      
      while(True):
          img = sensor.snapshot()
          codes = img.find_apriltags(families=image.TAG25H9)
      
          # 检测是否有Aruco二维码
          if len(codes) > 0:
              for code in codes:
                  # 获取Aruco二维码ID
                  code_id = code.payload()
      
                  # 控制引脚输出高电平
                  if code_id == 0:
                      pin1.high()
                  elif code_id == 1:
                      pin2.high()
                  elif code_id == 2:
                      pin3.high()
                  elif code_id == 3:
                      pin4.high()
      
          # 延迟2秒
          time.sleep(2000)
      
          # 将引脚输出恢复为低电平
          pin1.low()
          pin2.low()
          pin3.low()
          pin4.low()
      
      
      发布在 OpenMV Cam
      N
      ns6x