Sign in to follow this  
LucioCosmo_115836

2D shape to 3D space view

Recommended Posts

[font="Arial, Helvetica, sans-serif"][size="4"][size="4"][size="4"]Given a maximum of four points in a 2D space, x0,y0 x1,y1 x2,y2 x3,y3. [/size][/size][/size][/font]
[font="Arial, Helvetica, sans-serif"][size="4"][size="4"][size="4"]The 2D space is limited to X 0...1 and Y 0...1.[/size][/size][/size][/font]
[font="Arial, Helvetica, sans-serif"][size="4"][size="4"][size="4"]The points in the sequence 0,1,2,3,0 represent a rectangle (let's say the snapshot of a paper with a camera).[/size][/size][/size][/font]
[font="Arial, Helvetica, sans-serif"][size="4"][size="4"] [/size][/size][/font]
[font="Arial, Helvetica, sans-serif"][size="4"][size="4"][size="4"]I need to know the 3D position of the camera, its orientation vector, view angle, 3D coordinates of the points of the rectangle in the 3D space. Of course there are some missing informations to limit the number of solutions, which is not a problem.[/size]

[size="4"]The reply i had in a math forum has been "This is a rather basic Transformation. Here is a great site for this type of question: gamedev.net/index Do a search there, this question has been asked there about a hundred times."[/size]

[size="4"]Thanks for a simple algorithm to have an approximate solution, or to any link to page or article solving the problem.[/size]

[/size]

[/size][/font]

Share this post


Link to post
Share on other sites
[quote name='lucio.cosmo' timestamp='1306921258' post='4818222']
Of course there are some missing informations...
[/quote]

Yeah, rather a lot of missing information actually. In what sense can there be a 3D position of the camera, or of the rectangle in 3D space if it is only defined in 2D?

If you mean a camera pointing straight at the rectangle, you need to define the Z position of your rectangle. The camera position is then simply the centre position of your rectangle plus or minus the Z distance of the camera from the rectangle (also completely undefined in your example), the look vector would be (0,0,1) or (0,0,-1) depending on which direction your Z goes.

But I suspect I'm barking up a random tree here. Could you please state the problem in terms of what you are actually trying to do, or link to your other thread?

Share this post


Link to post
Share on other sites
You're right, i can expose better the problem. So let me do in a more concrete way.

You've got a camera and take a snapshot of a (rectangular) paper lying on a table.
I get that picture, use as a flat background and setup an OpenGL scene in the way that the paper i have a quad with coordinates, let's say (0,0,0) (1,0,0) (1,2,0) (0,2,0).
This way i can replace the "paper" with an image that i need, with correct perspective, indipendent from the the snapsho angle, etc.

In other words, i would like reproduce the same algorithms behind photoshop's "vanishing point" function.

I suspect there are some other variables to "decide" to have a single output solution, this is not a problem.

Thanks for your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this