Cropping investigation
This commit is contained in:
1 parent
48602c24f1
commit
bd1964ffcd
10 files changed
+814
-24
No files matched your search
@@ -24,7 +24,6 @@ from copienator.ink_detection import detect_bounds
|
||||
|
||||
LINES_PER_PAGE = 36
|
||||
MINIMUM_HEIGHT_LINES = 10
|
||||
IGNORED_BOTTOM_LINES = 0.75
|
||||
MINIMUM_CROP_LINES = 4
|
||||
|
||||
|
||||
@@ -93,13 +92,8 @@ def process_exercise_pdf(
|
||||
pixmap.height, pixmap.width, 3
|
||||
)
|
||||
pixels_per_point = pixmap.height / visible_height
|
||||
ignored_pixels = min(
|
||||
pixmap.height - 1,
|
||||
round(IGNORED_BOTTOM_LINES * line_points * pixels_per_point),
|
||||
)
|
||||
analysis_bottom = pixmap.height - ignored_pixels
|
||||
detection = detect_bounds(
|
||||
rgb[:analysis_bottom], dpi=dpi, padding_mm=padding_mm, min_crop_mm=0
|
||||
rgb, dpi=dpi, padding_mm=padding_mm, min_crop_mm=0
|
||||
)
|
||||
proposed_bottom = detection["bottom_px"]
|
||||
removed_points = (pixmap.height - proposed_bottom) / pixels_per_point
|
||||
|
||||
Reference in new issue
Block a user