[vtkusers] perspective image transformation

Affolter Martin martin.affolter at ntb.ch
Wed Aug 10 06:25:07 EDT 2011


Hi vtk-users,

I've been reading and experimenting with textures and how to map them on planar surfaces. The goal is to map a certain (sub-)area (e.g. quadrangle) from an image onto a planar polygon (also quadrangle), which I achieved so far by defining the normalized textureCoords for each point in the polygon. The problem I'm facing is that the resulting texture appears distorted. So here my two questions:

1. is there a way to apply a perspective image-transformation (conserving straight lines) before using the image for texturing? This way I imagine the distortion should disappear because the subimage and the polygon would have the same shape and ratio. (analogy in OpenCV: warpImage(...))

2. is there a class that calculates the perspective transformation matrix (3x3) from corresponding image-points? (analogy in OpenCV: getPerspectiveTransform(...))

Any help or alternative suggestions are welcome.

Thanks,
Martin

PS: I've attached my result. Not sure if it will come through...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: distorted_texture.jpg
Type: image/jpeg
Size: 89709 bytes
Desc: distorted_texture.jpg
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110810/565a3e8d/attachment.jpg>


More information about the vtkusers mailing list