[vtkusers] Two or more .jpg textures mapped to a Polydata

Wes Turner wes.turner at kitware.com
Mon Jul 30 10:14:21 EDT 2007


Godofredo,

To my knowledge, this is not completely supported in VTK and you will need
to write some additional code.  The basic idea is to write a filter that
generates a new output image large enough to hold your multiple textures.
Assume this output image is somewhere in physical space and walk over each
of its pixels seeing where each of your camera models (one per image you
want to map) map the output pixel in the input image.  Assign a value to the
output pixel based on some combination of pixels from each of the input
images that see it.  If your output image gets too big, you may need to
downsample it to get it to fit in texture memory.

HTH,

- Wes


On 7/30/07, Godofredo <godofredoiii at gmail.com> wrote:
>
>
> 1st of all, many thannks, I've been on holiday so I've just read your
> response.
>
> I think the best approach would be to combine the images and then map them
> all together to the 3D model. I'm making some tries with vtkJPEGReader and
> vtkImageAppend, and now I have some other questions:
>
> How do I change the relative spatial position of the images before
> appending
> them? The images are taken with different camera positions, so they have
> different centers in the projection plane.
> Is it posible to translate their center individually and then append them?
> If so, what happens if the images overlap in a certain region? Is it
> possible to set which image should be shown in that concrete region?
> Also I would like to apply the camera parameters such as distortion and
> focal length to the images. I have no idea of how to do this in vtk. Any
> help or advice will be greatly wellcomed.
>
> Thanks in advance.
>
>
>
> Wes Turner wrote:
> >
> > Godofredo,
> >
> > To my knowledge, there is no simple way to do what you want.
> >
> > 1 - For mapping a texture to part of an image, the easiest course is to
> > turn
> > mirroring off on the texture so that instead of replicating the image,
> the
> > texturer extends the boundary of the image to the rest of the
> plane.  Then
> > put a one pixel border around your texture jpegs that is the background
> > color you desire on the untextured regions of the part.  This one pixel
> > border will then be the only color replicated.  I don't remember the
> > specific calls, but some combination of calls to the actor and texturer
> > should handle the first question, while creating the boundary can be
> > managed
> > through the image pad filters.
> >
> > 2 - You are limited by one texture per actor.  To use multiple textures
> > with
> > an actor, you will need to either synthesize your multiple textures into
> > one, or divide your single actor into multiples.
> >
> > A first attempt at this is:
> >
> > Query Results from the ADS Database
> >
> >
> > Retrieved 1 abstracts, starting with number 1.  Total number selected:
> 1.
> >
> > @INPROCEEDINGS{2003AIPC..657..340T,
> >    author = {{Turner}, W. and {Drake}, T. and {Osterkamp}, M. and
> > {Kaiser}, D. and
> >       {Miller}, J. and {Tu}, P. and {Wilson}, C.},
> >     title = "{Using Computer Vision to Map Laser Ultrasound Onto CAD
> > Geometries}",
> > booktitle = {Review of Progress in Quantitative Nondestructive
> > Evaluation},
> >      year = 2003,
> >    series = {American Institute of Physics Conference Series},
> >    volume = 657,
> >    editor = {{Thompson}, D.~O. and {Chimenti}, D.~E.},
> >     month = mar,
> >     pages = {340-350},
> >       doi = {10.1063/1.1570156},
> >    adsurl = {http://adsabs.harvard.edu/abs/2003AIPC..657..340T},
> >   adsnote = {Provided by the Smithsonian/NASA Astrophysics Data System}
> > }
> >
> > - Wes
> >
> > On 7/20/07, Godofredo <godofredoiii at gmail.com> wrote:
> >>
> >>
> >> Hi to all. I have a triangulated 3D model and I would like to add
> >> textures
> >> to
> >> it from a set of jpg images. My 3D model is stored as a Polydata. I've
> >> reading and looking at some examples but I'm a bit lost. There are some
> >> points which I'm not able to figure out how to do:
> >>
> >> -In a simple example of mapping an image to a plane, how do I map the
> >> Image
> >> only to a certain region of the plane, and have no texture in the rest
> of
> >> the plane? Can this be done? I've tried this in a simple example with
> >> "vtkTextureMapToPlane" and "vtkTransformTextureCoords". The texture is
> >> mapped to the region I want but it is also displayed as a mosaic in the
> >> rest
> >> of the plane I map it to.
> >>
> >> -Is it posible to have a simple actor with two or more different
> textures
> >> added?
> >>
> >> -If so, how do I overlap those textures? I mean, the jpg Images I have
> >> correspond to certain regions of the model and in some regions they
> >> overlap.
> >> Is there a way to do this?
> >>
> >> Hope someone please give me any advise. Many thanks to all.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Two-or-more-.jpg-textures-mapped-to-a-Polydata-tf4115864.html#a11704498
> >> Sent from the VTK - Users mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> This is the private VTK discussion list.
> >> Please keep messages on-topic. Check the FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >
> >
> >
> > --
> > Wesley D. Turner, Ph.D.
> > Kitware, Inc.
> > R&D Engineer
> > 28 Corporate Drive
> > Clifton Park, NY 12065-8662
> > Phone: 518-371-3971 x120
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Two-or-more-.jpg-textures-mapped-to-a-Polydata-tf4115864.html#a11861423
> Sent from the VTK - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Wesley D. Turner, Ph.D.
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070730/0df218d2/attachment.htm>


More information about the vtkusers mailing list