Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw lines in .ply files using Meshlab?

For example, I want to choose two points from all the point clouds, and draw a line between them. I'm using Meshlab to deal with .ply files but I don't know how to accomplish this. Can I do this using Meshlab or other ways?

like image 300
Yizhi Avatar asked Nov 18 '17 11:11

Yizhi


People also ask

How do I open PLY files in MeshLab?

OPENING POINT CLOUDS IN MESHLAB Point clouds can be open by double-clicking in a PLY file (if you associate this file format to MeshLab.

What files can MeshLab open?

The system supports input/output in the following formats: PLY, STL, OFF, OBJ, 3DS, VRML 2.0, X3D and COLLADA.


1 Answers

There is a way to add lines to .ply files. The most habitual elements found in .ply files are vertex and face, but the .ply file format also allows the definition of segments using the edge which are only partially supported by Meshlab.

This is a minimal example of a .ply file with two vertex and one edge element

ply
format ascii 1.0
comment object: A single line
element vertex 2
property float x
property float y
property float z
element edge 1                        
property int vertex1                  
property int vertex2                  
end_header
0 0 0 
0 0 1 
0 1

And this is a more complex example, with color per vertex and 4 lines in the corners of a cube.

ply
format ascii 1.0
comment object: 4 edges with color per vertex
element vertex 8
property float x
property float y
property float z
property uchar red                   
property uchar green
property uchar blue
element edge 4
property int vertex1                  
property int vertex2                  
end_header

0 0 0 255 0 0 
0 0 1 255 0 0
0 1 1 255 0 0
0 1 0 255 0 0
1 0 0 0 0 255
1 0 1 0 0 255
1 1 1 0 0 255
1 1 0 0 0 255

0 4 
1 5 
2 6 
3 7 

This is how previous example is rastered by meshlab

Output of sample 2

As I said, meshlab supports edge element just partially, so it has some problems:

  • Meshlab will load .ply files with edge elements, but will not save then to ply file format. It will only export vertex and faces to file.
  • Meshlab has problems representing files with both edge and face elements. It will only correctly plot them if edges are in a separate layer from faces (as show in image below). So, if you need to plot a .ply file with both faces and lines, you will have to:

    1. Duplicate the current layer.
    2. Select all faces from new layer and remove them (Del key), so the edge elements come visible on that layer. The face elements are still visible in the original layer.

Edges and faces are show only in separate layers

like image 66
Rockcat Avatar answered Sep 28 '22 09:09

Rockcat