Android Augmented reality Cameraview converts to screen coordinates

I am currently developing my own application for augmented reality. I'm trying to write my own AR Engine, since all the frameworks I've seen so far can only be used with GPS data. It will be used indoors, I get location data from another system.

What I still have:

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); 

I know its ugly code, but I'm just trying to get the vector object to color correctly from my position (0,0,0) at the moment. Screen size is hardcoded in S and B matrices (800x480).

The result should be saved in "converted" and must be in a form, such as transform = {x, y, z, w} For mathematics, I used this link: http://www.inf.fu-berlin.de/lehre/ WS06 / 19605_Computergrafik / doku / rossbach_siewert / camera.html

Sometimes my graphics are drawn, but she jumps around and is not in the correct position. I started casting using SensorManager.getOrientation and they look normal and stable.

So, I think I'm doing something with a math error, but I could not find the best math sources for converting my data. Can someone help me please? thanks in advance

Martina

+4
source share

All Articles