Android增强现实摄像机转换为屏幕坐标

Android增强现实摄像机转换为屏幕坐标,android,augmented-reality,perspectivecamera,Android,Augmented Reality,Perspectivecamera,我目前正在开发自己的增强现实应用程序。我正在尝试编写我自己的AR引擎,因为到目前为止我所看到的所有框架都只适用于GPS数据。 它将在室内使用,我从另一个系统获取我的位置数据 到目前为止,我得到的是: float[] vector = { 2, 2, 1, 0 }; float transformed[] = new float[4]; float[] R = new float[16]; float[] I = new float[

我目前正在开发自己的增强现实应用程序。我正在尝试编写我自己的AR引擎,因为到目前为止我所看到的所有框架都只适用于GPS数据。 它将在室内使用,我从另一个系统获取我的位置数据

到目前为止,我得到的是:

        float[] vector = { 2, 2, 1, 0 };
        float transformed[] = new float[4];
        float[] R = new float[16];
        float[] I = new float[16];
        float[] r = new float[16];
        float[] S = { 400f, 1, 1, 1, 1, -240f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
        float[] B = { 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 400f, 240f, 1, 1 };
        float[] temp1 = new float[16];
        float[] temp2 = new float[16];
        float[] frustumM  = {1.5f,0,0,0,0,-1.5f,0,0,0,0,1.16f,1,0,0,-3.24f,0};

        //Rotationmatrix to get transformation for device to world coordinates
        SensorManager.getRotationMatrix(R, I, accelerometerValues, geomagneticMatrix);
        SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, r);
        //invert to get transformation for world to camera
        Matrix.invertM(R, 0, r, 0);
        Matrix.multiplyMM(temp1, 0, frustumM, 0, R, 0);
        Matrix.multiplyMM(temp2, 0, S, 0, temp1, 0);
        Matrix.multiplyMM(temp1, 0, B, 0, temp2, 0);

        Matrix.multiplyMV(transformed, 0, temp1, 0, vector, 0);
我知道它的代码很难看,但我只是想让对象“向量”正确绘制,现在我的位置是(0,0,0)。 我的屏幕大小硬编码在矩阵S和B(800x480)中

结果应该存储在“transformed”中,并且应该是transformed={x,y,z,w}这样的形式 对于数学,我使用了以下链接:

有时我的图形会被绘制,但它会四处跳跃,而且位置不正确。我已经记录了SensorManager.getOrientation的运行情况,它们看起来正常且稳定

所以我认为我在数学上做了一些错误的事情,但是我找不到更好的数学来源来转换我的数据。谁能帮我一下吗? 提前谢谢

马丁