Skip to content

Commit

Permalink
fix(api): convert spiral grid coordinates to offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 29, 2023
1 parent 03d88df commit 6f1ffaa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/onnx_web/chain/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def process_tile_spiral(

width, height = source.size
image = Image.new('RGB', (width * scale, height * scale))
image.paste(source, (0, 0))
image.paste(source, (0, 0, width, height))

center_x = (width / 2) - (tile / 2)
center_y = (height / 2) - (tile / 2)

# TODO: only valid for overlap = 0.5
if overlap == 0.5:
Expand All @@ -69,6 +72,9 @@ def process_tile_spiral(
# tile tuples is source, multiply by scale for dest
counter = 0
for left, top in tiles:
left = center_x + int(left)
top = center_y + int(top)

logger.info('processing tile %s of %s', counter, len(tiles))
counter += 1

Expand Down

0 comments on commit 6f1ffaa

Please sign in to comment.