Merge branch 'main' into feat/db/migrations

This commit is contained in:
psychedelicious
2023-12-13 11:24:55 +11:00
committed by GitHub
4 changed files with 33 additions and 18 deletions

View File

@ -191,11 +191,15 @@ def calc_tiles_min_overlap(
assert min_overlap < tile_height
assert min_overlap < tile_width
# The If Else catches the case when the tile size is larger than the images size and just clips the number of tiles to 1
num_tiles_x = math.ceil((image_width - min_overlap) / (tile_width - min_overlap)) if tile_width < image_width else 1
num_tiles_y = (
math.ceil((image_height - min_overlap) / (tile_height - min_overlap)) if tile_height < image_height else 1
)
# catches the cases when the tile size is larger than the images size and adjusts the tile size
if image_width < tile_width:
tile_width = image_width
if image_height < tile_height:
tile_height = image_height
num_tiles_x = math.ceil((image_width - min_overlap) / (tile_width - min_overlap))
num_tiles_y = math.ceil((image_height - min_overlap) / (tile_height - min_overlap))
# tiles[y * num_tiles_x + x] is the tile for the y'th row, x'th column.
tiles: list[Tile] = []