Sunday, April 22, 2012

CoPlanar Pose Estimation - Iterated Error Minimization approach

So this week I finished testing out the approach using 3 coplanar points with the following givens:
- Two of the points are equidistant from a third point.  (generating two vectors rg and rb, where:
 |rg| = |rb|)
- Those two vectors are also perpendicular to each other. (allowing you to assume dot(rg, rb) = 0 ).

Breaking down the two equations, you reach:
rgZ = - (rgX*rbX + rgY*rbY)/rbZ
and
rbZ = sqrt( rgX^2 + rgY^2 + rgZ^2 - rbX^2 - rbY );

Using these two formulas, it is possible to iteratively guess at one (or both) of the possible normals, in my demo I chose only to guess at one of the normals, thinking it should be possible to determine which one you want by always being the one that points towards you.  This needs to be tweaked a bit, as this result isn't being reached based on my current approach.

Some screen shots (thick transparent lines are expected normals, thin opaque lines are estimated normals ):

As you can see the guesses are by no means perfect, as there is both a large error visible here, and the cyan is facing the wrong direction.


What seems like a nice estimation is rendered unlikely to occur for the magenta normal as those src points would be very unlikely to attain on a planar target.

Another example of the normal facing the other direction.

Log of random points ((rgX,rgY, rgZ) and (rbX,rbY, rbZ)) being fed to algorithm:
VecG is simply rgX,rgY with the computed rgZ. Same is true for VegB.
Normal is the cross-product of both.
"Error" is computed by using the second (or the unused) equation used to compute the values.


VecG: x: 31.5836 y: -78.3898 z: -84.347
VecB: x: -29.5511 y: -90.051 z: 72.6256
NormalVector is: x: 31.5836 y: -78.3898 z: -84.347
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -68.688 y: -80.2789 z: -43.0637
VecB: x: -37.2845 y: -24.4362 z: 105.024
NormalVector is: x: -68.688 y: -80.2789 z: -43.0637
"Error", should be very close to Zero:  1.42109e-014

VecG: x: 47.2518 y: -11.8229 z: -49.4074
VecB: x: 48.9731 y: -7.34275 z: 48.5935
NormalVector is: x: 47.2518 y: -11.8229 z: -49.4074
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -20.7617 y: -77.7093 z: -95.7285
VecB: x: 24.3629 y: -97.7477 z: 74.0646
NormalVector is: x: -20.7617 y: -77.7093 z: -95.7285
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -71.3187 y: -10.7273 z: 103.581
VecB: x: 99.1394 y: -45.4115 z: 63.5577
NormalVector is: x: -71.3187 y: -10.7273 z: 103.581
"Error", should be very close to Zero: 1.42109e-014

VecG: x: 16.3549 y: -28.9468 z: -30.6332
VecB: x: 28.4036 y: -16.7058 z: 30.9507
NormalVector is: x: 16.3549 y: -28.9468 z: -30.6332
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -8.72524 y: -24.6681 z: -76.4579
VecB: x: -70.22 y: -35.023 z: 19.3131
NormalVector is: x: -8.72524 y: -24.6681 z: -76.4579
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -50.6455 y: -88.3694 z: 19.7959
VecB: x: 57.7013 y: -14.008 z: 85.0901
NormalVector is: x: -50.6455 y: -88.3694 z: 19.7959
"Error", should be very close to Zero: 1.42109e-014

VecG: x: -19.48 y: -20.7312 z: -95.9996
VecB: x: -96.9359 y: -11.6703 z: 22.1902
NormalVector is: x: -19.48 y: -20.7312 z: -95.9996
"Error", should be very close to Zero: 4.26326e-014

VecG: x: -36.8877 y: -35.8715 z: 109.191
VecB: x: 87.1273 y: -83.517 z: 1.99698
NormalVector is: x: -36.8877 y: -35.8715 z: 109.191
"Error", should be very close to Zero: 1.98952e-013



I also looked into other approaches of Coplanar Pose Estimation and found a REALLY NICE demo using AForge.. a C# framework...  here is a screenshot:



The theory is described in a paper titled "Iterative Pose Estimation using Coplanar Feature Points" written by Oberkampf, Daniel DeMenthon and Larry Davis.  It uses four source points and generates the matrix formed by the translation and rotation transformations, along with the alternate matrix (as it is possible to have two normals.)


Goals for Next time:
- Integrate normal estimation with captured source points.
- Improve upon estimation approach through other algorithms (reverse engineer Coplanar Class from AForge?)

No comments:

Post a Comment