recoverPose threshold in Source code

asked 2016-07-19 05:18:19 -0600

In recoverPose(...) src code, there's this snippet.

// Do the cheirality check.
// Notice here a threshold dist is used to filter
// out far away points (i.e. infinite points) since
// there depth may vary between postive and negtive.
double dist = 50.0;

And this threshold is used in:

mask1 = (Q.row(2) < dist) & mask1;
Q = P1 * Q;
mask1 = (Q.row(2) > 0) & mask1;
mask1 = (Q.row(2) < dist) & mask1;

....

mask2 = (Q.row(2) < dist) & mask2;
Q = P2 * Q;
mask2 = (Q.row(2) > 0) & mask2;
mask2 = (Q.row(2) < dist) & mask2;

...

mask3 = (Q.row(2) < dist) & mask3;
Q = P3 * Q;
mask3 = (Q.row(2) > 0) & mask3;
mask3 = (Q.row(2) < dist) & mask3;

...

mask4 = (Q.row(2) < dist) & mask4;
Q = P4 * Q;
mask4 = (Q.row(2) > 0) & mask4;
mask4 = (Q.row(2) < dist) & mask4;

My question is, why was this threshold put equal to 50 specifically ? If it's a parameter, why isn't it passed as an argument to the function ???

Thanks in Advance

edit retag flag offensive close merge delete

Comments

Its probably hardcoded and retrieved using a value that worked for the original author. This is indeed not that smart, because you are now unable to change it dynamically on the fly instead of needing to rebuild OpenCV. I guess you could supply a PR with a suggested fix, where 50 is the default value, but you could add getters and setters to adapt the value.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-07-19 07:42:39 -0600 )edit