image - 立方到等角投影算法

标签 image algorithm image-processing graphics geometry

我有一个定义周围环境的立方体贴图纹理,但是我需要将它传递给一个只适用于纬度/经度贴图的程序。我真的不知道如何进行翻译。有什么帮助吗?

也就是说,我需要从这里来:

enter image description here

为此(我认为图像在 x 轴上有一个额外的 -90° 旋转):

enter image description here

更新:我得到了投影的正式名称。顺便找到了相反的投影here

最佳答案

像这样投影光栅图像的一般过程是:

for each pixel of the destination image:
    calculate the corresponding unit vector in 3-dimensional space
    calculate the x,y coordinate for that vector in the source image
    sample the source image at that coordinate and assign the value to the destination pixel

最后一步只是插值。我们将重点关注其他两个步骤。

给定纬度和经度的单位向量是(+z 朝向北极,+x 朝向本初子午线):

x = cos(lat)*cos(lon)
y = cos(lat)*sin(lon)
z = sin(lat)

假设立方体围绕原点 +/- 1 个单位(即 2x2x2 总体尺寸)。 一旦我们有了单位向量,我们就可以通过查看具有最大绝对值的元素来找到它所在的立方体的面。例如,如果我们的单位向量是 <0.2099, -0.7289, 0.6516>,那么 y 元素的绝对值最大。它是负数,所以该点位于立方体的 -y 面上。通过除以 y 幅度来归一化其他两个坐标以获得该面内的位置。因此,该点将位于 -y 面上的 x=0.2879、z=0.8939。

关于image - 立方到等角投影算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11504584/

相关文章:

iOS 给 UIImageView 添加点击手势

algorithm - 这个循环不变量是否正确?

image - 用 Mathematica 中的自定义图像替换像素?

python - 如何在数学上定义嘈杂的轮廓?

html - 浏览器缩放时无法修复 slider 移动距离

android - 无法在 android 中找到变换灰度类以在 android 中转换为灰度

Android Listview 图片大小

python - 通过最小化迭代次数来改进代码

algorithm - 画线时 Ramer–Douglas–Peucker 算法出现问题

MATLAB-灰度图像中的小鼠分割,对阴影具有不变性