Return a transformation structure T (see "help maketform" for the form of the structure) that can be further used to transform coordinates between an input space and an ouput space.
The transform is inferred from two n-by-2 arrays, in_cp and out_cp, which contain the coordinates of n control points in the two 2D spaces. Transform coefficients are stored in T.tdata. Interpretation of transform coefficients depends on the requested transform type ttype:
Return both forward (input space to output space) and inverse transform coefficients T.tdata.T and T.tdata.Tinv. Transform coefficients are 3x2 matrices which can be used as follows:
in_cp = [out_cp ones(rows (out_cp) ,1)] * T.tdata.Tinv out_cp = [in_cp ones(rows (in_cp) ,1)] * T.tdata.T
This transformation is well suited when parallel lines in one space are still parallel in the other space (e.g. shear, translation, …).
Same as "affine" except that the transform matrices T and Tinv have the form
Tcoefs = [a -b; b a; c d]
This transformation may represent rotation, scaling and translation. Reflection is not included.
Same as "nonreflective similarity" except that the transform matrices T and Tinv may also have the form
Tcoefs = [a b; b -a; c d]
This transformation may represent reflection, rotation, scaling and translation. Generates a warning if the nonreflective similarity is better suited.
Return both forward (input space to output space) and inverse transform coefficients T.tdata.T and T.tdata.Tinv. Transform coefficients are 3x3 matrices which can be used as follows:
[u v w] = [out_cp ones(rows (out_cp) ,1)] * T.tdata.Tinv in_cp = [u./w, v./w]; [x y z] = [in_cp ones(rows (in_cp) ,1)] * T.tdata.T out_cp = [x./z y./z];
This transformation is well suited when parallel lines in one space all converge toward a vanishing point in the other space.
Here the opt input argument is the order of the polynomial fit. opt must be 2, 3 or 4 and input control points number must be respectively at least 6, 10 or 15. Only the inverse transform (output space to input space) is included in the structure T. Denoting x and y the output space coordinate vector and u, v the the input space coordinates. Inverse transform coefficients are stored in a (6,10 or 15)-by-2 matrix which can be used as follows:
Second order: [u v] = [1 x y x*y x^2 y^2] * T.tdata.Tinv
Third order: [u v] = [1 x y x*y x^2 y^2 y*x^2 x*y^2 x^3 y^3] * T.tdata.Tinv
Fourth order: [u v] = [1 x y x*y x^2 y^2 y*x^2 x*y^2 x^3 y^3 x^3*y x^2*y^2 x*y^3 x^4 y^4] * T.tdata.Tinv
This transform is well suited when lines in one space become curves in the other space.
See also: tformfwd, tforminv, maketform.
Package: image