以一定角度坐标映射

时间:2014-03-22 18:08:37

标签: mapping angle coordinate vision

我有这个问题,我可能在我的头脑中过于复杂。我已经在这里待了很长时间了,如果有人能给我一些指导,我将不胜感激。

所以我正在尝试做的是将从天空拍摄的图像上的坐标映射到地面上平坦表面上的坐标。从一个点的正上方可以很好,我可以通过使用基本三角函数计算的某个因子来缩放我的坐标。

问题是相机是否有角度。

http://i61.tinypic.com/359wsok.png [注意,高度是这里的Z轴]

我希望我的图表有意义。中心线(以(x2,y2)结束的中心线将其他2条线平分,即每条外线与中心线的距离均为(1/2)度。我明白这可能会变得非常复杂。相机指向,图像的表面越多。显然这意味着图像最远部分的2个像素之间的距离大于“放大”的像素之间的距离。感觉。如果我可以管理一些效果相当好的东西,即使只是垂直40度,也会很棒。

我的第一次尝试是获取视图中的表面大小,然后使用它来缩放我的坐标。但是,我不相信这有效。 (x2,y2)可能不在捕获曲面的中心,并且由于捕获的曲面不在正下方,因此需要将某种偏移添加到坐标中。

我希望这一切都清楚。如果您需要更多信息,请告诉我。我只是在圈子里走了一圈。

由于

1 个答案:

答案 0 :(得分:1)

我将尝试概述用于解决此类问题的算法。首先,我们需要知道相机的物理特性,即所拍摄图像的焦距和实际尺寸,以及像素的大小。如果我说的是图像的“真实”大小,这实际上意味着图像的大小(或者更容易想象,经典胶片相机的负片大小)。用于航空测绘的典型中画幅相机的示例值将是50mm焦距,9000 * 6800像素,具有6微米像素尺寸,给出~40x54mm的图像尺寸。

计算地面上一个像素位置的算法是(适用于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;

   }

posx,posy,posz:图像中心的位置; dDeltaX,dDeltaY:焦平面上像素的位置(以米为单位); rotationMatrixItg:图像到地面的旋转矩阵,由偏航,俯仰,滚动的图像创建;地面高度:地面高度;结果,结果:结果在地面上的位置。我已经简化了算法,因此您可能需要对其进行调整以满足您的需求。

当地形不平坦时,问题会变得更加复杂。如果需要将整个图像投影到地面,则通常采用相反的方式,因为这更容易进行插值并且可以并行完成。

我并不完全知道“虚拟”图像的含义,因为它们也是由投影创建的,因此存在一些可以使用的理论图像参数。