找到透视图像的角度 [英] Finding the angle of a perspective image

查看:154
本文介绍了找到透视图像的角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个地板设计应用程序,允许用户选择预设的地板图像并在预设的房间图像中查看它们。


我的问题是我很难获得地板的视角图像以正确匹配房间图像。我一直在设置视点和倾斜的高度,但有没有办法通过使用真实世界的地板和房间图像测量来计算这些应该是什么?我在透视图中的知识非常有限,所以如果我使用错误的术语,我会道歉。
任何帮助或建议都将不胜感激。



谢谢

解决方案

您应该尝试找到房间结构线的
你必须找到两个消失点,分别是地板的两个主要方向。在你的例子中,一个消失点在所有红线的会聚处,另一个消失点在左侧的远处,在蓝线的会聚处。



一次你有这个,你可以从这两点开始建立一个常规的平铺:



要映射在地板上的纹理,您只需找到平铺后的边界矩形:



并删除额外部分并应用阴影:
< a href =https://i.stack .imgur.com / uMOFs.jpgrel =nofollow noreferrer>


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

解决方案

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:

这篇关于找到透视图像的角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆