Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
"""
|
|
Debug visualization to see what the AI detected
|
|
"""
|
|
|
|
import cv2
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def visualize_detection(image_path: Path, analysis_json_path: Path, output_path: Path):
|
|
"""
|
|
Zeichne Bounding Boxes auf das Bild um zu sehen was die AI erkannt hat
|
|
"""
|
|
# Load image
|
|
img = cv2.imread(str(image_path))
|
|
if img is None:
|
|
print(f"❌ Cannot load image: {image_path}")
|
|
return
|
|
|
|
# Load analysis
|
|
with open(analysis_json_path, 'r', encoding='utf-8') as f:
|
|
analysis = json.load(f)
|
|
|
|
# Draw handwriting regions in RED
|
|
hw_regions = analysis.get('handwriting_regions', [])
|
|
for i, region in enumerate(hw_regions, 1):
|
|
bbox = region.get('bounding_box', {})
|
|
x, y, w, h = bbox.get('x', 0), bbox.get('y', 0), bbox.get('width', 0), bbox.get('height', 0)
|
|
|
|
if w > 0 and h > 0:
|
|
# Draw rectangle
|
|
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 3)
|
|
|
|
# Draw label
|
|
label = f"HW{i}: {region.get('type')} ({region.get('color_hint')})"
|
|
cv2.putText(img, label, (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 255), 2)
|
|
|
|
# Draw diagram regions in GREEN
|
|
diagrams = analysis.get('layout', {}).get('diagram_elements', [])
|
|
for i, diagram in enumerate(diagrams, 1):
|
|
bbox = diagram.get('bounding_box', {})
|
|
x, y, w, h = bbox.get('x', 0), bbox.get('y', 0), bbox.get('width', 0), bbox.get('height', 0)
|
|
|
|
if w > 0 and h > 0:
|
|
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
|
|
label = f"DIAGRAM{i}"
|
|
cv2.putText(img, label, (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
|
|
|
|
# Save
|
|
cv2.imwrite(str(output_path), img)
|
|
print(f"✅ Debug visualization saved: {output_path}")
|
|
print(f" 📍 {len(hw_regions)} handwriting regions (RED)")
|
|
print(f" 📍 {len(diagrams)} diagram regions (GREEN)")
|
|
|
|
if __name__ == "__main__":
|
|
eingang = Path.home() / "Arbeitsblaetter" / "Eingang"
|
|
bereinigt = Path.home() / "Arbeitsblaetter" / "Bereinigt"
|
|
|
|
image_file = "2025-12-11_Auge1.JPG"
|
|
|
|
visualize_detection(
|
|
eingang / image_file,
|
|
bereinigt / "2025-12-11_Auge1_analyse.json",
|
|
bereinigt / "2025-12-11_Auge1_DEBUG.jpg"
|
|
)
|