Monday, September 7, 2009

With Sylvester Resultant to obtain the 8th degree polynomial


Several days ago I have introduced a method from Linnainmaa about how to obtain the parameters of a 8th degree polynomial to solve the PnP pose estimation problem. But from the result we can find it isn't so nice to be applied, one main reason is after 3 times parameters substitution, the whole system becomes very sensitive, any tiny deviation can lead to a big change, so if the frequent substitution can be avoided, the result will be definitely improved. One possibility is using a mathematic tool which is called 'Sylvester Resultant' (from the link you can find some basic introductions and examples about it)to eliminate the variables from the system of equations, as:
so the second and third equation can be rewritten as follows: here the cosine values of the three angles correspondent to a, b, c are replaced as A, B, C

and based on these relationships we are able to build a sylvester matrix:

And here is an information about how to calculate the determinant of a matrix:click me. It's very important here to calculate the determinant correctly, specially when the rank of the matrix is larger than 3. After the careful calculation we can achieve a 4th polynomial of b:

with

And combine with the first equation at the beginning we can obtain a second Sylvester Resultant matrix as follows:

After simplify the determinant expression and combine the like terms we are able to obtain the 8th polynomial of a Marker-Camera distance. Because the terms are too ruleless and endlessly long, here I won't copy the terrible result here. But I would like to share the Matlab implementation here to save you guys another cafe time. click me
And from the result we can find easily that with this method the relative error of the result is about 0.2, while the previous implementation is about 0.3. And the reconstruction image looks also better.
and this is the previous vision of reconstruction:

0 comments: