Add delete event, perspective correction OCR, and OCR crop display

- Delete event: POST /event/{id}/delete removes DB row + files
- Perspective correction: minAreaRect on white plate region → getPerspectiveTransform
  gives a flat frontal view of the plate (e.g. 'GR B38 WR' instead of trapezoid)
- Tesseract now scales image 3x before OCR and skips EU blue strip (left 11%)
- Saves plate_ocr.jpg (perspective-corrected + enhanced crop actually fed to OCR)
- Event detail shows both raw detection crop and OCR crop side by side
- Manual plate edit form in event detail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
perco
2026-06-02 18:05:10 +02:00
co-authored by Claude Sonnet 4.6
parent 13e6038069
commit accbae41ce
5 changed files with 157 additions and 46 deletions
+7
View File
@@ -107,6 +107,13 @@ def get_event(event_id: str) -> dict | None:
return dict(row) if row else None
def delete_event(event_id: str):
conn = get_db()
conn.execute("DELETE FROM events WHERE id = ?", (event_id,))
conn.commit()
conn.close()
def update_plate(event_id: str, plate: str):
conn = get_db()
conn.execute("UPDATE events SET plate = ? WHERE id = ?", (plate.strip().upper() or None, event_id))