Registered Member
|
Hi,
I have 2xM matrices A and B and want to find 2x2 rotation matrix R, such that R*A = B. Basically I have vectors in columns of A and B and I want to find best rotation R that would rotate these vectors between two frames. In MATLAB, B/A gives me the matrix I am looking for. I hoped that the following code would give me the same answer with Eigen, but it does not:
Can I achieve this with Eigen? How? One shortcoming of my data is that vectors of A can be colinear, but MATLAB seems to be fine with that. My linear algebra knowledge isn't that good.. Excuse me if I ask something that is already explained in the doc, but I did not understand it. |
Moderator
|
This should give you similar results, except that you are using float, while Matlab uses doubles. Anyway, in both cases it is unlikely to give you a rotation matrix. You then have to perform a polar decomposition of the result to extract a pure rotation. See Transform::rotation() (http://eigen.tuxfamily.org/dox-devel/cl ... d8104367ac), e.g.:
Affine2f T(R_trps.transpose()); Matrix2f R = T.rotation(); |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]