I've been watching a set of videos on medical image processing, and I'm working through a section on using Quaternions for 3 d image registration. That is, given 2 sets of 3 points in R3, where one set has been rotated about an axis by an unknown amount, find the quaternion that best describes the rotation.

The problem is described in one of the handouts

http://www5.informatik.uni-erlangen....gistration.pdf

on about page 40.

I have written matlab code that successfully does this transform.

I set up a system of equations as below:

%(pqPrime1 * q) - (q * p1) = 0;

%(pqPrime2 * q) - (q * p2) = 0;

where pqPrime is the rotated point/quaternion

p1 is the non-rotated point

q is the unknown quaternion we want.

This becomes a matrix of point coefficients and using singular value decomposition

U S V = svd(M)

I find the vector in the null space at V

ns = V(:,4);

This solution was spoken by the professor during the video, however, the problem wasn't fully worked out so I'm just trying to work it out myself..

This works great and I get it - what I'm fuzzy on though is, shouldn't I be minimizing some error E rather than setting the equations = 0? If so, I don't see how I should set up the equations for that....

Thanks in advance.

Rick