Skip to content

Commit

Permalink
[Mutliview/P3P] fix openMVG#1597 thx @mpizenberg & @midjji
Browse files Browse the repository at this point in the history
  • Loading branch information
rjanvier authored and pmoulon committed Nov 9, 2019
1 parent 854fda9 commit 3bc6dc6
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/openMVG/multiview/solver_resection_p3p_nordberg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,31 +393,35 @@ bool computePosesNordberg(
{
double tau1, tau2;
root2real(b, c, tau1, tau2);
if (tau1 > 0)
if (tau1 > 0.0)
{
double tau = tau1;
double d = a23 / (tau * (b23 + tau) + 1.0);
double l2 = std::sqrt(d);
double l3 = tau * l2;

double l1 = w0 * l2 + w1 * l3;
if (l1 >= 0.0)
{
Ls[valid] = Vec3(l1, l2, l3);
++valid;
if(d > 0.0) {
double l2 = std::sqrt(d);
double l3 = tau * l2;

double l1 = w0 * l2 + w1 * l3;
if (l1 >= 0.0)
{
Ls[valid] = Vec3(l1, l2, l3);
++valid;
}
}
}
if (tau2 > 0.0)
{
double tau = tau2;
double d = a23 / (tau * (b23 + tau) + 1.0);
double l2 = std::sqrt(d);
double l3 = tau * l2;
double l1 = w0 * l2 + w1 * l3;
if (l1 >= 0.0)
{
Ls[valid] = Vec3(l1, l2, l3);
++valid;
if(d > 0.0) {
double l2 = std::sqrt(d);
double l3 = tau * l2;
double l1 = w0 * l2 + w1 * l3;
if (l1 >= 0.0)
{
Ls[valid] = Vec3(l1, l2, l3);
++valid;
}
}
}
}
Expand Down

0 comments on commit 3bc6dc6

Please sign in to comment.