Comments (3)
Would the note OpenCv's Pnp solver with SOLVEPNP_IPPE_SQUARE
give a guide?
Some Google-hints:
https://docs.opencv.org/4.x/d5/d1f/calib3d_solvePnP.html
https://stackoverflow.com/questions/57427636/camera-pose-estimation-with-solvepnp-and-solvepnp-ippe-square-method
from apriltag.
Does anyone know how to calculate 6dof pose with the following output of detector.detect
?
({'hamming': 0, 'margin': 248.07064819335938, 'id': 0, 'center': array([657.39107487, 199.88093104]),
'lb-rb-rt-lt': array([[570.875 , 286.875 ],
[743.875 , 286.875 ],
[743.875 , 112.91918945],
[570.875 , 112.85452271]])},)
from apriltag.
As noted above, you can use OpenCV's solvePnP
to do the pose estimation from the 2D tag detection.
C++ code for this could look like this:
void
pnp(apriltag_detection_t* const detection, const std::array<double, 4>& intr, double tagsize)
{
const std::vector<cv::Point3d> objectPoints{
{-tagsize / 2, -tagsize / 2, 0},
{+tagsize / 2, -tagsize / 2, 0},
{+tagsize / 2, +tagsize / 2, 0},
{-tagsize / 2, +tagsize / 2, 0},
};
const std::vector<cv::Point2d> imagePoints{
{detection->p[0][0], detection->p[0][1]},
{detection->p[1][0], detection->p[1][1]},
{detection->p[2][0], detection->p[2][1]},
{detection->p[3][0], detection->p[3][1]},
};
cv::Matx33d cameraMatrix;
cameraMatrix(0, 0) = intr[0];// fx
cameraMatrix(1, 1) = intr[1];// fy
cameraMatrix(0, 2) = intr[2];// cx
cameraMatrix(1, 2) = intr[3];// cy
cv::Mat rvec, tvec;
cv::solvePnP(objectPoints, imagePoints, cameraMatrix, {}, rvec, tvec);
// 'rvec' and 'tvec' contain the orientation and position of the tag in 3D world
}
from apriltag.
Related Issues (20)
- Help with thresholding parameters HOT 1
- compatibility with WIN32_LEAN_AND_MEAN HOT 8
- Anyone implmented c# wrapper for this? HOT 1
- error when i run make in ubuntu 22.04 HOT 1
- Has anyone confirmed that this library can work on ESP32S3? HOT 3
- How to use intrinsics in Scaramuzza format to estimate the apriltag pose? HOT 3
- Suggestions on improving detections in low light conditions HOT 4
- Python bindings for apriltag_detect throws error when no detection is found HOT 5
- What's the meaning of 'apriltag.c:448: homography_compute2: Assertion `max_val_idx >= 0' failed.'? HOT 5
- Planned Python Package Index (PyPI) package? HOT 4
- Build fail on Ubuntu Noble in g2d.c: `last_quadrant` is used unitialized; treat-all-warnings-as-errors HOT 4
- How to detect AprilGrid? HOT 5
- (Python) 'Nthreads' is an invalid keyword argument for this function HOT 1
- Question: Use more than 4 points for pose computation HOT 3
- corner location has always 0.125 pixel error
- ReadMe File Error HOT 2
- Question: How to process moving frames? HOT 5
- from apriltag import apriltag no module HOT 2
- quick_decode struct allocates 6Gb memory for standard52h13 family HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apriltag.