hexygen / structure-aware-correspondence

Code for the paper: Robust Structure-based Shape Correspondence, Yanir Kleiman and Maks Ovsjanikov, CGF 2018
10 stars 8 forks source link

How to change the input data from triangular meshes to point cloud??? #2

Open shtanf opened 6 years ago

shtanf commented 6 years ago

Hello,I am very glad to meet your work and I really admire you.But now I have a question how to hange the input data from triangular meshes to point cloud??? What you write is that it is very easy .But I have tried to uncomment some codes like the following picture but it is still fail.Can you teach me detailed ?? Maybe if you are convenient, can you send me the complete code which input data is point cloud? Another question is that if the input data is point data ,its format is still 'off'??? image My email is 674834458@qq.com .Pray for your reply.Thank you very much.

hexygen commented 6 years ago

Hi, thanks for your interest in this work! The code in the example reads point clouds from the OFF files in a folder. It should run on the standard sets of shapes that were used as benchmark.

If you want to run it on your own shapes / point clouds, you will need to create an OFF file that represents the point cloud. The OFF can contain triangles (which will be ignored if pcd=1) or can be a list of vertices with zero triangles, but still in a valid OFF format. That is, first line should be something like "OFF", second line contains number of vertices, number of triangles (can be 0) and number of edges (can be 0), followed by a line for each vertex.

I hope that helps. Let me know if you have more questions. Yanir

hexygen commented 6 years ago

One more thing, make sure that you have all the prerequisites libraries and that you can run the example as is on the provided shapes before testing on different shapes.

shtanf commented 6 years ago

wow~~Thank you very much .I hava run it successful using OFF( surface reconstruction model from point cloud model). I think I understand what you mean. ,, .I input the surface reconstruction models which are generated from the point cloud,and just make the pcd=1,,it is successful,Ijust tried. But when I input the OFF file which is directly generated by the point cloud like the folling picture image

and the error is the following picture. image

I don't know why ? I am think if my OFF which is directly generated form the point clous is right~~~~ Can you help me ~~

hexygen commented 6 years ago

Sorry - I looked at the code again and realised I forgot something before: When you set it to pcd it samples the shape along the faces (not the vertices) to get the desired number of vertices from a uniform distribution. So that will only work with actual polygonal meshes as input.

To make it work for predefined point clouds such as the OFF file you have, you need to make a small change in ShapePairMapper.m. The only difference is you need to remove the resampling part. I would add a parameter "resample" to the function and change the following lines: Line 36: if (S1_opts.pcd) -> if (S1_opts.pcd && resample) Line 69: if (S2_opts.pcd) -> if (S2_opts.pcd && resample)

The rest should not be changed, and then if you run it with resample=0 it should work with the point cloud as is. I think this should work but obviously haven't tested it :)