tags:

views:

87

answers:

2

Hello,

I have a 3D modeling problem which is unrelated to 3D frameworks like XNA. In other words, I have to run the calculations myself (using some framework functionality is OK though).

I have a set of N 3D points, let's call them p1 to pN. While these points are unknown, I know what their projected 2D location is (pp1 to ppN) when the camera has an ORIENTATION described by a unit vector U1.

How can I find out the projection of these points when the camera is oriented differently, as described by a different vector U2?

Any help is appreciated :)

Thanks

A: 

You cannot. When you only know the camera location and orientation and the projection of a point, you don't know where the point actually is - it can be anywhere on a line from the camera through the projection plane into infinity. Hence you are not even able to tell (in the genral case) if the point is visible to a camera at a different location and orientation.

But if you know something about the points - for example they form a cube of known size - you can use this knowledge and the projection of the points to calculate the location of the points and in turn find the projection of the points for other camera locations and orientations.

Daniel Brückner
Hm... thanks for the reply, I edited my question while you were writing you response, in case it makes any difference. What if we assume that all of these points have Z = 0 at the current camera location?
everwicked
The OP is asking where the points are projected given a different orientation, but not location. Location remains constant.
strager
If you know the z coordinate (or any other coordinate) of a point, you can calculate it's location from the projection.
Daniel Brückner
@strager The question stated location instead of orientation before the edit, but this doesn't matter - you cannot calculate the location of a point from a single projection and hence not compensate any camera transformation (besides a few very simple cases).
Daniel Brückner
Gentlemen, I think there is a better way to describe this problem. Let me re-write it and I will post the link to the new question here. THANK YOU!
everwicked
Here is the link: http://stackoverflow.com/questions/1390367/3d-modeling-problem-revisited
everwicked
A: 

I could be totally wrong here, as I haven't touched 3D math or matrices in a long time.

Based off of http://www.songho.ca/opengl/gl%5Ftransform.html.

The formula:

D * M * P * W * V = S
Data * Model * Perspective * W * Viewport = Screen

You know M1, P1, W1, V1, and S1.
You are looking for S2 given a M2, P2=P1, W2=W1, V2=V1.
Also, you know that D1=D2 (3D point doesn't move).

D1 * M1 * P1 * W1 * V1 = S1
D1 * M2 * P1 * W1 * V1 = S2

Solve for D1 and equate them:

D1 = S1 * M1^-1 * P1^-1 * W1^-1 * V1^-1
D1 = S2 * M2^-1 * P1^-1 * W1^-1 * V1^-1
S1 * M1^-1 * P1^-1 * W1^-1 * V1^-1 = S2 * M2^-1 * P1^-1 * W1^-1 * V1^-1

Remove like terms:

S1 * M1^-1 = S2 * M2^-1

Now solve for S2:

S1 * M1^-1  * M2 = S2
strager
Of course, you can invert the calculation, but if and only if you have the two projected coordinates AND the z/depth value. But if your base is just an image, you no longer have the third coordinate and are out of luck.
Daniel Brückner