質問

Q1. I want to match points (x1, x2, x3) to points (y1, y2, y3). Does function getAffineTransform always return the same transformation matrix no matter what order of these points is?

Q2. If I know these points are transformed only by rotation and translation withouth any scaling, what is the easiest to remove scaling from the transformation matrix returned by getAffineTransform.

役に立ちましたか?

解決

A1, yes, the solution should be unique as long as the two sets of points are not collinear.

A2, your result matrix will be in the form:

[ A B C ]
[ D E F ]

C is your translation in x; F is your translation in y. Both are scale invariant.

If you take the left-most terms, these correspond to rotation and scale

[A B]
[D E]

in the following formula:

[I cos(t)  -I sin(f)]
[J sin(t) J cos (F)]

where I is the scale in x and J is the scale in y.

To remove scaling, divide by A and B by sqrt(A*A+B*B) and D and E by sqrt(D*D+E*E)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top