From a2ee04bb90359f7b4d397de31da0ac038acc9424 Mon Sep 17 00:00:00 2001 From: ItaloBorrelli Date: Wed, 21 May 2025 16:55:23 -0700 Subject: [PATCH] Content --- .gitignore | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 13 +++++++ requirements.in | 7 ++++ requirements.txt | 42 +++++++++++++++++++++++ runtime.txt | 1 + 5 files changed, 151 insertions(+) create mode 100644 .gitignore create mode 100644 main.py create mode 100644 requirements.in create mode 100644 requirements.txt create mode 100644 runtime.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a118f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,88 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# IDE-specific files +.idea/ +.vscode/ +*.swp +*.swo + +# Personal settings +*.tmproj +*.sublime-project +*.sublime-workspace + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Logs and databases +*.log +*.sqlite +*.db + +# Other +*.bak +*.orig +*.tar.gz +*.zip +*.tar.bz2 +*.tar.xz +*.rar +*.7z +*.dmg +*.iso +*.lzma +*.whl + diff --git a/main.py b/main.py new file mode 100644 index 0000000..93c085c --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +import pytesseract +from pytesseract import Output +import cv2 +img = cv2.imread('image.jpg') + +d = pytesseract.image_to_data(img, output_type=Output.DICT) +n_boxes = len(d['level']) +for i in range(n_boxes): + (x, y, w, h) = (d['left'][i], d['top'][i], d['width'][i], d['height'][i]) + cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2) + +cv2.imshow('img', img) +cv2.waitKey(0) diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..7fc5c21 --- /dev/null +++ b/requirements.in @@ -0,0 +1,7 @@ +pytesseract +opencv-python +numpy +pillow +flake8 +black +isort diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..85d213c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,42 @@ +# +# This file is autogenerated by pip-compile with Python 3.13 +# by the following command: +# +# pip-compile requirements.in +# +black==25.1.0 + # via -r requirements.in +click==8.2.1 + # via black +flake8==7.2.0 + # via -r requirements.in +isort==6.0.1 + # via -r requirements.in +mccabe==0.7.0 + # via flake8 +mypy-extensions==1.1.0 + # via black +numpy==2.2.6 + # via + # -r requirements.in + # opencv-python +opencv-python==4.11.0.86 + # via -r requirements.in +packaging==25.0 + # via + # black + # pytesseract +pathspec==0.12.1 + # via black +pillow==11.2.1 + # via + # -r requirements.in + # pytesseract +platformdirs==4.3.8 + # via black +pycodestyle==2.13.0 + # via flake8 +pyflakes==3.3.2 + # via flake8 +pytesseract==0.3.13 + # via -r requirements.in diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..b50f9b0 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.13.3