# How can I determine a transformation matrix between two 3D datasets?

I'm working on a computer vision problem: I have a moving camera, and a set of objects (reference points, really) that I'm tracking. The objects themselves are rigid-- they do not move relative to each other, and are fixed in place.

I can come up with 3D coordinates for my objects in both frames, relative to the camera's position in each frame. What I need to know is the transformation that gets those data points from frame A to frame B, or at least a close approximation of it.

I'm not sure how to approach this really. I can get the translation quite simply by averaging the points and obtaining the vector between the centerpoint each frame, but that's as far as I've gotten. I can't figure out how to extract the rotation from the data.

Be gentle! I've made it through Calculus 1 and have not yet taken Linear Algebra. I'm familiar with vectors and matricies, but I wouldn't call myself fluent. My experience is mostly limited to working with 3D graphics from the software side, and it seems that what I need to do here is the reverse of that.

My first thought is to do some sort of regression, or even sort of a brute force, trying various permutations within my expected range of movement and refining that with every iteration. Is that the right approach, or is there an easier way? Do I need to calculate a separate rotation along each axis, or the entire transformation all at once?

Oh: I can guarantee that I'm working with the same points in each frame, that the points do not move relative to each other, and that I have at least 4 non-coplanar points. My software won't attempt the extraction otherwise. I do only need a close approximation, as I don't expect my data sets to be ideal. (there will certainly be small errors in the measurement)

-