Skip to content

Commit 7ad7312

Browse files
committed
Updates according to the review
1 parent 98d4b3c commit 7ad7312

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

torchvision/transforms/functional.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -950,38 +950,25 @@ def _get_inverse_affine_matrix(
950950
translate: List[float],
951951
scale: float,
952952
shear: List[float],
953-
centered_shear: bool = True,
954953
) -> List[float]:
955954
# Helper method to compute inverse matrix for affine transformation
956955

957956
# Pillow requires inverse affine transformation matrix:
958-
# option 1 (centered_shear=True) curr : M = T * C * RotateScaleShear * C^-1
959-
# option 2 (centered_shear=False) new : M = T * C * RotateScale * C^-1 * Shear
957+
# M = T * C * RotateScaleShear * C^-1
960958
#
961959
# where T is translation matrix: [1, 0, tx | 0, 1, ty | 0, 0, 1]
962960
# C is translation matrix to keep center: [1, 0, cx | 0, 1, cy | 0, 0, 1]
963961
# RotateScaleShear is rotation with scale and shear matrix
964-
# RotateScale is rotation with scale matrix
965962
#
966963
# RotateScaleShear(a, s, (sx, sy)) =
967964
# = R(a) * S(s) * SHy(sy) * SHx(sx)
968965
# = [ s*cos(a - sy)/cos(sy), s*(-cos(a - sy)*tan(sx)/cos(sy) - sin(a)), 0 ]
969966
# [ s*sin(a + sy)/cos(sy), s*(-sin(a - sy)*tan(sx)/cos(sy) + cos(a)), 0 ]
970967
# [ 0 , 0 , 1 ]
971-
#
972-
# RotateScale(a, s) =
973-
# = R(a) * S(s)
974-
# = [ s*cos(a), -s*sin(a), 0 ]
975-
# [ s*sin(a), s*cos(a), 0 ]
976-
# [ 0 , 0 , 1 ]
977-
#
978968
# where R is a rotation matrix, S is a scaling matrix, and SHx and SHy are the shears:
979969
# SHx(s) = [1, -tan(s)] and SHy(s) = [1 , 0]
980970
# [0, 1 ] [-tan(s), 1]
981971

982-
# TODO: implement the option
983-
assert centered_shear
984-
985972
rot = math.radians(angle)
986973
sx = math.radians(shear[0])
987974
sy = math.radians(shear[1])

0 commit comments

Comments
 (0)