PolygonMesh visualization with colour interpolation

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

PolygonMesh visualization with colour interpolation

Seldon
Hi,

is there a possibility to display the triangles of a Polygon mesh with interpolated colour (of the 3 vertices)? The problem is when I display the mesh object int the PCL visualizer, the edges of its triangles are visible.

I am working with a fixed point set which contains a huge amount of points, the triangles are small but the edges are still visible which is very disturbing. I plan to use the generated object as a source of a learning algorithm where it is essential to have a realistic input.

I was trying to figure out how to instruct PCL to display triangles of the PolygonMesh with colours interpolated from the 3 vertices of the triangles but couldn't make my way. Maybe I am approaching the problem from the wrong direction, I am quite new to PCL. Please give me some suggestion. Thank you very much.

Seldon
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Seldon
Hi again,

any updates on this post? To me it seems more and more that there is no solution on this issue. However, I still hope...

Please let me know if need more information.

Thank you very much!

Seldon
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Radu B. Rusu
Administrator
Seldon,

Please create an issue and post a minimal code snippet on http://dev.pointclouds.org.

Cheers,
Radu.
--
http://openperception.org

On 09/06/2012 07:41 AM, Seldon wrote:

> Hi again,
>
> any updates on this post? To me it seems more and more that there is no
> solution on this issue. However, I still hope...
>
> Please let me know if need more information.
>
> Thank you very much!
>
> Seldon
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PolygonMesh-visualization-with-colour-interpolation-tp4021989p4022036.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

daviddoria
On 09/06/2012 07:41 AM, Seldon wrote:
Hi again,

any updates on this post? To me it seems more and more that there is no
solution on this issue. However, I still hope...

Please let me know if need more information.

Thank you very much!

Seldon

Also, please include a screenshot of what you are seeing. What I believe you are after is this:

(I'm not sure how to do it through the PCL visualizer, sorry).

DavidĀ 

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Seldon
Hi Radu and David,

thank you for your answers! Really appreciated.

@Radu: I will create an Issue, I have already made my registration.

@David: Yes, you are right. I am searching for this kind of interpolation. I would like to reach some functionality what I have used under Matalb with Triangular mesh plot: http://www.mathworks.de/help/techdoc/ref/trimesh.html. Here one can set the 'FaceColor' property of the trimesh to 'interp' which makes the needed effect.

I have to look into VTK since I don't know it yet but the example code is quite promising. Maybe it is a good workaround for me.

Just one short question. I tried to compile the example code, but got a strange error:

vtkSmartPointer<vtkRenderer> renderer =  vtkSmartPointer<vtkRenderer>::New(); <- THIS line causes error

main.cpp(104): error C2923: 'vtkSmartPointer' : 'vtkRenderer' is not a valid template type argument for parameter 'T'
1>          main.cpp(26) : see declaration of 'vtkRenderer'

I am using VTK under Win7 x64 with VS2010. Do you know by chance what can be the reason? Other vtkSmartPointer<XXX> declarations don't cause any problem. Only vtkRenderer.

Thanks!

Seldon
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Radu B. Rusu
Administrator
Seldon,

PCL uses VTK under the hood so everything that you see in the VTK examples can be wrapped within our API.

Cheers,
Radu.
--
http://openperception.org

On 09/06/2012 01:52 PM, Seldon wrote:

> Hi Radu and David,
>
> thank you for your answers! Really appreciated.
>
> @Radu: I will create an Issue, I have already made my registration.
>
> @David: Yes, you are right. I am searching for this kind of interpolation. I
> would like to reach some functionality what I have used under Matalb with
> Triangular mesh plot: http://www.mathworks.de/help/techdoc/ref/trimesh.html.
> Here one can set the 'FaceColor' property of the trimesh to 'interp' which
> makes the needed effect.
>
> I have to look into VTK since I don't know it yet but the example code is
> quite promising. Maybe it is a good workaround for me.
>
> Just one short question. I tried to compile the example code, but got a
> strange error:
>
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New(); <- THIS line causes error
>
> main.cpp(104): error C2923: 'vtkSmartPointer' : 'vtkRenderer' is not a valid
> template type argument for parameter 'T'
> 1>          main.cpp(26) : see declaration of 'vtkRenderer'
>
> I am using VTK under Win7 x64 with VS2010. Do you know by chance what can be
> the reason? Other vtkSmartPointer<XXX> declarations don't cause any problem.
> Only vtkRenderer.
>
> Thanks!
>
> Seldon
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PolygonMesh-visualization-with-colour-interpolation-tp4021989p4022062.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

daviddoria
In reply to this post by Seldon
On Thu, Sep 6, 2012 at 4:52 PM, Seldon <[hidden email]> wrote:

>
> Hi Radu and David,
>
> thank you for your answers! Really appreciated.
>
> @Radu: I will create an Issue, I have already made my registration.
>
> @David: Yes, you are right. I am searching for this kind of interpolation. I
> would like to reach some functionality what I have used under Matalb with
> Triangular mesh plot: http://www.mathworks.de/help/techdoc/ref/trimesh.html.
> Here one can set the 'FaceColor' property of the trimesh to 'interp' which
> makes the needed effect.
>
> I have to look into VTK since I don't know it yet but the example code is
> quite promising. Maybe it is a good workaround for me.
>
> Just one short question. I tried to compile the example code, but got a
> strange error:
>
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New(); <- THIS line causes error
>
> main.cpp(104): error C2923: 'vtkSmartPointer' : 'vtkRenderer' is not a valid
> template type argument for parameter 'T'
> 1>          main.cpp(26) : see declaration of 'vtkRenderer'
>
> I am using VTK under Win7 x64 with VS2010. Do you know by chance what can be
> the reason? Other vtkSmartPointer<XXX> declarations don't cause any problem.
> Only vtkRenderer.

There is definitely no problem with a smart pointer to a vtkRenderer,
I have used it thousands of times. Try to compile this to convince
yourself it works:

#include <vtkSmartPointer.h>
#include <vtkRenderer.h>

int main(int , char *[])
{
  vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
  return EXIT_SUCCESS;
}

(you can use the CMakeLists.txt provided in the example). Maybe you
were missing the include (though that is not the same error that gcc
gives me when I don't include the header)?

You may also be interested in this:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Wireframe

for the "wireframe" look you showed.

David
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Seldon
Hi Guys,

sorry, I had to be busy with other things for a few days... but now I am back. :) So first of all thank you for the great replies!

Lately I figured out my problem was quite different from what I thought before. I rewrote my code to use pure VTK functions and found out that I was simply missing the generation of normals for my polydata object. Since that is added to the pipeline and phong lightning is switch on, things looks much better.

Regards,
Seldon
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Thomas Whelan
This works for me with PCL 1.6:

pcl::visualization::PCLVisualizer * mesh_viewer_ = new pcl::visualization::PCLVisualizer("Mesh View");

mesh_viewer_->addPolygonMesh(triangles, "mesh");

mesh_viewer_->getRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActors()->GetLastActor()->GetProperty()->SetInterpolationToPhong();

Tom


On Thu, Sep 20, 2012 at 10:15 AM, Seldon <[hidden email]> wrote:
Hi Guys,

sorry, I had to be busy with other things for a few days... but now I am
back. :) So first of all thank you for the great replies!

Lately I figured out my problem was quite different from what I thought
before. I rewrote my code to use pure VTK functions and found out that I was
simply missing the generation of normals for my polydata object. Since that
is added to the pipeline and phong lightning is switch on, things looks much
better.

Regards,
Seldon



--
View this message in context: http://www.pcl-users.org/PolygonMesh-visualization-with-colour-interpolation-tp4021989p4022417.html
Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Seldon
Hi Thomas,

thank you for the suggestion.

Regards,
Seldon
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Elizabeth
Hello,
Are there any news related to that issue ?
I need the same functionality.
I've tried to use the command :
viewer->getRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActors()->GetLastActor()->GetProperty()->SetInterpolationToPhong();
but whenever I use it, the code crashes.
I'm using the latest PCL build from trunk.

Can anyone advise me please?
Elizabeth
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Elizabeth
Hi,
Sorry for the confusion.
I see that the code works when I don't use view ports.
When I try to display the mesh in a specific view port, the code crashes.
How can I fix that ?

Elizabeth
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

aichim
Administrator
Elizabeth,

Please open an issue on the tracker about this. Unfortunately, I am a bit swamped with my own work in this period and I will not be able to fix this problem very soon. Would be great if anyone else could step in.

Cheers,
Alex
---
http://www.openperception.org



On Feb 18, 2013, at 6:35 AM, Elizabeth <[hidden email]> wrote:

> Hi,
> Sorry for the confusion.
> I see that the code works when I don't use view ports.
> When I try to display the mesh in a specific view port, the code crashes.
> How can I fix that ?
>
> Elizabeth
>
>
>
> --
> View this message in context: http://www.pcl-users.org/PolygonMesh-visualization-with-colour-interpolation-tp4021989p4026181.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Elizabeth
I don't remember how to open an issue.
Could you give me the directions please ?

Thank you,
Elizabeth
Reply | Threaded
Open this post in threaded view
|

Re: PolygonMesh visualization with colour interpolation

Jochen Sprickerhof
Administrator
* Elizabeth <[hidden email]> [2013-02-19 01:40]:
> I don't remember how to open an issue.
> Could you give me the directions please ?

http://dev.pointclouds.org/projects/pcl/issues/new (you need to be
logged in).

Cheers Jochen
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users