PCL Developers blog

All blog posts for Khai Tran

Finished and back to school
Saturday, August 13, 2011
../../_images/gsoc8.png

As Zoltan suggested, I have implemented extra step to remove the triangles in the overlapping region given by 2 meshes. The first version proposed by Zoltan is that we will go over the triangles in the first mesh and check if the its center has a nearest neighbor in the other cloud that is closer than the maximum distance from the center to one of the vertices and this nearest neighbor has to be in at least one triangle of other mesh, we will delete this triangle of the first mesh. To search for nearest neighbor, I have used k-nearest neighbor search with k =1.

To delete triangle from a mesh, we set a vertex to FREE if this triangle was only a triangle which the vertex was in. After that update SFN and FFN of other two vertices. If this was not the only triangle the vertex was in, it has to be set to FRINGE. Updating the sfn and ffn here is a bit more tricky. Check if on of the other triangles this vertex is in also has as another vertex one of the other points. Following Zoltan suggested I have implemented three more functions to complete this task.

And here are results:

The 1st mesh:

../../_images/mesh1.png

The 2st mesh which overlapps 1st mesh:

../../_images/mesh2-over_mesh1.png

The result after removing overlapped triangles and merging 2 meshes:

../../_images/mergedMesh.png
Combine mesh update and texture mapping
Thursday, August 04, 2011
../../_images/gsoc8.png

A small update on combining mesh update and texture mapping. I just created the function that will update the texture mesh when a new point cloud is added to the mesh. Now I will move to the final part of the project.

../../_images/tex_mesh_update00.png
Update the mesh without recreating the entire mesh
Wednesday, August 03, 2011
../../_images/gsoc8.png

Such a long time I haven’t update my progress since finishing my 1st part. I am working on part II of my roadmap. I just finished implementing the surface mesh update when a new point cloud is added to an existing surface mesh, without recreating the entire mesh. Basically, the implementation of greedy triangular algorithms is based on the algorithm in paper “A fast and efficient projection-based approach for surface reconstruction”. The terminology is that we will assign the data point at any given state of the algorithm as FREE, FRINGE, BOUNDARY and COMPLETED points. To update the mesh without recreating the entire mesh for a updated cloud, as Zoltan suggested, we assign the new points with FREE state, change the states of BOUNDARY points to FRINGE points and enter the triangulating loop which only keep the current mesh and updates new trianges.

To test this function, I have splited bunny point cloud dataset to 2 point clouds.

This figure show 2 meshes after using greedy triangular algorithm on 2 separated datasets.

../../_images/bun_2meshes.png

And here is result of updated mesh when one point clouds is added to existing mesh.

../../_images/bun_updated.png

And here is result of the original mesh before splited.

../../_images/bunny_original.png
Finish part I of my roadmap
Tuesday, July 12, 2011
../../_images/gsoc8.png

Finally, I have finished part I in my roadmap:

  • Starting from the existing methods (greedy surface triangulation algorithm) to obtain triangle mesh, I have designed and implemented the API for texture mapping onto a mesh.
  • I have finished implementing paper on texture synthesis from the paper “Texture Synthesis on Subdivision Surfaces”.
  • I have finished designing and implementing texture mapping and blending for two overlapping textures onto a surface mesh.

Here are some snapshots of mapping 2 overlap textures to a mesh:

../../_images/july1201.png ../../_images/july1200.png

And here are examples of texture atlas for further processing.

../../_images/tex_00.jpg ../../_images/tex_10.jpg
Generating texture atlas for 2 overlapping textures onto a surface mesh
Wednesday, July 06, 2011
../../_images/gsoc8.png

I am working on generating texture atlas for 2 overlapping textures onto a surface mesh. This part basically pack all individual textures in the atlases. I am using OpenCV library to line all textures up horizontally. As I know, as common rending function requires that the width and the height of atlas should be less than 2048. So we may need multiple atlases in order to store all the textures. My implementation is working fine except few unexpected texture mappings still need to be correct when I map the mesh with generated atlases. I will plot something after I fix the errors.

2 overlapping textures onto a surface mesh
Monday, June 27, 2011
../../_images/gsoc8.png

Recently, I have generated an example of 2 overlapping textures onto a surface mesh. The texture mapping algorithm base on algorithm in “Texture Synthesis on Subdivision Surfaces” but I haven’t implement the blending part yet.

Here are some snapshots:

../../_images/june_2700.png ../../_images/june_27_201.png
2st Texture mapping - Texture synthesis.
Friday, June 24, 2011
../../_images/gsoc8.png

For a long week, I haven’t updated my progress. Here is my update for this week:

  • Implemented texture synthesis on the paper “Texture Synthesis on Subdivision Surfaces”.
  • I have completed the texture parameterization part and the next step will be blending texture and generating texture atlas.

Here is my first result after texture parameterization step:

../../_images/snapshot01.png ../../_images/snapshot02.png

The result still have few unexpected mapping and it is not smooth because:

  • I haven’t found the optimal solution for selecting the edge which determines the angle (alpha) with vector field (face orientation) calculated on each face.
  • Texture is not blended yet. I have started working on it.
1st Texture mapping.
Monday, June 13, 2011
../../_images/gsoc8.png

This week I have done:

  • Created OBJ_IO class to save a 3D model with the texture as Wavefront (.OBJ) format.
  • Designed texture data structure for mapping texture onto the mesh. (Just 1 texture material for a mesh right now)
  • Implement a basic texture mapping which is similar to OpenGL placing texture maps onto polygons. The texture coordinates are stored per-vertex. And texture is mapped in the Y plane.

Here is my result after mapping texture onto a bunny:

../../_images/bunny06.png ../../_images/bunny02.png

The result is not perfect because some reasons:

  • The mesh is not smoothed.
  • The texture is simply mapped in the Y plane. Texture coordinates are computed based on X and Z.

And here is my update code

Next steps:

  • Implement another texture mapping to improve the result.
  • Work on overlapping textures onto a mesh.
Working on 3D OBJ file format
Tuesday, June 07, 2011
../../_images/gsoc8.png

As I know, VTK file format is not much useful to represent 3D model with texture. So I decided to write the code to save a polygon mesh (further will be mesh with texture) as OBJ file which can better represent 3D model with texture compared with VTK format. Here is the link for OBJ file format: http://en.wikipedia.org/wiki/Wavefront_.obj_file.

Here is my code

Khai Tran’s status update on Week 1
Friday, May 27, 2011
../../_images/gsoc8.png

This week I have done:

  • Installed and built PCL library and its dependencies
  • Completed build and test some tutorials using PCL

In progress:

  • Reading references on texture blending
  • Working on the surface reconstruction API for texture mapping onto a mesh
Khai Tran’s first status update
Monday, May 23, 2011
../../_images/gsoc8.png

This is the first update to the developer blogs.

Here’s a code snippet sample:

// Hello world
for (int i = 0; i < 10; ++i)
{
  cout << "Hello World" << endl;
}

And here’s an equation:

\sum^{n}_{i=1}\Phi_{i}