360 Secure SkillHub
360 安全技能中心

Pywayne Cv Apriltag Detector

该 Skill 说明如何使用 pywayne 的 ApriltagCornerDetector 在图像中检测 AprilTag 36h11 标记,支持文件路径或 numpy 数组输入,返回 id、hamming_distance、center 和四个角点坐标;detect_and_draw 可在图像上绘制轮廓、角点与 ID。依赖 cv2、numpy,并可通过 gettool 自动安装 april…

wangyendt
wangyendt
热度 62.64
最近更新 2026-05-11 17:25:45
分类:开发依赖:代码执行 / 读写文件应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add apriltag-detector
Metadata
name
pywayne-cv-apriltag-detector
description
AprilTag corner detection for camera calibration and pose estimation. Use when working with pywayne.cv.apriltag_detector module to detect AprilTag fiducial markers in images, with automatic library installation via gettool, drawing detection results with corners and IDs, and support for both file paths and numpy arrays.

Pywayne AprilTag Detector

This module detects AprilTag fiducial markers for camera calibration and pose estimation.

Quick Start

from pywayne.cv.apriltag_detector import ApriltagCornerDetector

# Create detector
detector = ApriltagCornerDetector()

# Detect from file path
detections = detector.detect('test.png', show_result=True)

# Detect from numpy array
import cv2
image = cv2.imread('test.png')
detections = detector.detect(image)

Detection Methods

detect()

Detect AprilTags in an image:

detections = detector.detect(
    image,           # File path, Path object, or numpy array
    show_result=False  # Show visualization window
)

Returns list of detection results with:

  • id: Tag ID
  • hamming_distance: Detection confidence
  • center: Tag center coordinates (x, y)
  • corners: 4 corner coordinates

detect_and_draw()

Detect AprilTags and draw results on original image:

result_image = detector.detect_and_draw(image)
cv2.imshow('Detection Result', result_image)
cv2.waitKey(0)

Visualization includes:

  • Green polygon outlines
  • Red corner circles
  • Red ID labels at tag centers

Requirements

  • cv2 (OpenCV) - Image processing
  • numpy - Array operations
  • gettool - Downloads apriltag_detection library automatically

Library Installation

The detector automatically checks for and installs the apriltag_detection library using gettool if not found.

Detection Result Format

Each detection contains:

Field Description
id Tag identifier
hamming_distance Hamming distance (lower = more confident)
center Tag center as (x, y) tuple
corners 4 corner coordinates as [(x1, y1), (x2, y2), (x3, y3), (x4, y4)]

Notes

  • Supports both grayscale and BGR images
  • Automatic grayscale conversion for detection
  • Visualization sizes scale with image dimensions
  • Uses AprilTag 36h11 tag family