Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Augmentor/Operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,11 @@ def do(image):
angle_b_sin = math.sin(angle_b_rad)

# Find the maximum area of the rectangle that could be cropped
E = (math.sin(angle_a_rad)) / (math.sin(angle_b_rad)) * \
(Y - X * (math.sin(angle_a_rad) / math.sin(angle_b_rad)))
E = E / 1 - (math.sin(angle_a_rad) ** 2 / math.sin(angle_b_rad) ** 2)
B = X - E
A = (math.sin(angle_a_rad) / math.sin(angle_b_rad)) * B
M = y / math.cos(angle_a_rad)
x_p = M / (math.tan(angle_a_rad) + y / x)
y_p = x_p * y / x
E = (X - x_p) / 2
A = (Y - y_p) / 2

# Crop this area from the rotated image
# image = image.crop((E, A, X - E, Y - A))
Expand Down