-
Notifications
You must be signed in to change notification settings - Fork 644
Expand file tree
/
Copy pathapriltag_detect.docstring
More file actions
67 lines (49 loc) · 2.55 KB
/
apriltag_detect.docstring
File metadata and controls
67 lines (49 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
AprilTag detector
SYNOPSIS
import cv2
import numpy as np
from apriltag import apriltag
imagepath = '/tmp/tst.jpg'
image = cv2.imread(imagepath, cv2.IMREAD_GRAYSCALE)
detector = apriltag("tag36h11")
detections = detector.detect(image)
print("Saw tags {} at\n{}". \
format([d['id'] for d in detections],
np.array([d['center'] for d in detections])))
----> Saw tags [3, 5, 7, 8, 10, 10, 14] at
[[582.42911184 172.90587335]
[703.32149701 271.50587376]
[288.1462089 227.01502779]
[463.63679264 227.91185418]
[ 93.88534443 241.61109765]
[121.94062798 237.97010936]
[356.46940849 260.20169159]]
DESCRIPTION
The AprilTags visual fiducial system project page is here:
https://april.eecs.umich.edu/software/apriltag
This is a Python class to provide AprilTags functionality in Python programs. To
run the detector you
1. Construct an object of type apriltag.apriltag()
2. Invoke the detect() method on this object
The detect() method takes a single argument: an image array. The return value is
a tuple containing the detections. Each detection is a dict with keys:
- id: integer identifying each detected tag
- center: pixel coordinates of the center of each detection. NOTE: Please be
cautious regarding the image coordinate convention. Here, we define (0,0) as
the left-top corner (not the center point) of the left-top-most pixel.
- lb-rb-rt-lt: pixel coordinates of the 4 corners of each detection. The order
is left-bottom, right-bottom, right-top, left-top
- hamming: How many error bits were corrected? Note: accepting large numbers of
corrected errors leads to greatly increased false positive rates. NOTE: As of
this implementation, the detector cannot detect tags with a hamming distance
greater than 2.
- margin: A measure of the quality of the binary decoding process: the average
difference between the intensity of a data bit versus the decision threshold.
Higher numbers roughly indicate better decodes. This is a reasonable measure
of detection accuracy only for very small tags-- not effective for larger tags
(where we could have sampled anywhere within a bit cell and still gotten a
good detection.)
- homography: A 3x3 homography matrix that describes the projection from an
"ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,-1)) to pixels
in the image. This matrix can be used to map points from the tag's coordinate
system to the image coordinate system, and is useful for pose estimation.