update after ojzm

This commit is contained in:
TPP-G6
2026-03-14 10:12:22 +08:00
parent aa781a7a2a
commit 88c8b8fa01
7 changed files with 247 additions and 15 deletions
+7 -2
View File
@@ -449,7 +449,7 @@ class Stitcher:
n_boxes = 0
bk_thresh = 0 # initial black threshold
bk_thresh_step = 5
bk_thresh_max = 100
bk_thresh_max = 150
# Also include a low global V threshold to capture colored but dark tiles
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
@@ -458,7 +458,12 @@ class Stitcher:
while n_boxes != n_boxes_target and bk_thresh <= bk_thresh_max:
_, v_mask = cv2.threshold(v, bk_thresh, 255, cv2.THRESH_BINARY) # tune 50 if needed
mask = v_mask
mask = v_mask.copy()
# Exclude left and right boundary (20 pixels each) from detection
edge = 20
if w > edge * 2:
mask[:, :edge] = 0
mask[:, -edge:] = 0
# Morphology: remove small specks, fill small holes
k = max(1, morph_k)