import cv2
import pickle
import os

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

# Save jump cut boundary frames to see what happened exactly around measure 21 and 45.
# We will use the browser subagent to securely review them.
out_dir = r"C:\Users\Certes\.gemini\antigravity\brain\975cea00-dd68-4689-9ee3-f1a2408b4ee6"

# Let's save the Pages that we know caused issues:
# In verify_log.txt, we saw:
# Page 18-24 (Around Measure 21 problem)
# Page 40-50 (Around Measure 45 problem)

for i in range(16, 26):
    if i < len(unique_pages):
        cv2.imwrite(os.path.join(out_dir, f"jump_cut_inspection_page_{i}.png"), unique_pages[i])

for i in range(43, 53):
    if i < len(unique_pages):
        cv2.imwrite(os.path.join(out_dir, f"jump_cut_inspection_page_{i}.png"), unique_pages[i])

print(f"Dumped inspection frames to Artifact Directory.")
