ydsf16 / pnp_solver Goto Github PK
View Code? Open in Web Editor NEWPersonal implementations of solvers for PnP problem, including DLT and EPnP.
Home Page: https://zhuanlan.zhihu.com/p/59070440
Personal implementations of solvers for PnP problem, including DLT and EPnP.
Home Page: https://zhuanlan.zhihu.com/p/59070440
Lines 530 to 534 in 835e358
Thanks for open sourcing this great repo :)
If you have the time, I am curious about one aspect of the EPnP implementation:
Why the sign of the betas when
E.g. when
Lines 436 to 446 in 835e358
However, by definition,
Thanks in advance.
Hi, I tried your code, its perfect! It worked well on my laptop except one place.
On line 278 pop_solver.cpp
C.block ( 3, 0, 1, 4 ) = Eigen::Vector4d ( 1.0, 1.0, 1.0, 1.0 );
When I run the program, it got stuck here. assertion error. rows and cols != problem.
my fix is C.block ( 3, 0, 1, 4 ) = Eigen::Vector4d ( 1.0, 1.0, 1.0, 1.0 ).transpose();
Good job! I found your result is much much better than OpenCV's epnp!
I ran a simple program in two systems. Mac with Eigen3.3.4 and Linux with Eigen3.2.0. I got super different results.
Here's my code.
Eigen::Matrix3d m_K = Eigen::Matrix3d::Identity();
m_K(0, 0) = 672.062;
m_K(1, 1) = 674.562;
m_K(0, 2) = 398.838;
m_K(1, 2) = 279.38;
std::vector< Eigen::Vector3d > vecPts3d;
std::vector< Eigen::Vector2d > vecPts2d;
Eigen::Vector3d p3d0(492.681, 1.73013, 159.257);
Eigen::Vector3d p3d1(493.724, -4.69578, 69.9289);
Eigen::Vector3d p3d2(597.975, -10.3263, 9.82591);
Eigen::Vector3d p3d3(623.276, -9.67869, -303.368);
Eigen::Vector3d p3d4(502.611, -4.8012, 66.27);
Eigen::Vector2d p2d0(507.6, 327.6);
Eigen::Vector2d p2d1(624.248, 239.454);
Eigen::Vector2d p2d2(222.731, 263.926);
Eigen::Vector2d p2d3(432.868, 275.006);
Eigen::Vector2d p2d4(561.6, 244.384);
vecPts3d.emplace_back(p3d0);
vecPts3d.emplace_back(p3d1);
vecPts3d.emplace_back(p3d2);
vecPts3d.emplace_back(p3d3);
vecPts3d.emplace_back(p3d4);
vecPts2d.emplace_back(p2d0);
vecPts2d.emplace_back(p2d1);
vecPts2d.emplace_back(p2d2);
vecPts2d.emplace_back(p2d3);
vecPts2d.emplace_back(p2d4);
Eigen::Matrix3d R;
Eigen::Vector3d t;
solvePnPbyEPnP(m_K, vecPts3d, vecPts2d, R, t);
std::cout << R << std::endl;
std::cout << t.transpose() << std::endl;
With Mac&Eigen3.3.4, I got
-0.947487 0.0657636 -0.312958
0.0680975 0.997673 0.00347973
0.312459 -0.0180147 -0.94976
521.61 -34.9744 13.0391
With Linux&Eigen3.2.0 I got
-0.931891 0.142008 -0.333785
-0.142497 -0.989524 -0.0231554
-0.333577 0.025985 0.942365
-1.94579e+156 -6.07921e+156 2.88192e+158
Also I tried Mac&Eigen3.2.0, another differnt result.
-0.946419 0.0664846 0.316023
0.0906903 0.993916 0.0624984
-0.309945 0.0878099 -0.946691
5336.94 -628.954 38868.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.