我将尝试概述用于解决此类问题的算法。首先,我们需要了解相机的物理特性,即它所拍摄图像的焦距和实际尺寸,以及以像素为单位的尺寸。如果我说的是图像的“真实”尺寸,它实际上是指图像的尺寸(或者,更容易想象,经典胶片相机的底片尺寸)。用于航空测绘的典型中画幅相机的示例值为 50 毫米焦距、9000*6800 像素、6 微米像素大小,图像大小约为 40x54 毫米。
计算地面上一个像素位置的算法是(适用于使用 LSR 系统,也可以使用地理坐标进行计算):
public void ImageToGround(Camera sensor, double posx, double posy, double posz,
double dDeltaX, double dDeltaY,
Matrix4D rotationMatrixItg,
double groundheight, out double resultx, out double resultx)
{
// The rotation matrix is right-handed, with x pointing in flight direction, y to the right and z down.
// The image cs is increasing x to the right and y to the bottom (y = 0 is front in flight direction)
Vector3D imagePointRelativeToFocalPoint = new Vector3D(
dDeltaX,
dDeltaY,
-sensor.MetricFocalLength);
// Transform from img to camera coord system and rotate.
// The rotation Matrix contains the transformation from image coordinate system to camera
// coordinate system.
Vector3D imagePointRotated = rotationMatrixItg * imagePointRelativeToFocalPoint;
double dir, dist;
// Create a horizontal plane at groundheight, pointing upwards. (Z still points down)
Plane plane = new Plane(new Vector3D(0, 0, -1), new Vector3D(0, 0, -groundheight));
// And a ray, starting at the given image point (including the real height of the image position).
// Direction is opposite to the vector given above (from image to focal point).
Ray start = new Ray(new Vector3D(imagePointRotated.X, imagePointRotated.Y, imagePointRotated.Z - evHASL),
-(new Vector3D(imagePointRotated.X, imagePointRotated.Y, imagePointRotated.Z)));
// Find the point where the ray intersects the plane (this is on the opposite side of the
// x and y axes, because the ray goes trough the origin).
IntersectionPair p = start.Intersects(plane);
if (p.NumIntersections < 1)
{
resultx = 0;
resulty = 0;
return;
}
resultx = p.Intersection1.x;
resulty = p.Intersection1.y;
}
with posx, posy, posz:图像中心的位置;dDeltaX, dDeltaY:像素在焦平面上的位置(以米为单位);rotationMatrixItg:图像到地面的旋转矩阵,由图像的偏航、俯仰、滚动创建;groundheight:地面的高程;resultx, resulty:地面上的结果位置。我已经简化了算法,因此您可能需要对其进行调整以满足您的需求。
当地形不平坦时,问题会变得更加复杂。如果需要将整个图像投影到地面上,通常会采用相反的方式,因为这样更容易插值并且可以并行完成。
我不完全知道您所说的“虚拟”图像是什么意思,因为它们也是由投影创建的,因此存在一些可以使用的理论图像参数。