Code: Select all
// 2D fisheye to 3D vector
phi = r * aperture / 2
theta = atan2(y, x)
// 3D vector to longitude/latitude
longitude = atan2(Py, Px)
latitude = atan2(Pz, (Px^2 + Py^2)^(0.5))
// 3D vector to 2D equirectangular
x = longitude / PI
y = 2 * latitude / PI
Code: Select all
const float FOV = 220.0f * PI / 180.0f;
float r = sqrt(u*u + v*v);
float theta = atan2(v, u);
float phi = r * FOV * 0.5f;
float px = u;
float py = r * sin(phi);
float pz = v;
float longitude = atan2(py, px); // theta
float latitude = atan2(pz, sqrt(px*px + py*py)); // phi
x = longitude / PI;
y = 2.0f * latitude / PI;
Angenommen, das Sichtfeld meiner Kamera beträgt 220 Grad und die Kameraauflösung beträgt 2880 x 1440, dann würde ich den Punkt (358, 224) für die Rückkamera erwarten Der überlappende Bereich und der Punkt (2563, 197) für die Frontkamera im überlappenden Bereich würden beide einer Koordinate in der Nähe von (2205, 1009) zugeordnet. Die tatsächlichen Kartierungspunkte sind jedoch (515.966370,1834.647949) bzw. (1644.442017,1853.060669), die beide sehr weit von (2205,1009) entfernt sind. Bitte schlagen Sie vor, wie Sie den obigen Code beheben können. Vielen Dank!