Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 2108 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'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.

Share this post

Link to post
Share on other sites

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:











and you know that borders have







and across the polygon





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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!