Jump to content

  • Log In with Google      Sign In   
  • Create Account


Calculating 3D rotation of predefined shape from 2D data ( image )


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 NullData   Members   -  Reputation: 108

Like
0Likes
Like

Posted 05 October 2013 - 12:03 PM

I'm writing a piece of software that needs a kind of image recognition( think QR code ) to display 3d objects over the camera feed. The 'code' containing the information needed to display the model is a perfect square, but I need to somehow calculate it's 3d rotation. The data available is a constructed 2d quadrilateral based on the camera feed.



Sponsor:

#2 mawigator   Members   -  Reputation: 369

Like
0Likes
Like

Posted 06 October 2013 - 02:18 PM

I have never tried it, but it is interesting from mathematical point of view ;)

 

In 2D image you do not have the z position of the each point.

But, if the model is perfect square, then all edges shall be the same length (say L).

 

Each point p'=(x',y') on screen is representation of some point p=(x,y,z) in 3D space, that:

 

x0'=x0/z0

y0'=y0/z0 

x1'=x1/z1

y1'=y1/z1 

x2'=x2/z2

y2'=y2/z2 

x3'=x3/z3

y3'=y3/z3 

 

and you know that borders have

 

(x0-x1)^2+(y0-y1)^2+(z0-z1)^2=L^2

(x1-x2)^2+(y1-y2)^2+(z1-z2)^2=L^2

(x2-x3)^2+(y2-y3)^2+(z2-z3)^2=L^2

(x0-x3)^2+(y0-y3)^2+(z0-z3)^2=L^2

 

and across the polygon

 

(x0-x2)^2+(y0-y2)^2+(z0-z2)^2=2*L^2

(x3-x1)^2+(y3-y1)^2+(z3-z1)^2=2*L^2

 

I assumed that points are sorted.

So you have 14 equations for 13 unknown variables (x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3, L).

It is more than you need. I would try to solve it with some approximate, iterative method

(Newton or maybe least squares). From 3D model you may get the rotations, but,  

you need to know which two points are the reference (e.g.. the square rotated by 90 deg around the center is looks as the same square biggrin.png ).


Edited by mawigator, 06 October 2013 - 02:33 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS