#include <posetracker.h>
Public Member Functions | |
bool | estimatePose (Marker &m, const CameraParameters &cam_params, float markerSize, float minErrorRatio=4) |
estimatePose More... | |
cv::Mat | getRTMatrix () const |
const cv::Mat | getRvec () const |
const cv::Mat | getTvec () const |
Private Member Functions | |
double | solve_pnp (const std::vector< cv::Point3f > &p3d, const std::vector< cv::Point2f > &p2d, const cv::Mat &cam_matrix, const cv::Mat &dist, cv::Mat &r_io, cv::Mat &t_io) |
Private Attributes | |
cv::Mat | _rvec |
cv::Mat | _tvec |
Tracks the position of a marker. Instead of trying to calculate the position from scratch everytime, it uses past observations to estimate the pose. It should solve the problem with ambiguities that arises in some circumstances
To solve ambiguity we follow the following idea. We are using the IPPE method, which returns the two possible solutions s0,s1. Error solution has a reprojection error e(s_i) and it is assumed that e(s0)<e(s1). If the reprojection errors are similar, then, it is difficult from only one image to know the correct location. So, if the error ratio er=e(s_1)/e(s_0) ~ 1, there is a possible ambiguity problem. Please notice that er is in range [1,inf)
To solve the problem, we should do a tracking process, so that when the ambiguity occur, you can select the solution nearest to the previos position.
So, the only problem now becomes the initialization. You have two options. First, you wait for a position in which ambiguity does not happen. When a robuts position is seen, you start tracking. Scond, you risk and start tracking and if later you discover the error, you correct.
This idea is implemented in the tracker.
Call estimatePose indicated as last parameter the error ratio you want for the initialization. If the parameter is set er=1, then you start right away. Be warned then that you might suffer a big shift later if there was an erroneous starting location
If you do not want to risk, I recommen using more conservative approach, use a value of er=4.
Definition at line 57 of file posetracker.h.
bool aruco::MarkerPoseTracker::estimatePose | ( | Marker & | m, |
const CameraParameters & | cam_params, | ||
float | markerSize, | ||
float | minErrorRatio = 4 |
||
) |
estimatePose
estimate the pose of the marker.
m | marker info |
cam_params | camera parameters |
markerSize | |
minErrorRatio | see explanation above. If you want to be conservative, use minErrorRatio=4. |
Definition at line 104 of file posetracker.cpp.
cv::Mat aruco::MarkerPoseTracker::getRTMatrix | ( | ) | const |
Definition at line 215 of file posetracker.cpp.
|
inline |
Definition at line 72 of file posetracker.h.
|
inline |
Definition at line 74 of file posetracker.h.
|
private |
|
private |
Definition at line 77 of file posetracker.h.
|
private |
Definition at line 77 of file posetracker.h.