RSS/Atom feed Twitter
Site is read-only, email is disabled

Problem with perspective transform matrix

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

465C21AE.9090306@rodo.nl Willem Vervuurt 29 May 14:50
  Problem with perspective transform matrix David Hodson 29 May 16:11
   465C3E2A.1010909@rodo.nl Willem Vervuurt 29 May 16:52
  Problem with perspective transform matrix Sven Neumann 29 May 20:01
David Hodson
2007-05-29 16:11:25 UTC (almost 17 years ago)

Problem with perspective transform matrix

Hi Willem,

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.

It looks like you are applying the transform in the wrong direction...

To compute a transformed coordinate (x', y') I simply multiply (x, y, 1) by the transformation matrix that GIMP shows

In that case, I think that the transformation converts the destination coordinate to the corresponding source coordinate.

Sven Neumann
2007-05-29 20:01:23 UTC (almost 17 years ago)

Problem with perspective transform matrix

Hi,

On Tue, 2007-05-29 at 14:50 +0200, Willem Vervuurt wrote:

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).

I think you are making the wrong assumption that the perspective transform tool would apply an affine transformation which can be expressed as a 3x3 matrix. You probably know these matrices for example from SVG files. The transformation performed by the Perspective transform tool is however not necessarily an affine transformation. It uses a 4x4 matrix. Only the upper left 3x3 submatrix 3x3 is displayed because the other values are always 0.0 or 1.0.

Sven