How to get color of an Image

Hello everyone,

I am trying to create a colored mesh based on a png image. I see that I can use the GetProperty() function in vtkProperty class but how can I access this to get the colors pixel by pixel, to insert it into my point data? Thanks.

There are two ways to color a mesh with an image.

One method is to use vtkProbeFilter, where the mesh is the Input and the image is the Source. The output will be a colored mesh, if the data coordinates are set correctly.

Another method is to use vtkTexture, if your mesh is a vtkPolyData (the vtkActor has a SetTexture method). This requires a poly data with texture coords, which can be assigned to the poly data with e.g. vtkTextureMapToPlane.