What exactly is stored in the tdata.T parameter of the output of maketform?

4 vues (au cours des 30 derniers jours)
So I'm looking at some Matlab code that was written in 2012, so slightly out of date. In it there is a section where the author uses maketform, and then acesses tform.tdata.T:
T = maketform('affine',U,X);
t = T.tdata.T;
I'm trying to update this, so I looked up maketform to try and ascertain what exactly t will now ctdatontain, and I may just be entirely blind, but I couldn't find anything on it. I would guess from the name that it might be a transposition of the matrix? Uncertain however, and I have little experience with how Matlab looked in 2012. Any help or clarification you could give would be greatly appreciated! Thanks :).

Réponse acceptée

Uday Pradhan
Uday Pradhan le 27 Mai 2021
Hi,
An affine transformation is described in mathematical form as:
Here, [x y] are the transformed coordinates while [w z] are the original coordinates. The T matrix (also called the Transformation matrix is stored in T.tdata.T. In the example that you have provided, this transformation matrix (stored in T.tdata.T) is such that it maps each row of U to the corresponding row of X. The U and X arguments are each 3-by-2 and define the corners of input and output triangles. For example:
U = [11 11;21 11; 21 21];
X = [51 51;61 51;61 61];
tform2 = maketform('affine',U,X);
>> tform2.tdata.T
ans =
1 0 0
0 1 0
40 40 1
Now if you check:
>> [U [1;1;1]]*tform2.tdata.T
ans =
51 51 1
61 51 1
61 61 1
which is just [X [1;1;1]]. I hope this helps.

Plus de réponses (0)

Catégories

En savoir plus sur Just for fun dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by