python April tag安装与使用(单应性矩阵)

本文介绍了如何在Windows系统中使用Apriltag库进行静态图片中Apriltag的识别,包括计数和角点定位,并演示了如何在动态视频中实时检测。还讲解了如何利用检测到的tag角点计算单应性矩阵,用于图像变换。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

April tag安装

在win系统,python安装方法。

April tag应用

静态图片识别

识别图像中tag个数,对其四个角点位置记录。对其后做单应性矩阵计算提供四个点。

#!/usr/bin/env python
# coding: UTF-8
# import apriltag
import pupil_apriltags as apriltag     # for windows
import cv2
import numpy as np
import sys
def tag_H(img):
    cols, rows, ch = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    # 创建一个apriltag检测器
    # at_detector = apriltag.Detector(apriltag.DetectorOptions(families='tag36h11 tag25h9'))
    at_detector = apriltag.Detector(families='tag36h11 tag25h9')  #for windows
    # 进行apriltag检测,得到检测到的apriltag的列表
    tags = at_detector.detect(gray)
    print("%d apriltags have been detected." % len(tags))

    for tag in tags:
        cv2.circle(img, tuple(tag.corners[3].astype(int)), 2, (255, 0, 0), 2)  # left-top
        cv2.circle(img, tuple(tag.corners[2].astype(int)), 2, (255, 0, 0
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值