Public Lab Research note

Sign up with

By signing up, you agree to the Code of Conduct, which applies to all online and in-person spaces managed by the Public Lab community and non-profit. You also agree to our Privacy Policy.

As an open source community, we believe in open licensing of content so that other members of the community can leverage your work legally -- with attribution, of course. By joining the Public Lab site, you agree to release the content you post here under a Creative Commons Attribution Sharealike license, and the hardware designs you post under the CERN Open Hardware License 1.1 (full text). This has the added benefit that others must share their improvements in turn with you.

The image distortion in the editing interface in Mapknitter is one of the complex operations taking place in the tool.

This steps which take place when we are distorting an image are:
1) The image gets unlocked to allow editing on it.

2) The corners of the image(also known as control points) are dragged by the user to allow distortion.

3) When the control points are dragged, the image gets divided into a large number of small triangles and on each of these triangles, affine transformation takes place. As a result of many affine transformations and some end corrections, it appears as if the image as a whole is undergoing non-affine transformation or more specifically projective transformation.

In step 3, since each triangle will have a different plane of transformation, it is not possible to find a simple unique rule common to transforming all the triangles. To overcome this drawback, the Cartesian coordinates of the triangle are converted into homogeneous coordinates which helps to transform the triangles with a common rule.

It is difficult to form an equation which does non-affine transformations. However, it is easy to have equations which can do affine transformations. The current interface works on this principle and so it divides the image into a number of triangles and does affine transformations on them. Due to a large number of triangles undergoing simpler transformations, the image as a whole appears to have undergone a complex non-affine transformation. Here is how it works:

We can imagine a parallelogram having 3 edges fixed and one edge being dragged. When this happens, we can visualize that only half of the parallelogram will get affected by this event i.e. the triangle formed by joining the edge being moved and it's neighboring edges. The other half will remain unaltered. To solve this, it is further broken down into more number of triangles so that the effect of the movement of an edge gets propagated throughout. (Credits: btbonval)

@eustatic There is a logic to the distortion. As Anish said, the end result of these affine transformations looks like a projective distortion. The projective distortion is the logic. It is a specific kind of distortion that is calculated, in this case, given the four control points.

I think it is implied in step 3 that the control points drive the projective distortion, but that fact could be made more clear.