Search code examples
graphicstransformationprojective-geometry

Projective transformation by dragging handles


We would like to implement this kind of transformation: Screenshot-73.png

Screenshot-73

This image is taken from Gimp, using the Unified Transform Tool. You simply drag the corners and the rectangle is transformed freely. I believe this is called a projective transformation.

Does anyone have the formulas to create the transformation matrix for such a projective transformation given the locations of the corners?


Solution

  • We have used the following library to obtain the transformation matrix from the source and destination corner points:

    https://github.com/jlouthan/perspective-transform