# [vtkusers] Building a colored texture by interpolating a set of colored points.

Jean-Max Redonnet jmax.red at gmail.com
Mon Dec 11 08:32:34 EST 2017

```Hi, I'm still quite new to vtk, and I would like a pro advice.

I have a set of pixels, each one given with its full rgb color information.
I would like to build a full image by interpolating color of pixels between
the given points. First, I would like to know if there is a magic wand to
do that. I searched it for days but maybe I missed something.

If the job need to be done by hand, I plan to do this:
- first I split my image using a Delaunay algorithm.
- then, each pixels (except the given ones) belongs to a single triangle.
Thus I can calculate the scalar factors using a barycenter formula.

For example, let be a triangle defined by three pixels A, B and C. Let be P
a pixel inside this triangle. The following vectorial relations can be
written: PA = a.u, PB = b.v and PC = c.w, where u,v and w are unit vector
along (PA), (PB) and (PC) respectively. In this context I plan to use
scalar factors a, b and c to interpolate A,B and C pixels colors values.
The color of pixel P being then set to these interpolated values.

Is it the right way to do ? Do you know a better way to do this ?

Giving you a larger sight may help you to help me. Actually I want to
interpolate a vector field from a given set of vectors. The idea is to do
something like normal maps used in computer graphics. Mapping the 3D
vectors position to a 2D space is not a problem since their starting point
belongs to a parametric surface, therefore the 2D parametric space of the
surface can be used. Then the (u,v) space can easily be mapped to an image
pixels space while the coordinates of my vectors can meanwhile be mapped to
a rgb color space.

Using an image to build and store my vector field interpolation is
convenient but I would like to set up all this in the most efficient manner.

According to you, what is the better way to do this ?

Thanks for any help.

jMax
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171211/f206ce92/attachment.html>
```