android mesh reconstruction out of a point cloud

75 Views Asked by At

I need to reconstruct a mesh from a point cloud for an Android application. This app creates a mesh from a large point cloud and then measures the distance between two randomly selected points on the mesh. I tried to reconstruct the mesh using OpenGL ES with the glDrawArrays() function, but the results were unsatisfactory. Therefore, I started looking for a library capable of handling this task, specifically surface reconstruction. Unfortunately, I couldn't find anything suitable as most computer vision libraries are developed for Python or C++, which are not directly compatible with Android. Do you have any advice for achieving this in my particular use case? Which library fulfill my requirements?

The images below were implemented with glDrawArray(GL_POINTS) for the point cloud, the other image with gLDrawArray(GL_TRIANGLES) for the mesh.

point cloud: enter image description here

mesh enter image description here

That's the part of code where I initialise and implement the mesh.

public void onDrawFrame(GL10 gl) {
            GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

            ...

            GLES20.glUseProgram(mProgram);

            maPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
            GLES20.glEnableVertexAttribArray(maPositionHandle);
            GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, vertexBuffer);

            int colorHandle = GLES20.glGetAttribLocation(mProgram, "vColorA");
            GLES20.glEnableVertexAttribArray(colorHandle);
            GLES20.glVertexAttribPointer(colorHandle, 3, GLES20.GL_FLOAT, false, 12, colorBuffer);

            
            GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mMVPMatrix, 0);
            GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertices.length);
            GLES20.glDisableVertexAttribArray(maPositionHandle);
            GLES20.glDisableVertexAttribArray(colorHandle);
            System.out.println("\n");
        }

@Override
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
            GLES20.glEnable(GLES20.GL_DEPTH_TEST);
            GLES20.glEnable(GLES20.GL_NICEST);
            GLES20.glDepthFunc(GLES20.GL_LESS);
            GLES20.glDepthMask(true);
            initShapes();
          
            ...
        }
0

There are 0 best solutions below