fix(cv): resolve infinite page duplication bug caused by playback cursor

This commit is contained in:
2026-03-29 21:23:18 +09:00
parent ac0c098259
commit 3377b5f68d
23 changed files with 779 additions and 465 deletions

View File

@@ -0,0 +1,24 @@
import cv2
import numpy as np
import sys
def print_ascii(img_path):
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
if img is None: return
_, bin_inv = cv2.threshold(img, 200, 255, cv2.THRESH_BINARY_INV)
# Trim empty borders
coords = cv2.findNonZero(bin_inv)
if coords is not None:
x,y,w,h = cv2.boundingRect(coords)
bin_inv = bin_inv[y:y+h, x:x+w]
print(f"\nImage: {img_path}")
for row in range(0, bin_inv.shape[0], 2):
line = ""
for col in range(0, bin_inv.shape[1], 1):
line += "##" if bin_inv[row, col] > 127 else " "
print(line)
for i in range(5):
print_ascii(rf"C:\Users\Certes\Desktop\guitar_score\scripts\debug\measure_num_{i}.png")