Medium Transformation Matrix for Transformation List

I have several ratings for the transformation matrix, from mapping two point clouds to each other via ICP (Iterative Closest Point) .

How can I generate an average transformation matrix for all of these matrices?

Each matrix consists of a hard shift and only rotation, without scaling or skewing.

Ideally, I would also like to calculate the weighted average, but the unweighted option is now good.

Averaging the translation vectors is, of course, trivial, but rotation is problematic. One approach I found is to average individual base vectors for rotations, but I'm not sure what will lead to the creation of a new orthonormal base, and the approach seems a bit ad-hoc.

+6
source share
3 answers

The separation of conversion in translation and rotation is a good start. Averaging the translation is trivial.

Averaging rotation is not so simple. Most approaches will use quaternions. Therefore, you need to convert the rotation matrix to quaternion.

The easiest way to approximate the average is linear mixing, followed by renormalization of the quaternion:

q* = w1 * q1 + w2 * q2 + ... + w2 * qn normalize q* 

However, this is only an approximation. The reason for this is that the combination of two turns is not performed by adding quaternions, but by multiplying them. If we transform quaternions into logarithmic space, we can use a simple linear mixture (because multiplication will be a complement). Then convert the quaternion back to the original space. This is the idea of ​​the Spherical Average (Buss 2001). If you're lucky, you'll find a library that supports log and exp quaternions:

 start with q* as above do until convergence for each input quaternion i (index) diff = q[i] * inverse(q*) u[i] = log(diff, base q*) //Now perform the linear blend adapt := zero quaternion weights := 0 for each input quaternion i adapt += weight[i] * u[i] weights += weight[i] adapt *= 1/weights adaptInOriginalSpace = q* ^ adapt (^ is the power operator) q* = adaptInOriginalSpace * q* 

You can define a threshold for adaptInOriginalSpace . If this is a very small rotation, you can break the loop. It is proved that this algorithm preserves geodesic distances on the sphere.

+8
source

http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation and http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion will provide you with excellent mathematics and a way to turn the rotation matrix into a rotation angle around the rotation axis. There will be two possible representations of each rotation with different signs for both the rotation angle and the rotation axis.

You can convert everything and normalize them to have + ve rotation angles, then work out the average rotation angle and the average rotation axis, renormalizing it into a unit vector.

OTOH, if your intention is to work out the most accurate possible estimate of the transformation, you need to write down some quality factor estimate for any candidate transformation β€” the sum of the squared errors is often mathematically convenient β€” and then solve the optimization problem to decide which transform minimizes the sum of the squared errors . This is at least easier to justify than to accept on average individual estimates that are error prone and can be more accurate.

+2
source

If you have an existing lerp method, then there is a trivial solution:

 count = 1 average_transform = Matrix.Identity(4) for new_transform in list_of_matrices: factor = 1/count average_transform = lerp(average_transform, new_transform, factor) count += 1 

This is only useful because more mathermatics packages have the ability to delay matrices rather than medium batches.

Because I have not met this method elsewhere, here is unofficial evidence:

  • If there is one matrix, use this particular matrix (the coefficient will be 1 for the first matrix)
  • If there are two matrices, we need 50% of the second (the second coefficient is 50%, so we are halfway between the existing first and new)
  • If there are three matrices, we need 33% of each, or 66% of the average of the first two and 33% of the third. The lerp coefficient of 0.3333 does this.

And so on.

I have not tested extensively with matrices, but I have used this successfully as a moving average for other data types.

+1
source

All Articles