Problem with perspective transform matrix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am trying to build an algorithm that transforms pictures (all taken from the same viewpoint) into their corrected-for-perspective equivalents.
In the GIMP, I can apply the desired perspective transformation to an image and retrieve the required transform matrix (it is {{0.485, -0.374, 178}, {0, 0.45, 0}, {0, 0, 1}}, reading rows). (See http://www.rodo.nl/input.jpg and http://www.rodo.nl/result.jpg for input image & desired output, respectively).

However, when I use this transformation matrix in my own code, I get strange results, even using the function gimp_matrix3_transform_point from gimpmatrix.c. See http://www.rodo.nl/error.jpg for the output I receive. To compute a transformed coordinate (x', y') I simply multiply (x, y, 1) by the transformation matrix that GIMP shows, dividing both x' and y' by w' (the third value in the vector that is a result of that multiplication) in order to switch back to non-homogenuous coordinates.

Is there a bug in generating the transformation matrix, or should I interpret it differently? The function I wrote to compute a new coordinate based on an old one and the transformation matrix seems to work, since it yields the exact same results as does gimp_matrix3_transform_point().

I hope that someone can help me interpret GIMP's transformation matrix.

Regards,

Willem Vervuurt
The Netherlands
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux