From 7106e96e776f45f2f3df508f0108c95cf43fe116 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 12 Nov 2023 23:01:53 -0600 Subject: [PATCH] fix(api): make tile blending symmetrical, correct bottom/right gradients --- api/onnx_web/chain/tile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/onnx_web/chain/tile.py b/api/onnx_web/chain/tile.py index eb4aebc4..3ec071ab 100644 --- a/api/onnx_web/chain/tile.py +++ b/api/onnx_web/chain/tile.py @@ -105,13 +105,13 @@ def make_tile_mask( adj_tile_w = int(float(tile_w) * (1.0 - overlap)) # sort gradient points - p1_h = adj_tile_h + p1_h = adj_tile_h - 1 p2_h = tile_h - adj_tile_h - points_h = [0, min(p1_h, p2_h), max(p1_h, p2_h), tile_h] + points_h = [0, min(p1_h, p2_h), max(p1_h, p2_h), tile_h - 1] - p1_w = adj_tile_w + p1_w = adj_tile_w - 1 p2_w = tile_w - adj_tile_w - points_w = [0, min(p1_w, p2_w), max(p1_w, p2_w), tile_w] + points_w = [0, min(p1_w, p2_w), max(p1_w, p2_w), tile_w - 1] # build gradients edge_t, edge_l, edge_b, edge_r = edges @@ -155,9 +155,9 @@ def blend_tiles( if adj_tile < tile: # sort gradient points - p1 = adj_tile * scale + p1 = (adj_tile * scale) - 1 p2 = (tile - adj_tile) * scale - points = [0, min(p1, p2), max(p1, p2), tile * scale] + points = [0, min(p1, p2), max(p1, p2), (tile * scale) - 1] # gradient blending grad_x, grad_y = get_tile_grads(left, top, adj_tile, width, height)