문제

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