I have two array of points:
Point [] original;
AND Point [] transformed;
These transformed array is simply a copy of the original with transformations applied. Example:
matrix.Rotate(5f);
matrix.Scale(.8f, 1.1f);
matrix.Translate(30f, 18f);
matrix.TransformPoints(transformed);
- The original points ARE known.
- The transformation values ARE known.
- The order in which the transformations were applied is NOT known.
How can I calculate / infer the order of transformations?
EDIT
- There is only ONE round of transformation.
- A round could contain at most three transformations as below.
- The only transformations applied are any combination on rotate, scale and translate.
To give it some real-world context, consider having an image with known points of interest. You print the image, scan it and try to read it again. The image contains orientation markers that allow me to calculate the transformations applied during the scanning process.
Now, a brute force approach would be:
- Read scanned image.
- Calculate rotation on the scanned image.
- Apply rotation on the scanned image.
- Calculate scale on the rotated image.
- Apply scale on the rotated image.
- Calculate translation on the scaled image.
- Apply translation on the scaled image.
You can now read the points of interest from the processed image using the original points as if there was no transformation. Of course this method is expensive. A 500MB image would need to have at least two copies in memory at a time and would have to be transformed using the graphics object.
The premise of this question was to read the image only once, calculate all transformations and apply them to coordinates rather than the image itself. The use the transformed coordinates to read the points of interest. This is where the problem of 'order of transformations' comes in. Some very helpful answers below and I hope this clears the context.
See Question&Answers more detail:os