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 degrees are opposite. #252

Open
YiweiZou opened this issue Feb 20, 2023 · 3 comments
Open

Rotation degrees are opposite. #252

YiweiZou opened this issue Feb 20, 2023 · 3 comments

Comments

@YiweiZou
Copy link

YiweiZou commented Feb 20, 2023

In the python module, Image.py rotation with positive degrees returns a rotated image with the given number of degrees counterclockwise around its center, but not clockwise. So the function rotate90, rotate270, rotate, rotate_without_crop give out results with left and right opposite.

And also to mention, rotate function can't rotate with certain degrees when max_left_raotion == max_right_rotation.

@mdbloice
Copy link
Owner

Hi @YiweiZou - so in your case the rotate function always results in the rotations going in the wrong direction? So for example:

p.rotate(probability=0.7, max_left_rotation=0, max_right_rotation=10)

This would result in a rotation going in the wrong direction (counter clockwise)?

As for the max_left_rotation == max_right_rotation that might well be a bug and I will investigate that....

@YiweiZou
Copy link
Author

Hi @YiweiZou - so in your case the rotate function always results in the rotations going in the wrong direction? So for example:

p.rotate(probability=0.7, max_left_rotation=0, max_right_rotation=10)

This would result in a rotation going in the wrong direction (counter clockwise)?

As for the max_left_rotation == max_right_rotation that might well be a bug and I will investigate that....

Yes, for the example, the images would randomly rotation within 0-10 degrees counterclockwise.

@itstechaj
Copy link

Hi @YiweiZou - so in your case the rotate function always results in the rotations going in the wrong direction? So for example:

p.rotate(probability=0.7, max_left_rotation=0, max_right_rotation=10)

This would result in a rotation going in the wrong direction (counter clockwise)?

As for the max_left_rotation == max_right_rotation that might well be a bug and I will investigate that....

Hi @mdbloice ,

After reviewing the Operations.py file, I noticed that you assigned the angle of rotation as positive for clockwise rotation and negative for anticlockwise rotation. However, this is opposite to the default behavior of the image.rotate() method. In image.rotate() method, when a positive angle of rotation is provided, it performs an anticlockwise rotation, whereas a negative angle results in a clockwise rotation.

To address this inconsistency, I added a negative sign whenever you are passing the angle in the image.rotate() method in the Operations.py file. By adjusting the sign of the angle of rotation passed to the image.rotate() method, I ensured that the rotations are now correctly aligned with the intended clockwise and anticlockwise directions.

Since implementing these modifications I have tested, and all rotations have been functioning correctly in my local system.

Thank you.

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

3 participants