WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
apriltag_pose.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7
8#include "apriltag.h"
9#include "common/matd.h"
10
11typedef struct {
13 double tagsize; // In meters.
14 double fx; // In pixels.
15 double fy; // In pixels.
16 double cx; // In pixels.
17 double cy; // In pixels.
19
20/**
21 * This struct holds the transformation from the camera optical frame to
22 * the April tag frame. The pose refers to the position of the tag within
23 * the camera frame.
24 */
25typedef struct {
26 matd_t* R; // Rotation matrix 3x3 of doubles.
27 matd_t* t; // Translation matrix 3x1 of doubles.
29
30/**
31 * Estimate pose of the tag using the homography method described in [1].
32 * @outparam pose
33 */
36 apriltag_pose_t* pose);
37
38/**
39 * Estimate pose of the tag. This returns one or two possible poses for the
40 * tag, along with the object-space error of each.
41 *
42 * This uses the homography method described in [1] for the initial estimate.
43 * Then Orthogonal Iteration [2] is used to refine this estimate. Then [3] is
44 * used to find a potential second local minima and Orthogonal Iteration is
45 * used to refine this second estimate.
46 *
47 * [1]: E. Olson, “Apriltag: A robust and flexible visual fiducial system,” in
48 * 2011 IEEE International Conference on Robotics and Automation,
49 * May 2011, pp. 3400–3407.
50 * [2]: Lu, G. D. Hager and E. Mjolsness, "Fast and globally convergent pose
51 * estimation from video images," in IEEE Transactions on Pattern Analysis
52 * and Machine Intelligence, vol. 22, no. 6, pp. 610-622, June 2000.
53 * doi: 10.1109/34.862199
54 * [3]: Schweighofer and A. Pinz, "Robust Pose Estimation from a Planar Target,"
55 * in IEEE Transactions on Pattern Analysis and Machine Intelligence,
56 * vol. 28, no. 12, pp. 2024-2030, Dec. 2006. doi: 10.1109/TPAMI.2006.252
57 *
58 * @outparam err1, pose1, err2, pose2
59 */
62 double* err1,
63 apriltag_pose_t* pose1,
64 double* err2,
65 apriltag_pose_t* pose2,
66 int nIters,
67 double min_improvement_per_iteration);
68
69/**
70 * Estimate tag pose.
71 * This method is an easier to use interface to estimate_tag_pose_orthogonal_iteration.
72 *
73 * @outparam pose
74 * @return Object-space error of returned pose.
75 */
77
78#ifdef __cplusplus
79}
80#endif
81
void estimate_tag_pose_orthogonal_iteration(apriltag_detection_info_t *info, double *err1, apriltag_pose_t *pose1, double *err2, apriltag_pose_t *pose2, int nIters, double min_improvement_per_iteration)
Estimate pose of the tag.
void estimate_pose_for_tag_homography(apriltag_detection_info_t *info, apriltag_pose_t *pose)
Estimate pose of the tag using the homography method described in [1].
double estimate_tag_pose(apriltag_detection_info_t *info, apriltag_pose_t *pose)
Estimate tag pose.
Definition apriltag_pose.h:11
double cx
Definition apriltag_pose.h:16
apriltag_detection_t * det
Definition apriltag_pose.h:12
double tagsize
Definition apriltag_pose.h:13
double fx
Definition apriltag_pose.h:14
double cy
Definition apriltag_pose.h:17
double fy
Definition apriltag_pose.h:15
Definition apriltag.h:197
This struct holds the transformation from the camera optical frame to the April tag frame.
Definition apriltag_pose.h:25
matd_t * R
Definition apriltag_pose.h:26
matd_t * t
Definition apriltag_pose.h:27
Defines a matrix structure for holding double-precision values with data in row-major order (i....
Definition matd.h:46