Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation of coordinates in MATLAB result in inconsistency with Python #1

Open
ptim0626 opened this issue Jan 14, 2021 · 1 comment
Open
Assignees

Comments

@ptim0626
Copy link
Owner

The rotation during pixel origin initialisation at here results in inconsistency with Python. To illustrate this, consider the variable xy before shifting the fractional part when rotating at angle 1 and 90 degree using the example dataset. The important value to look at here is xy(1,2).

For rotating 1 degree, xy(1,2) is 28.588474093612945 in MATLAB, and in Python xy[1,0] is 27.588474093612945 (MATLAB and Python indices differ by 1), so they are equal; however for rotating 90 degree, xy(1,2) is 32.999999999999970 in MATLAB, and in Python xy[1,0] is 32.0.

So for 90 degree, mod(xy(1,2),1) in MATLAB results in 0.9999... and xy(:,2) is shifted by that amount, but it does not happen in Python.

Attached some files containing values of xy for both MATLAB and Python at degree 1 and 90.
xy_deg_1_90.zip

@ptim0626 ptim0626 self-assigned this Jan 14, 2021
@ptim0626
Copy link
Owner Author

ptim0626 commented Jan 14, 2021

A fix could be increasing the precision in rotation in MATLAB, see here. The xy value matches for any angle now. This is the change I made when I compare the Python and MATLAB results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant