以下のアルゴリズムでは、投影面が赤道 (正距円筒図法の中心線) に接している場合、投影された画像は直線的に見えます。
しかし、投影面が傾いていると (py0 != panorama.height/2)、線が歪んでしまいます。
以下のアルゴリズムの最後の 2 つの「線」は、宛先平面の中心線が正距円筒イメージの中心線と同じレベルにない場合に px および/または py を調整するために、「修正」する必要があります。
// 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 コードを使用してデカルト座標を経度/緯度に変換できます。
しかし、投影面の中心が「球」と交差する経度/緯度 (px0,py0) を知っている正距円筒図法画像 (px,py) のソース ピクセル座標を調整することを含む、より簡単で時間がかからない方法があることを私は知っています。
助けていただけますか?