Augmentor icon indicating copy to clipboard operation
Augmentor copied to clipboard

Rotation degrees are opposite.

Open YiweiZou opened this issue 2 years ago • 3 comments

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.

YiweiZou avatar Feb 20 '23 02:02 YiweiZou

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....

mdbloice avatar Mar 28 '23 14:03 mdbloice

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.

YiweiZou avatar Mar 29 '23 05:03 YiweiZou

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.

itstechaj avatar May 28 '23 02:05 itstechaj