From 4a326e0c9f6863b433d3b40c6ef4f787f2a748d0 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Sat, 10 Jan 2026 00:29:31 -0600 Subject: [PATCH] logging --- src/stitching_scanner.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/stitching_scanner.py b/src/stitching_scanner.py index 8161327..e49daf4 100644 --- a/src/stitching_scanner.py +++ b/src/stitching_scanner.py @@ -184,15 +184,26 @@ class StitchingScanner: result[:, w_strip:] = base result[y_offset:y_offset + h_strip, :w_strip] = strip return result - if append_right: result_width = w_base + w_strip - blend_w result = np.zeros((h_base, result_width, 3), dtype=np.uint8) + self.log(f"=== _blend_horizontal_at_y (append_right) ===") + self.log(f" base: {w_base}x{h_base}, strip: {w_strip}x{h_strip}") + self.log(f" y_offset: {y_offset}, blend_w: {blend_w}") + self.log(f" result: {result_width}x{h_base}") + # Step 1: Copy entire base + self.log(f" Step 1: Copy base to result[:, :w_base] -> [:, :{w_base}]") result[:, :w_base] = base # Step 2: Copy non-overlap portion of strip at correct Y + x_start = w_base + x_end = result_width + y_start = y_offset + y_end = y_offset + h_strip + self.log(f" Step 2: Place strip at X={x_start}:{x_end}, Y={y_start}:{y_end}") + self.log(f" Strip source: [:, {blend_w}:] -> {w_strip - blend_w} cols") result[y_offset:y_offset + h_strip, w_base:] = strip[:, blend_w:] # Step 3: Create blend @@ -202,18 +213,34 @@ class StitchingScanner: blended = (base_overlap * alpha + strip_overlap * (1 - alpha)).astype(np.uint8) # Step 4: Place blend (overwrites part of base at correct Y) + blend_x_start = w_base - blend_w + blend_x_end = w_base + self.log(f" Step 4: Blend zone at X={blend_x_start}:{blend_x_end}, Y={y_start}:{y_end}") result[y_offset:y_offset + h_strip, w_base - blend_w:w_base] = blended + self.log(f" Final: Strip placed at X={w_base - blend_w}, Y={y_offset}") return result else: # append_left result_width = w_base + w_strip - blend_w result = np.zeros((h_base, result_width, 3), dtype=np.uint8) + self.log(f"=== _blend_horizontal_at_y (append_left) ===") + self.log(f" base: {w_base}x{h_base}, strip: {w_strip}x{h_strip}") + self.log(f" y_offset: {y_offset}, blend_w: {blend_w}") + self.log(f" result: {result_width}x{h_base}") + # Step 1: Copy ENTIRE base shifted right + base_x_start = w_strip - blend_w + self.log(f" Step 1: Copy base to result[:, {base_x_start}:] (shifted right)") result[:, w_strip - blend_w:] = base # Step 2: Copy non-overlap portion of strip at correct Y + strip_x_end = w_strip - blend_w + y_start = y_offset + y_end = y_offset + h_strip + self.log(f" Step 2: Place strip at X=0:{strip_x_end}, Y={y_start}:{y_end}") + self.log(f" Strip source: [:, :{strip_x_end}] -> {strip_x_end} cols") result[y_offset:y_offset + h_strip, :w_strip - blend_w] = strip[:, :w_strip - blend_w] # Step 3: Create blend @@ -223,8 +250,12 @@ class StitchingScanner: blended = (strip_overlap * (1 - alpha) + base_overlap * alpha).astype(np.uint8) # Step 4: Place blend at correct Y + blend_x_start = w_strip - blend_w + blend_x_end = w_strip + self.log(f" Step 4: Blend zone at X={blend_x_start}:{blend_x_end}, Y={y_start}:{y_end}") result[y_offset:y_offset + h_strip, w_strip - blend_w:w_strip] = blended + self.log(f" Final: Strip placed at X=0, Y={y_offset} (base shifted right by {base_x_start})") return result def _blend_horizontal(self, base: np.ndarray, strip: np.ndarray,