1

我已经建立了一个活动,该活动采用用于地图的自定义图像,然后知道左上角和右下角的 gps,我在地图顶部绘制了 gps。它工作得很好,但我想提高准确性。我知道它关闭了,因为当我记录设备位置并将其插入谷歌地图时,它实际上比我在自定义地图上表示的更准确。

所以....既然我有地图的左上角和右下角 gps 并将它们映射到相应的像素坐标,我如何才能使用 Helmert 变换准确地将设备 gps 绘制成像素。

编辑:

我目前正在使用它来将设备的 gps 绘制到屏幕上。

public double getCurrentPixelY(Location upperLeft, Location lowerRight, Location current) {
    double hypotenuse = upperLeft.distanceTo(current);
    double bearing = upperLeft.bearingTo(current);
    double currentDistanceY = Math.cos(bearing * Math.PI / OneEightyDeg) * hypotenuse;
    //                           "percentage to mark the position"
    double totalHypotenuse = upperLeft.distanceTo(lowerRight);
    double totalDistanceY = totalHypotenuse * Math.cos(upperLeft.bearingTo(lowerRight) * Math.PI / OneEightyDeg);
    double currentPixelY = currentDistanceY / totalDistanceY * ImageSizeH;

    return currentPixelY;
}

public double getCurrentPixelX(Location upperLeft, Location lowerRight, Location current) {
    double hypotenuse = upperLeft.distanceTo(current);
    double bearing = upperLeft.bearingTo(current);
    double currentDistanceX = Math.sin(bearing * Math.PI / OneEightyDeg) * hypotenuse;
    //                           "percentage to mark the position"
    double totalHypotenuse = upperLeft.distanceTo(lowerRight);
    double totalDistanceX = totalHypotenuse * Math.sin(upperLeft.bearingTo(lowerRight) * Math.PI / OneEightyDeg);
    double currentPixelX = currentDistanceX / totalDistanceX * ImageSizeW;

    return currentPixelX;
}

我知道我需要在某个地方进行调整,但是看着 helmert 转换,我不知道从哪里开始使用我现有的代码来实现它。

编辑:

在网上查看了更多内容后,我发现使用大圆公式可能会有所帮助。这是我正在实施的链接

http://introcs.cs.princeton.edu/java/12types/GreatCircle.java.html

4

1 回答 1

1

这是计算 helmert 系数的源代码:

http://helmparms3d.sourceforge.net/

也许有一个更简单的方法(还有一个所谓的小地图 2d helmert 变换,就像你的图片一样)

使用该代码可以获得 helmert 系数,这些系数是一个 3x3 矩阵。所以你需要能够将向量与矩阵相乘的代码。
3d 图形例程具有这样的矩阵乘法。

于 2013-03-20T00:19:36.467 回答