I don’t normally post questions as I like to solve things myself, but I have been stuck on this for over half a year. Its very much so an algorithm question, but is independent of OpenGL for the most part (other then I use OpenGL in my app) so please ignore this if it was inappropriate to post). I do a lot of basic image editing and decided most of the programs I used did far too much and cost a lot. That got me interested in building my own image application. I have built my own application and it does everything I need except for doing a proper perspective transform. I have tried some many different algorithms, I have researched the topic myself (and I am not the best at math, but I don’t think I am entirely stupid).
The issue I have is I want to be able to change the coordinates of one corner of the image (like I can in Gimp) and have none of the other image corners be affected.
Just an example, what I would like to be able to do is shown here:
In this image I have moved the bottom left corner of my image up and to the right. The other 3 corners of the image have remained in the same spot.
When I implement any version of this algorithm myself, I end up with:
In the above image I have only tried to move, the top left corner down and too the right, yet the bottom right has also been moved. I use a mac so I have also tried using the Core Image Unit Perspective transform, and the exact same thing happens. I move one corner and at least one other corner also moves. I have even tried duplicating the exact same matrix that Gimp or applications say they are using and I still have multiple corners that are moving.
Am I missing something here. Do I want more then a perspective transform. The algorithm I am currently trying to use is straight from Gimp 2.6. I do not see it doing anything fancy in particular but I am sure there is a lot happening behind the scenes that I am unaware of. On a Mac I have even tried taking the transform that gimp outputs putting to a Core Animation Layer(Mac Specific – though I have tried the exact same thing in OpenGL) and the result is still always the name, no matter which algorithm I use for my perspective transform and no matter how I apply it.
I have copied and pasted the gimp version here (mine is currently littered with commented out code as I experiment)
So am I missing something? Am I looking at the wrong code in Gimp perhaps. Is there something extra I need to do to lock corners down? Anyone have an implementation of what I want that they are willing to share. Perhaps this is not entirely a perspective transform that I want?
Thanks for any help.