Message Boards Message Boards

Import .ply file gives different results for Mma 10.1 and 10.2.

When importing a .ply file with vertices and polygons that together create a shape/mesh, the order of the points in the resulting list of vertices is totally different in 10.2 w.r.t 10.1, both on Mac OS X 10.10.5. The order of the the vertices in 10.1 is exactly the same as in the source .ply file. See attached figure: left is source file in text editor, middle is list in 10.1, right is list in 10.2. In all the same point is selected.

Is this intended? Is this a bug? Is there something I can do about that, by using a legacy option in the Import function?

Attachments:
POSTED BY: Hans van Assen
4 Replies
Posted 8 years ago

Here's a workaround to import data from binary (big & little endian) and ascii ply files. Works on my samples. If you have suggested improvements, please let me know.

Attachments:
POSTED BY: Matt Reed
Posted 8 years ago

I just lost most of a day to this very problem and am stuck with trying to find a fix. Using Import[], Mathematica 10.2 reorders the vertices of both binary and ascii input files PLY format, whereas Mathematica 9 preserved the order in the file. This is enormously problematic for me, because like many people I work on these geometry files in other software as well. Maintaining the vertex order is critical to this workflow. I presume that the reordering was added to obtain some optimization in rendering or retrieval of the MeshRegion object, because a ply file saved from Mathematica does not appear to be reordered again on import. Can we get an element added to retrieve the original vertex order, or an option to prevent the reordering on import?

POSTED BY: Matt Reed

Yes, my Import line looks like this:

reducedMeshVertices = Import[fileReducedMesh, "VertexData"];

The meshes look the same both in version 10.1 and 10.2. But I use Mathematica to calculate with the meshes, not just to visualize them. I am performing landmark-based rigid registration as a first step in my algorithm. It is crucial that the correspondence between the landmarks in two meshes remains intact and is consistent.

Is there a way that I can import the .ply file while I can count on the same order of the points in different versions, perhaps even the same order as in the source file? Consistency within one version seems to be present already.

As a side remark, I think it is a bit strange that importing a file does not produce the same order of points as in the source file, and not even between Mathematica versions.

POSTED BY: Hans van Assen

Does it result in the same MeshRegion object.

How are you importing the list of vertices? Are you using Import[..., "VertexData"] or looking at the resulting MeshRegion in someway?

Either of them don't seem to have any guarantee that they give the vertices in the order listed in the source file. So it's not a bug by itself.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract