# comp.graphics.algorithms

## Subject: Re: 3D rotation estimate via least squares

"Jason Grant" wrote in message
news:pan.2006.05.09.07.17.38.376145@logular.com...

> Now if I could form equations like this, I would be able to solve them
> easily. The trouble is, if I use, say, quaternions to describe the
> rotations, then multiplication rather than addition should be used to
> combine rotations, so the equations would instead look like:
>
> C1 = C0 * R01
> C2 = C1 * R12
> C2 = C0 * R02
>
> and this is no longer a set of linear equations that I can solve with
> least-squares (e.g. SVD). (I think)

I think your goal should be to solve the problem, not to
set up the problem so that you can apply a particular method.

Your equations seem to imply that you have uncertainty
in the relative orientations between the given set of
cameras. Is this correct?

Assuming you have n cameras with orientations specified
exactly by rotation matrices C[i], for 0 <= i <= n-1, and
given another camera whose orientation is specified exactly
by the rotation matrix C[n], you know that C[n] = R[i]*C[i]
for 0 <= i <= n-1. The error is introduced in the measurement
of R[i], call this error matrix E[i], so in practice you have
C[n] = (R[i] + E[i])*C[i] for 0 <= i <= n-1. Solving for each
error matrix,
E[i] = C[n]*Inverse(C[i]) - R[i]
The least squares problem is to minimize the sum of squared
errors
F(C[n]) = sum_{i=0}^{n-1} |E[i]|^2
where |M| is some norm of the matrix M. For the sake of
argument, use Transpose(M)*M. F(C[n]) is a quadratic
function in the components of C[n]. Taking first-order
partial derivatives with respect to these components and
setting to zero produces a linear system of equations
that you may solve numerically.

There are other possible formulations. For example,
C[n] = (R[i]*E[i])*C[i] if you want to think of the error
in a "multiplicative" sense. Or you might also try
C[n] = R[i]*C[i] + E[i]. In all these cases, F is quadratic
in the components of C[n].

Now if you really have uncertainty in the C[i], I'd have
to think harder about the set up. You effectively have
C[n] = (R[i]+E[i])*(C[i]+E'[i]) where E[i] and E'[i] are
the error terms.

--
Dave Eberly
http://www.geometrictools.com