Jump to content
• Advertisement

# relative camera orientation via least squares

This topic is 4574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I need to estimate a camera orientation given only its relative orientation with regard to some other cameras, and where the relative orientations are not exact. For example, I would like to arrive at a linear system of the form shown below, so that I can solve for C2 via least squares: C1 = C0 + R01 C2 = C1 + R12 C2 = C0 + R02 here Cx is a 3D rotation describing the orientation of camera x and Rxy is the relative orientation between cameras x and y (e.g. the first equations says that the orientation of camera 1 is given by camera 0 rotated by R01). Note that this is only a small example, in the real case, I need to solve for 10+ cameras. 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'm hoping that someone can suggest how to 'linearize' this problem. For example, is there is a way of expressing rotations so that combined rotations are expressed as additions? Euler angles kind of do this, but I'm pretty sure they will misbehave and are not viable for this problem. Thanks for any tips, Jason.

#### Share this post

##### Share on other sites
Advertisement
You can't solve all the absolute orientations given only the relative orientations. Those relative rotations between the cameras would be unchanged if you rotated all the cameras by a small angle around an arbitrary axis. Therefore there is no unambiguous solution to the problem. So will you be using one camera that is 'known' / the 'reference' camera...?

Then the obvious way would just be to calculate all other camera orientations from this reference camera. Or are you thinking that by calculating their orientations in several ways ( ie.
C0 is 'known'
C1 = C0 * R01
C2 = C1 * R12 = C0 * R01 * R12
C2 = C0 * R02
Two ways of calculating C2
) you can gain additional precision, utilising the additional information (R12 in the example)?

Are you wondering how you should weigh together the diffent ways of calculating the orientations?

#### Share this post

##### Share on other sites
Hi Ksero,

I never said anything about absolute orientations - I only want to know C2 with respect to, say, C1.

Given that the R's carry error, the solution for C2 is not unique, and that's why I want to apply least squares to find an optimal solution for C2. (think of the case where I have 20 equations, not three).

When the equations are expressed as products, the system is non-linear, and so is not (?) amenable to a least-squares solution.

So the original question remains: is there a way to express compound rotations as additions, without the perils of Euler angles?

Thanks,

Jason.

#### Share this post

##### Share on other sites
Since the forum doesn't have much support for writing mathematical formulae, I uploaded my thoughts here

#### Share this post

##### Share on other sites
Hi Ksero,

Thanks for your efforts. I'm a little annoyed that I didn't work this out for myself now. 8-).

Probably a silly question, but why do you pre-multiply both sides by A^T?

Also, redarding your comment about adapting the solver, I was hoping to simply apply the same form of this system of equations, but with four times the number of rows. i.e. one row each for the unit-quaternion parameters. I figure this is OK, since these parameters are independent. Is this what you meant?

Thanks again,

Jason.

#### Share this post

##### Share on other sites
Quote:
 Original post by logularjasonProbably a silly question, but why do you pre-multiply both sides by A^T?

Oh, the A^T is how I learnt to solve systems with least-squares... pre-multiply and then solve the resulting, square matrix. But maybe that SVD algorithm does it in another, smarter way.
Quote:
 Also, redarding your comment about adapting the solver, I was hoping to simply apply the same form of this system of equations, but with four times the number of rows. i.e. one row each for the unit-quaternion parameters. I figure this is OK, since these parameters are independent. Is this what you meant?

Ah, right... originally I thought you would code a matrix-class with quaternions as elements. And then an equation solver that could work with these quaternion matrixes... But your way sidesteps that problem by using a regular old matrix. Can't see why that wouldn't work.

Good luck with your project... What are you building? :)

#### Share this post

##### Share on other sites
Well, it's not a game, but these game development sites seem to have quite a lot of active discussion about 3D geometry...

Familiar with photogrammetry? I'm coding up an application that creates a 3D model from a bunch of photos.

#### Share this post

##### Share on other sites
Well, I coded this up, only to realise too late that it won't work. To use a sample equation:

C3 = R13 * C1

We could solve for each of the (x, y, z, w) parameters of C3 in the way described above if it were true to say that

C3.x = R13.x * C1.x
C3.y = R13.y * C1.y

etc., but this is not the way that quaternions multiply. Even if I expand out the quaternion multiplications and include it all in one big set of equations, the rows will be coupled since a row which referenes a quaternion x will also reference a y, etc.

Alas, need to rethink this again.

#### Share this post

##### Share on other sites
Oh, you also need to expand the matrix with four times as many columns... like this (scroll down for the new parts)

EDIT: oops... almost forgot to upload the new page... now it's there

[Edited by - Ksero on May 12, 2006 11:52:29 AM]

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 10
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633404
• Total Posts
3011676
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!