使用以下算法,当投影平面切线与赤道(等距图像的中心线)相同时,投影图像看起来是直线的。
但是,当投影平面倾斜时(py0 != panorama.height/2),线条会变形。
以下算法中的最后两个“线”需要进行“矫正”,以便在目标平面的中心线与等距图像的中心线不在同一水平线上时,调整 px 和/或 py。
我可以计算每个目标像素的法线与球的交点p,然后使用现有的C代码将笛卡尔坐标转换为经度/纬度:
请问你能帮忙吗?
![Rectilinear image](https://i.imgur.com/kYjlUQk.jpg)
![Warped image](https://istack.dev59.com/CEOup.webp)
// u,v,w :
// Normalized 3D coordinates of the destination pixel
// elevation, azimuth:
// Angles between the origin (sphere center) and the destination pixel
// px0, py0 :
// 2D coordinates in the equirectangular image for the
// the destination plane center (long*scale,lat*scale)
// px, py:
// 2D coordinates of the source pixel in the equirectangular image
// (long*scale,lat*scale)
angularStep=2*PI/panorama.width;
elevation=asin(v/sqrt(u*u+v*v+w*w));
azimuth=-PI/2+atan2(w,u);
px=px0+azimuth/angularStep;
py=py0+elevation/angularStep;
我可以计算每个目标像素的法线与球的交点p,然后使用现有的C代码将笛卡尔坐标转换为经度/纬度:
请问你能帮忙吗?