# coding=utf-8 import sys import os import hashlib import cv2 import numpy as np # Add project root to sys.path project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")) sys.path.append(project_root) from Apps.YeLiTe.Kit import get_image_content_md5 from Apps.YeLiTe.Config import Setting def check_result(): output_dir = os.path.join(project_root, "Output") files = sorted([f for f in os.listdir(output_dir) if f.startswith("verify_step1_list_")]) if not files: print("No verification files found.") return latest_timestamp = files[-1].split("_")[-1].replace(".jpg", "") print(f"Checking latest run: {latest_timestamp}") step1 = os.path.join(output_dir, f"verify_step1_list_{latest_timestamp}.jpg") step4 = os.path.join(output_dir, f"verify_step4_after_{latest_timestamp}.jpg") if not os.path.exists(step4): print("Step 4 file not found. Script might have failed mid-way.") return md5_1 = get_image_content_md5(step1, top_ratio=Setting.SAFE_EXCLUDE_RATIO, bottom_ratio=Setting.BOTTOM_SAFE_EXCLUDE_RATIO) md5_4 = get_image_content_md5(step4, top_ratio=Setting.SAFE_EXCLUDE_RATIO, bottom_ratio=Setting.BOTTOM_SAFE_EXCLUDE_RATIO) print(f"Step 1 MD5: {md5_1}") print(f"Step 4 MD5: {md5_4}") if md5_1 != md5_4: print(">>> RESULT: SUCCESS (MD5 Changed)") else: print(">>> RESULT: FAILURE (MD5 Identical)") if __name__ == "__main__": check_result()