# Creating mesh from point cloud

Hi all,

I’ve got a project which involves 3D reconstruction of point clouds from a 3D scanner. Being relatively new to computer vision i am in the dark. I need to implement this 3D reconstruction in c++. I plotted the coordiated i recieved from the 3D scanner and i got a point cloud, a picture of which is attached.

First of all, I don’t see how this is related to OpenGL® at all, and I have no knowledege of the subject, here are some suggestions how I would approach the task:

b) Here’s an intuitive aproach I though up on the train ride home (i.e. I don’t guarantee for this to actually work):
[ul]
[li]Compute the AABB from the point samples [/li][li]Generate an octree from the point samples[/li][LIST]
[li]if there are no points left, stop octree subdivision [/li][li]if the octree node edge length reaches a certain threshold, stop octree subdvision and average the remaining points inside the node (that way you could some how controll the resolution of the mesh) [/li][/ul]

[li]At this point, you have an octree where each leave contains either zero points or exactely one point [/li][li] For each node:[/li][ul]
[li] If it is a leave node and it contains a point, label it filled, otherwise label it empty [/li][li] If it is a non leave node and contains at least one filled child, label it filled, otherwise label it empty [/li][/ul]

[li] For each non empty leave node:[/li][ul]
[li] Generate a triangle fan from the point sample as first vertex and all surounding non-empty leave nodes [/li][li] Store node pointers instead of vertex positions as integers are easier to compare for equality than float touples [/li][li] Append every triangle of the fan individually to a triangle list [/li][/ul]

[li] For each triangle in the list[/li][ul]
[li] For each vertex[/li][LIST]
[li] If the vertex has not been encountered before, append it’s coordinates to the final vertex buffer and append the index of the top of the vertex list to the final index buffer [/li][li] If a vertex has been encountered before, only append the index of the existing vetex position to the index buffer [/li][/ul]

[/LIST]

[/LIST]