Implement border detection
This commit is contained in:
parent
b0eabd1297
commit
7eae871fc6
5 changed files with 224 additions and 18 deletions
|
|
@ -3,6 +3,24 @@ from pathlib import Path
|
|||
CARD_W_INCHES = 2.48031 # 63mm
|
||||
CARD_H_INCHES = 3.46457 # 88mm
|
||||
|
||||
W_INCHES_EXPECTED = 2.72
|
||||
H_INCHES_EXPECTED = 3.7
|
||||
|
||||
LEAVE_BLEED_INCHES = 0.04
|
||||
|
||||
BASE_DIR = Path(__file__).parent
|
||||
|
||||
SAVE_INTERMEDIATE_FOR_DEBUG = False
|
||||
|
||||
|
||||
def make_intermediate_name(input_path: Path, infix: str):
|
||||
return BASE_DIR / 'cropped_cards' / f'{input_path.stem}.{infix}.jpg'
|
||||
|
||||
|
||||
def in_to_px(inches: float, dpi: int) -> int:
|
||||
return round(inches * dpi)
|
||||
|
||||
|
||||
def mil_to_px(mils: int, dpi: int) -> int:
|
||||
return int(mils * dpi // 1000)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue