Perspective Transform of Image

Started by
0 comments, last by nknk 15 years, 9 months ago
Hey Its been sometime since I have done any graphics, but I recently took an interest in doing some again in my spare time. I am trying to make a small image manipulation program and one of things I would like to do is to create a perspective transform, where given 4 points (8 values for the x/y), I can manipulate the image into any quadrilateral shape I want. In the past I had implemented a perspective transform app that did just this (or so I thought). When I tried it out again today it did a shear instead (e.g. I added 200 to the topLeft x and it did it correctly, but subtracted 200 from the bottom right x as well). So I obviously did it wrong. Though, I think the LU decomposition algorithm I wrote is correct, I think I am building the matrix incorrectly. I tried looking online and I found lots of information on perspective transforms, but I could not find the link to doing something like 4 points on an image. Could someone point me in the right direction or to a tutorial on how to do this. I cannot recall how the near plane/far plane of the perspective transform relate in the case of manipulating a quadrilateral. In essence, in case I am not clear, I would like to be able to form a matrix to manipulate images similar to this: http://zrusin.blogspot.com/2006/09/perspective-transformations.html A library that forms this for me would be nice, but I am really interested in re-learning how it works. So if anyone could point me in the right direction. I did a quick search of the forums and found little relating specifically to quads. I apologize in advance if I missed something. Thanks EDIT: I thought I should add this in case what I want is not a perspective transform: I want to go from |-----| |-----| |-----| |-----| to |---| |---| |---| |-/ |/ not ||-|--| |-/ |/ which is what I could get rotating around the y-axis. So I am squishing on part of the image. [Edited by - merlin_1102 on June 30, 2008 5:31:34 PM]
Advertisement
i think this link may help :

http://www.math.ubc.ca/~cass/graphics/manual/pdf/ch10.pdf

This topic is closed to new replies.

Advertisement