emacs-devel
[Top][All Lists]
Advanced

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

## Re: Image transformations

 From: Alp Aker Subject: Re: Image transformations Date: Thu, 13 Jun 2019 00:16:36 -0400

On Wed, Jun 12, 2019 at 6:09 PM Alan Third <address@hidden> wrote:
>
> matrix:
> 0.000000 1.000000 0.000000
> -1.000000 0.000000 232.000000
> 0.000000 0.000000 1.000000
>
> I don’t know exactly what that means.  The 1 and -1 are shearing the
> image in the x and y dimensions. The 232 is moving the image in the y
> dimension

This is a transformation matrix using so-called homogenous coordinates:

https://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations

It's a clockwise 90 degree rotation followed by a translation along the y
axis.  In general you can't assign a geometric meaning to m11, m12, m21, m22
taken individually; whether they represent rotation, shearing, or scaling
depends on their relative values.

> I believe we take the x and y coordinates and convert them into a 3x1 matrix
> and multiply that by the transformation matrix and it gives us a new set of
> coordinates.
>
>    [x]   [m11 m12 m13]
>    [y] X [m21 m22 m23] = [x’ y’ 0]
>       [m31 m32 m33]

You need to use 1 instead of 0 when translating from Cartesian to homogenous
coordinates.  That is, given a point (x, y), you find (x', y') as
follows.  Multiply (x, y, 1) by the transformation matrix.  Let the result be
(a, b, c).  Then the new point (x', y') in Cartesian coordinates is (a/c, b/c).

When dealing only with affine transformations the procedure is simpler.  Such
transformations can always be described by a matrix where m31 == m32 == 0 and
m33 == 1.  In that case, the result of multiplication will have the form (a, b,
1), so x' == a and y' == b.

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]