# Research Script for Debugging process_pages
import cv2
import pickle
import os

out_dir = r"C:\Users\Certes\.gemini\antigravity\brain\975cea00-dd68-4689-9ee3-f1a2408b4ee6\debug_blocks"
os.makedirs(out_dir, exist_ok=True)

with open('unique_pages.pkl', 'rb') as f:
    unique_pages = pickle.load(f)

from score_extractor import ScoreExtractor
extractor = ScoreExtractor()
extractor.process_pages(unique_pages)

for i, block in enumerate(extractor.final_sheet_chunks):
    cv2.imwrite(os.path.join(out_dir, f"block_{i:02d}.png"), block)

print("Dumped blocks!")
