Make apriltag detection in same orientation than opencv

This commit is contained in:
matlabbe
2026-05-15 13:24:58 -07:00
parent 344812f127
commit 654d72a0fc
3 changed files with 6 additions and 5 deletions
+4 -4
View File
@@ -574,10 +574,10 @@ std::map<int, MarkerInfo> MarkerDetector::detect(const cv::Mat & image,
double err = estimate_tag_pose(&info, &pose);
if (pose.R && pose.t)
{
Transform t(MATD_EL(pose.R, 0, 0), MATD_EL(pose.R, 1, 0), MATD_EL(pose.R, 2, 0), MATD_EL(pose.t, 0, 0),
MATD_EL(pose.R, 0, 1), MATD_EL(pose.R, 1, 1), MATD_EL(pose.R, 2, 1), MATD_EL(pose.t, 1, 0),
MATD_EL(pose.R, 0, 2), MATD_EL(pose.R, 1, 2), MATD_EL(pose.R, 2, 2), MATD_EL(pose.t, 2, 0));
poses.push_back(t);
Transform t(MATD_EL(pose.R, 0, 0), MATD_EL(pose.R, 0, 1), MATD_EL(pose.R, 0, 2), MATD_EL(pose.t, 0, 0),
MATD_EL(pose.R, 1, 0), MATD_EL(pose.R, 1, 1), MATD_EL(pose.R, 1, 2), MATD_EL(pose.t, 1, 0),
MATD_EL(pose.R, 2, 0), MATD_EL(pose.R, 2, 1), MATD_EL(pose.R, 2, 2), MATD_EL(pose.t, 2, 0));
poses.push_back(t*Transform(-1,0,0,0, 0,1,0,0, 0,0,-1,0)); // Flip tag to match same frame than OpenCV (+x->-x, +z->-z)
corners.push_back(std::vector<cv::Point2f>(4));
for(int i=0; i<4; ++i)
+1 -1
View File
@@ -501,7 +501,7 @@ std::map<int, Transform> OptimizerGTSAM::optimize(
t = iter->second.transform().inverse();
std::swap(id1, id2); // should be node -> landmark
}
UASSERT(isLandmarkWithRotation.find(id2) != isLandmarkWithRotation.end());
#ifdef RTABMAP_VERTIGO
if(this->isRobust() && isLandmarkWithRotation.at(id2))
{
+1
View File
@@ -5239,6 +5239,7 @@ void MainWindow::drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords
void MainWindow::drawLandmarks(cv::Mat & image, const Signature & signature)
{
UDEBUG("%ld landmarks", signature.getLandmarks().size());
for(std::map<int, Link>::const_iterator iter=signature.getLandmarks().begin(); iter!=signature.getLandmarks().end(); ++iter)
{
// Project in all cameras in which the landmark is visible