Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .venv-1/bin/python
1 change: 1 addition & 0 deletions .venv-1/bin/python3
1 change: 1 addition & 0 deletions .venv-1/bin/python3.12
1 change: 1 addition & 0 deletions .venv-1/lib64
5 changes: 5 additions & 0 deletions .venv-1/pyvenv.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
home = /usr/bin
include-system-site-packages = false
version = 3.12.3
executable = /usr/bin/python3.12
command = /usr/bin/python3 -m venv /workspaces/Soter/.venv-1
1 change: 1 addition & 0 deletions .venv/bin/python
1 change: 1 addition & 0 deletions .venv/bin/python3
1 change: 1 addition & 0 deletions .venv/bin/python3.12
1 change: 1 addition & 0 deletions .venv/lib64
5 changes: 5 additions & 0 deletions .venv/pyvenv.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
home = /usr/bin
include-system-site-packages = false
version = 3.12.3
executable = /usr/bin/python3.12
command = /usr/bin/python3 -m venv /workspaces/Soter/.venv
61 changes: 61 additions & 0 deletions tmp_ocr_inspect.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "04410dbd",
"metadata": {},
"source": [
"# OCR Golden Input Inspection\n",
"\n",
"Use this notebook to inspect the existing `app/ai-service/test_id_card.png` image and extract tesseract text plus bounding boxes for expected OCR golden inputs.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9b89948f",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "e00de119",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "3746ce6d",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"from PIL import Image\n",
"import pytesseract\n",
"from pytesseract import Output\n",
"\n",
"image_path = Path('app/ai-service/test_id_card.png')\n",
"img = Image.open(image_path)\n",
"data = pytesseract.image_to_data(img, output_type=Output.DICT)\n",
"\n",
"for i, text in enumerate(data['text']):\n",
" if text.strip():\n",
" print(i, repr(text), data['conf'][i], data['left'][i], data['top'][i], data['width'][i], data['height'][i])\n",
"\n",
"print('\\n--- summary ---')\n",
"print('\\n'.join([text for text in data['text'] if text.strip()]))\n"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}