From 3abc0a44be02dbb6223a1d71ef3ad2274f740bf7 Mon Sep 17 00:00:00 2001 From: Simon Mayer Date: Thu, 6 May 2021 10:25:17 +0200 Subject: [PATCH] Added sketch for tiling algorithm. --- stitching/create_tiles.py | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 stitching/create_tiles.py diff --git a/stitching/create_tiles.py b/stitching/create_tiles.py new file mode 100644 index 0000000..4205afa --- /dev/null +++ b/stitching/create_tiles.py @@ -0,0 +1,47 @@ +from scan import * + + +class Tile: + def __init__(self, side_length=100, top_left=(0, 0), roi=(0, 0, 100, 100), img_names=None): + self.side_length = side_length + self.top_left = top_left + self.roi = roi + self.img_names = img_names + + def draw(self): + if self.img_names is None: + raise EmptyTileError + pass + + def load_image(self, img_name, directory): + pass + + def move(self): + if self.is_out_of_roi(): + raise OutOfBoundsError + + def is_out_of_roi(self): + pass + + def has_overlap(self, vertices): + pass + + def check_intersections(self, data): + pass + + +class EmptyTileError(Exception): + pass + + +class OutOfBoundsError(Exception): + pass + + +if __name__ == '__main__': + with open('10pct_stitch_data.json', 'r') as fp: + all_comp = json.load(fp) + print(get_roi(all_comp)) + scaled_all = scale_data(all_comp, 10) + for dat in all_comp: + print(dat) -- GitLab