views:

440

answers:

3

Imagine a photo, with the face of a building marked out.

Its given that the face of the building is a rectangle, with 90 degree corners. However, because its a photo, perspective will be involved and the parallel edges of the face will converge on the horizon.

With such a rectangle, how do you calculate the angle in 2D of the vectors of the edges of a face that is at right angles to it?

In the image below, the blue is the face marked on the photo, and I'm wondering how to calculate the 2D vector of the red lines of the other face:

example

So if you ignore the picture for a moment, and concentrate on the lines, is there enough information in one of the face outlines - the interior angles and such - to know the path of the face on the other side of the corner? What would the formula be?

example

A: 

It would be more than possible, but I don't have a sufficient grasp of matrices and such - I just steal the tutorial.

If you have the topright/bottomleft corners of the blue in 3D, it should be possible to transform them with a transformation matrix, then project them back into 2D.

Edit for some accuracy.

DeadMG
A: 

It's quite easy, you should use basic 2 point perspective rules.

First of all you need 2 vanishing points, one to the left and one to the right of your object. They'll both stay on the same horizon line.

alt text

After having placed the horizon (that chooses the sight heigh) and the vanishing points (the positions of the points will change field of view) you can easily calculate where your lines go (of course you need to be able to calculate the line that crosses two points: i think you can do it)

Jack
A: 

Honestly, what I'd do is a Hough Transform on the image and determine a way to identify the red lines from the image. To find the red lines, I'd find any lines in the transform that touch your blue ones. The good thing about the transform is that you get angle information for free.

Since you know that you're looking at lines, you could also do a Radon Transform and look for peaks at particular angles; it's essentially the same thing.

Matlab has some nice functionality for this kind of work.

mmr
Hough is an interesting approach that I'm familiar with, but I'm looking for a mathematical approach to inform me which Hough lines to trust..
Will
Is corner intersection a good trust metric? Finding the corners of your blue marked region should be doable, especially if the marking is guaranteed to have four such corners. Then lines that could extend through that corner point could be candidates, and maybe choose the closest one as the answer.
mmr
The idea that I can cull the noisy points by looking for candidate lines that match a perspective projection of a candidate shape; this means I have to have the forumla for the projection...
Will