Browse Source

Hopefully get better skew interpretation ;)

master
Merlijn Wajer 5 years ago
parent
commit
7a5c6a6792
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      parse_scandata.py

+ 3
- 3
parse_scandata.py View File

@@ -50,13 +50,13 @@ for r in relevant:

#print(pagetype, orig_file_name, rotation, skew, apply_skew, crop_x, crop_y, crop_w, crop_h)

skew_r = math.radians(-skew)
skew_r = math.radians(skew)

if apply_skew:
top_l = (crop_x, crop_y)
top_r = (crop_x + crop_w * math.cos(skew_r), crop_y + crop_w * math.sin(skew_r))
top_r = (crop_x + crop_w * math.cos(skew_r), crop_y - crop_w * math.sin(skew_r))
bottom_l = (crop_x + crop_h * math.sin(skew_r), crop_y + crop_h * math.cos(skew_r))
bottom_r = (top_r[0], bottom_l[1] + crop_w * math.sin(skew_r))
bottom_r = (top_r[0], bottom_l[1] - crop_w * math.sin(skew_r))
else:
top_l = (crop_x, crop_y)
top_r = (crop_x + crop_w, crop_y)


Loading…
Cancel
Save