fix: 空渠道检测改用JSONObject.has + 移除gitignore误排除manifest

This commit is contained in:
LukeMackin
2026-07-19 23:10:03 +08:00
parent ffd05e3e17
commit a96560966c
33 changed files with 891 additions and 6 deletions

55
ocr_screen.py Normal file
View File

@@ -0,0 +1,55 @@
"""
OCR script to extract text from screen.png
Attempts to use pytesseract if available, otherwise falls back to basic image info.
"""
import sys
import os
image_path = r"D:\Yuzu-GCA\screen.png"
# First, try to get basic image info
try:
from PIL import Image
img = Image.open(image_path)
print(f"Image size: {img.size}")
print(f"Image mode: {img.mode}")
print(f"Image format: {img.format}")
print("---")
except ImportError:
print("Pillow not available, trying basic file read...")
# Can't do much without PIL
# Try pytesseract
try:
import pytesseract
text = pytesseract.image_to_string(img, lang='chi_sim+eng')
print("OCR Result (pytesseract):")
print(text)
except ImportError:
print("pytesseract not available")
# Try subprocess call to system tesseract
import subprocess
try:
result = subprocess.run(
['tesseract', image_path, 'stdout', '-l', 'chi_sim+eng'],
capture_output=True, text=True, timeout=30
)
if result.returncode == 0:
print("OCR Result (system tesseract):")
print(result.stdout)
else:
print(f"Tesseract error: {result.stderr}")
except FileNotFoundError:
print("System tesseract not found either")
except Exception as e:
print(f"Error running tesseract: {e}")
# If nothing works, try reading raw pixels to detect if it's a text screenshot
try:
from PIL import Image
img = Image.open(image_path)
# Print first few pixel values to understand the image
pixels = list(img.getdata())[:20]
print(f"\nFirst 20 pixel values: {pixels}")
except:
pass