The PLY file is not working.

(Kim William) #1

Hi all.

I have a question about PLY file load.

I have two PLY files.
(A) PLY file: It made by 3D Scanner.
(B) PLY file: The sample PLY file from the link.
Link: http://graphics.im.ntu.edu.tw/~robin/courses/cg04/model/index.html

The B file work normally but A file is not working on the same code.

My code snippet is as below:

vtkSmartPointer pPLYReader =
vtkSmartPointer::New();
pPLYReader->SetFileName(“myPLY.ply”);
pPLYReader->Update();

vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInputConnection(pPLYReader->GetOutputPort());

vtkSmartPointer actor =
vtkSmartPointer::New();
actor->SetMapper(mapper);

vtkSmartPointer renderer =
vtkSmartPointer::New();
renderer->AddActor(actor);
renderer->SetBackground(.1, .2, .3);
renderer->ResetCamera();

//vtkSmartPointer m_vtkWindow;
m_vtkWindow->AddRenderer(renderer);
m_vtkWindow->Render();

I don’t know why A file is not working.

Unfortunately, I can’t upload the file.

Could you please advise me about loading the PLY file?

Thank you.

Have a good day :slight_smile:

How to change the color of the Point Cloud Data?
(Dan Lipsa) #2

Kim,
What version of VTK are you using? Can you try with master?

Thanks,

Dan

(Kim William) #3

Hi Dan Lipsa.

My VTK version is 8.2.0.

Thank you.

(Dan Lipsa) #4

Kim,

Can you try with VTK from the master branch

https://gitlab.kitware.com/vtk/vtk

We had a PLY fix going in that did not make it in 8.2

Thanks,

Dan

(Kim William) #5

Hi Dan.

I tried to load my PLY file with VTK from the master branch.

But the symptom is the same…

Do you think, does the code have no problem?

I want to check the code is okay.
If yes, I think the PLY file has a problem.

Thank you :slight_smile:

(Dan Lipsa) #6

What is the error you are seeing?

You can try loading that file in meshlab, to see if that program loads it.

If you can share your file privately, I can take a look at it. My email is my first name dot my last name at kitware.com

Thanks,

Dan

(Kim William) #7

I sent you my PLY file by email.

Thank you :slight_smile:

(Andras Lasso) #8

Note that you never need to reveal your email address if you use discourse. You can send private message by clicking on the user’s photo then on the “Message” button in the top-right corner.

(Dan Lipsa) #9

Hi Kim,

Thanks for sending me the file.

I took a look at it in ParaView. The problem with it is that it does not have any cells, so the default representation - surface shows nothing.

The Point Gaussian representation works.

For VTK, try

https://vtk.org/doc/nightly/html/classvtkPointGaussianMapper.html

instead of

vtkPolyDataMapper.

Dan

(Dan Lipsa) #10

Thanks Andras, I’ll keep this in mind.
I use discourse through email, so I have not seen the actual site that much.

Dan

(Kim William) #11

Hi Dan.

Thank you for your support!

Finally, I can be rendering my PLY file.

But why my PLY file is only used by vtkPointGaussianMapper?
(Why the data has not any cells?)

Thank you :slight_smile:

(Andras Lasso) #12

Raw data that surface scanners acquire is just a point cloud (no cells). Some surface scanners come with sophisticated surface reconstruction software (that can merge surfaces, filter outliers, map texture, etc.). If you don’t have access to such software then you may try the few basic surface reconstructor filters that are available in VTK (vtkSurfaceReconstructionFilter, PoissonExtractSurface, PowercrustExtractSurface).

(Bill Lorensen) #13

There are several examples that process points…Take a look at:
https://lorensen.github.io/VTKExamples/site/Cxx/#point-cloud-operations

Bill

(Kim William) #14

Thank you everyone so much!

It was very helpful for me!

Thank you :slight_smile: