Implement border detection

This commit is contained in:
henriquenakashima 2023-07-17 13:10:08 -04:00
parent b0eabd1297
commit 7eae871fc6
5 changed files with 224 additions and 18 deletions

View file

@ -13,6 +13,9 @@ from sheet_layout import SheetLayout, CardImageTransfer
import util
DRY_RUN = False
CUT_GUIDE_WIDTH_INCHES = 0.006
LENGTH_CUT_GUIDE_INCHES = 0.04
@ -96,8 +99,9 @@ def create_sheet(input_cards: List[InputCardImage], sheet_filepath: Path, layout
draw.line([(right_x, bottom_y), (right_x - guide_len, bottom_y)], fill = color, width = guide_thickness)
# Save sheet
# sheet.save(sheet_filepath, 'JPEG', dpi=(layout.dpi, layout.dpi), quality=100, subsampling=0, icc_profile=icc_profile.tobytes())
sheet.save(sheet_filepath, 'JPEG', dpi=(layout.dpi, layout.dpi), quality=100, subsampling=0)
if not DRY_RUN:
# sheet.save(sheet_filepath, 'JPEG', dpi=(layout.dpi, layout.dpi), quality=100, subsampling=0, icc_profile=icc_profile.tobytes())
sheet.save(sheet_filepath, 'JPEG', dpi=(layout.dpi, layout.dpi), quality=100, subsampling=0)
def main():
@ -106,6 +110,8 @@ def main():
print(all_input_cards_paths)
all_input_cards = [InputCardImage(p) for p in all_input_cards_paths]
for input_card in all_input_cards:
print(f'{input_card.path} has borders {input_card.get_borders()}')
layout = sheet_layout.letter_portrait_3x3_sheet_layout_120milborder()
sheets_dir = BASE_DIR / 'sheets'