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

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

问题描述

我正在开发一款地板设计应用,该应用允许用户选择预设的地板图像并在预设的房间图像中查看它们.我的问题是我正在努力使地板图像的透视图与房间图像正确匹配.我已经尝试过设置视点的高度和倾斜度,但是有没有办法通过使用地板和房间图像的真实世界测量来计算这些应该是什么?我对透视图的了解非常有限,所以如果我使用了错误的术语,我深表歉意.任何帮助或建议将不胜感激.

谢谢

解决方案

您应该尝试找到 对于地板的两个主要方向,您必须找到两个消失点.在你的例子中,一个消失点在所有红线的汇合处,另一个消失点在左边,在蓝线的汇合处.

一旦你有了这个,你就可以从以下两点开始构建一个常规的平铺:

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

在里面拉伸你的纹理:

并删除多余的部分并应用阴影:

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天全站免登陆