Meshlab Tutorial
Meshlab Tutorial
Here we see a point cloud in PLY format with binary encoding edited with Notepad++. Binary encoding enables small file sizes but their content cant be edited manually. In both cases the header of the file is readable. We see how many vertexes, the order for which coordinates are presented, and, in this case, there are no faces.
The point cloud that correspond to this picture also presents normals for each point (we may say that there is an implicit surface), color (in RGB space), and a quality parameter (last column). Again, there are no vertexes.
NAVIGATION IN MeshLAB
1. Left mouse button + drag: rotate around trackball center 2. Mouse wheel: move forward or backward 3. Center mouse button + drag: pan 4. Shift + mouse wheel: change camera field of view 5. Double click on specific point: places that point at the trackball center 6. Control + mouse wheel: moves near clipping plan 7. Control + Shift + mouse wheel: moves far clipping plan 8. Alt + Enter: enter full screen mode 9. Control + Shift + left mouse button + drag: changes light direction (this only takes effect if there are normals)
10
11
Points are selected with a fence. Selected points turn on red. Points can be added to a previous selection by pressing CTRL whilst selecting. Points can be removed from a previous selection by pressing SHIFT whilst selecting. To delete selected points press CTRL+DEL or click on the respective icon (right).
Explore the menu FILTERS/SELECTION to see other selection methods. After deleting, if you want to keep the result you must save. Otherwise the deletion is not updated. If you want to recover from a previous (unsaved) state you can click the RELOAD icon.
12
13
The number of neighbors is the number of points that are used to estimate a tangent plan, at each point of the set.
14
The normal at a particular point is obviously perpendicular to the defined tangent plan for that point. The normal is stored as the components of an unitary vector with the direction determined. Disambiguation can be obtained by defining a particular point towards which the normals should flip to. After the operation is complete, dont forget to save the point cloud and to select the NORMAL option.
15
The figure bellow shows the first possible effect of having normals associated to the points. This enables light inclination to be used to enhance the visualization in MeshLab.
16
17
With this filter the user can define the absolute number of samples, or can define an average spacing between points (explicit radius). The option Base Mesh Subsampling should be selected. And the point cloud to be filtered should be chosen. At the end dont forget to save the new sample that was created as a new layer.
18
19
SCALING
Scale can be uniform or different for each axis. The center of scale can also be defined by the user as the origin, the barycenter (mass center of the point cloud) or a custom point freely defined. We can choose to apply the transformation to all layers. An important option is FREEZE MATRIX. What does this mean? If we select freeze matrix, the point cloud is actually scaled. This means that after saving, point coordinates are multiplied by the scale factor. But if we dont select freeze matrix, scale is only stored as a transformation matrix in the project file, but the point cloud file remains unchanged. Notice that although the visual effect is the same, the approach is quite different.
20
MOVING
Moving works more or less as the scale option.
ROTATION
The previous considerations are also valid for rotation. The axis of rotation can be defined by the user as shown above.
21
ROTATION
The center of rotation can also be defined by the user. The axis is defined as a vector direction (custom axis) applied to a custom point (custom center), with a particular a angle.
22
ROTATION
Notice that if you dont freeze the matrix, then the rotation is stored as a matrix (down right) in the project file and point coordinates remain unchanged. Otherwise, point coordinates are changed according to the applied rotation.
23
COMBINING TRANSFORMATIONS
In the image we see a transformation matrix combining a rotation and a translation. The last column of the matrix corresponds to the translation and the 3x3 sub matrix formed by the first three lines and columns corresponds to the rotation.
24
25
For instance, when we survey a place or a building with Laser Scanning, we get several point clouds of the same object taken from different view points and showing different features of that object. If these point clouds are leveled (if the scanning system as an inclination sensor), then one of them can be set as reference. Otherwise additional control data is needed (eg. Topographic survey). To reconstruct the overall 3D model, point clouds have to be aligned (oriented). To align a point cloud means to change the point cloud position. This new position is defined as transformation matrix (rotation + translation) stored in the project file. As it was stated before, when we save a MeshLab project, a position matrix is assigned to each point cloud file. By default, an identity matrix is assigned to all point clouds as they are opened. The user chooses the coordinate system of a particular point cloud as the reference coordinate system. That is, that point cloud is set as reference (position unchanged; defined as the identity matrix) and the others should move (position changes; defined by a transformation matrix).
26
Open the point clouds you want to orient and save a project. Remember that you can save a project as MLP or ALN.
27
In this case we have 3 point clouds with normals, and we saved the project with the name ALIGN.ALN. Let us look at the project file with Notepad++. As it can be seen, all point clouds have an identity matrix assigned.
28
To start the alignment process, click on the respective icon. It will launch the align dialog as it is shown.
29
The first thing to do is to choose which point cloud is to be set as reference. This is done by selecting a point cloud and clicking on GLUE HERE MESH. With this, an asterisk appears next to the point cloud name.
30
Then choose another point cloud and start by clicking on POINT BASED GLUEING. The following window appears. In one side you have the reference point cloud. On the other side you have the moving point cloud. At this stage, the idea is to roughly align both point clouds by manually defining homologous points (4 points are recommended).
31
Points are picked by double clicking with the left mouse button. They can be all selected in one point cloud and then all selected in the other point cloud (by the same order), or we can select one point at each time on both point clouds. To remove a point do CTRL + double click with left mouse button. After the points are picked, click OK. You can change the view point whilst selecting the points.
32
At this moment you can see that both point clouds are roughly aligned. And another asterisk can be found next to the aligned point cloud. We repeat the process for the remaining point cloud. Notice that both aligned point clouds are now set as reference for last point cloud.
33
After the initial alignment is done we will proceed to the final optimization by running the ICP (Iterative Closest Point). Pay attention to the DEFAULT ICP PARAMETERS. They are set in absolute units. So it is important to have an idea of the units you are using. Terrestrial Laser Scanning point clouds are usually in meters. The sample number means the number of homologous points that the software will try to find and use for the optimization. The minimal starting distance means the radius that will be used to find the homologous points in one point cloud starting with a set of points in the other point cloud. The target distance is an average alignment error value that the software will try to obtain from the process. With terrestrial laser scanning point clouds, this value should be small (0.005m at least). The Max Iteration Num is the maximum number of iterations that the software will perform.
34
The Rigid matching option should be selected if we are aligning point clouds that have the same scale. If we dont select this option, a scale factor will be introduced in the final transformation matrix.
35
After clicking PROCESS, the ICP algorithm is launched and the results are shown in a log window.
36
Let us save the project and take a look at the ALN file. As we can see, all point clouds now have a position matrix (often referred as POSE) that is different from the identity matrix. This means that all point clouds move during the orientation process (left). If we need to assign the identity matrix to a particular point cloud, and want to keep the internal coherence of the model, we can launch the ALIGN tool, glue all the aligned point clouds an then choose the point cloud that we want to SET AS BASE MESH (matrices shown on right; notice the presence of the identity matrix).
37
38
39
MESH CREATION
There are several FILTERS for mesh creation in MeshLab. A very used one is SURFACE RECONSTRUCTION: POISSON. Notice that points need to have normals assigned.
40
Please pay attention to the default parameters. One of the most important parameters is OCTREE DEPTH (6 by default). The hardware requirements are not proportional to the increment of that value. Beware! Nevertheless this parameter has effect on the quality of the reconstruction.
41
This is an image of a mesh reconstruction using the referred filter. As you can see, spurious triangles are created. They have to be deleted. We will back on this topic later.
42
43
In the VERTEX ATTRIBUTE TRANSFER dialog choose VERTEX COLOR. Also choose the SOURCE MESH (from which color will be transferred) and the TARGET MESH (mesh that will receive color).
44
MESH EDITING
As we said before, there are some spurious triangles that were created and have to be deleted. One efficient way to select the major part of those triangles is by edge length (see SELECTION filter).
45
After the triangles are deleted you have a preliminary mesh that can be further edited. So, please explore the other tools on MeshLab!
ENJOY!!!
46