Finding the angle of a perspective image

2019-05-11 16:15发布

I'm working on a floor design app that allows the user to pick preset floor images and view them within a preset room image. enter image description here enter image description here My problem is I'm struggling to get the perspective of the floor image to match the room image properly. I have played around with setting the height of the viewpoint and the tilt but is there a way to calculate what these should be by using the real world measurements of the floor and room image? My knowledge in perspective drawing is very limited so I apologise if I'm using the wrong terminology. Any help or advice would be appreciated.

Thanks

1条回答
干净又极端
2楼-- · 2019-05-11 16:39

You should try to find the vanishing point of the structural lines of the room. There are many line-finding algorithms for this.

Vanishing directions You have to find two vanishing points, for the two main directions of the floor. On your example, one vanishing point is at the convergence of all red lines, the other one is far on the left side, at the convergence of he blue lines.

Once you have this, you can build a regular tiling starting from these two points: Not so regular tiling

To map a texture on the floor, you just have to find the bounding rectangle following the tiling: enter image description here

to stretch your texture inside it: enter image description here

and to remove extra parts and apply shadows: enter image description here

查看更多
登录 后发表回答