Finding the angle of a perspective image

天涯浪子 提交于 2019-12-07 14:16:27

问题


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. 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:


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

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:

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

to stretch your texture inside it:

and to remove extra parts and apply shadows:



来源:https://stackoverflow.com/questions/38991858/finding-the-angle-of-a-perspective-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!