OT: fitting a plane model to 2d points 2003-12-05 - By pat hammond
Back thanks Danny :) I'll give this a go when I get a chance & let you know if I get it working. I did some hunting on the subject of auto camera calibration & found a bunch of stuff on an NEC research site http://citeseer.nj.nec.com/faugeras92camera.html they get pretty heavy on the math but it's good to see what the super-geeks are up to. Pat
-- -- Original Message -- -- From: "pat hammond" <ziloguser@(protected)> To: <dir3d-l@(protected)> Sent: Thursday, December 04, 2003 2:13 PM Subject: RE: [Dir3d-l] OT: fitting a plane model to 2d points
> thanks :) good luck! > it seemed straight-forward enough to me at first but after getting > some nasty trig flashbacks I had to quit.
You're right that it's a lot harder than it sounds. I haven't fleshed out the details but I did get it to the stage of a set of relatively simple simultaneous equations...
You have points p_1, p_2, p_3, p_4 (numbered clockwise around the shape). For each of these use spritespacetoworldspace to calculate four points in 3d space q_1, q_2, q_3, q_4. Now you know that each of the actual points in space is equal to c+k_i*q_i, for some set of coefficients k_i, and where c is the location of the camera.
The vectors along the lines of the rectangle are therefore equal to v_1=k_2q_2-k_1q_1, v_2=k_3q_3-k_2q_2, v_3=k_3q_3-k_4q_4 and v_4=k_4q_4-k_1q_1.
Because it's a rectangle, we know that v_1=v_3 and v_2=v_4. We also know that v_1.v_2=0 (and the same for the other vectors, but these are equivalent because the sides are parallel: knowing a shape is a parallelogram, you only need one right angle to know it's a rectangle). Finally, we know that *either* v_1.v_1=a^2 and v_2.v_2=b^2 *or* v_1.v_1=b^2 and v_2.v_2=a^2, where a and b are the sides of the rectangle.
Now, this is a wealth of information: far more than we should need to determine the four unknowns k_i. That's good, because of course for an arbitrary set p_i we can't find a solution. It's only because we know the points were generated by the particular method that we know it's solveable (and it's because it's so unlikely that a set of points should accidentally be the same as those which were projected by a rectangle that optical illusions and 3d displays work at all!)
Apologies for the scary-looking formulae. I wouldn't have used the underscores if it wasn't for needing to write p_i rather than pi.
Danny
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|