Find angle in another view of image

162 Views Asked by At

Is it possible to find angle in some "virtual" view from scaled view? (yes it is :] ) What i mean, for example: You got table and you look at it from some position (you know that the left top corner is x=0,y=0, you know width and height). On the table is for example keyboard. I need to get position of this keyboard on table (x,y) from 90° (verticall) view.

Image maybe say you more: image of table

I know, that corners of the table clutch 90°. So i thought, that i can count ratio between the "virtual" view angle (90°) and the real view angle (for example 56°). After counting this ratios i can project a line in the real view from the corner to the object (in this case keyboard). If i multiply this angle between this line and one of the corner line, i thought i get the angle in the "virtual" view. If i do it atleast for 2 corners, i thought i can get the position of the object in the "virtual view". But if i tried that (only quickly rotating in photoshop), i cannot get the middle exactly.

Those steps i was describing i visualize on this image: image of table with lines

I dont know if i my solution is too much simple. I think in the real math it is a little bit more complicated.

I know, that solution would be rotation, scale and move matrix. But it will deform the keyboard.

1

There are 1 best solutions below

0
On

You can follow the approach from this post, perhaps using the sage code from this post, to construct a matrix which maps between your projected image and the plane rectangle in its original coordinate system. Thge input for this transformation are the coordinates of the four corners, in both the original and the projected image. You can then apply this projective transformation matrix to map every other point as well.