OCR_with_format
- simple wrapper that postprocesses pytesseract's hOCR output to maintain format and spacings.
- Link to an alternative implementation found on stackoverflow
How to
- install
python -m pip install OCR_with_format - see usage
OCR_with_format --help(executing withpython -mis not supported)
Usage
NAME
OCR_with_format
SYNOPSIS
OCR_with_format IMG_PATH <flags>
POSITIONAL ARGUMENTS
IMG_PATH
Type: str
path to the image you want to do OCR on
FLAGS
-m, --method=METHOD
Type: str
Default: 'with_format'
if 'with_format', will use the author's code if 'none', will output tesseract's default output if 'stackoverflow', will output using another algorithm found on stackoverflow
--thresholding_method=THRESHOLDING_METHOD
Type: str
Default: 'otsu'
any from "otsu", "otsu_gaussian", "adaptative_gaussian", "all"
If "all", the three methods will be tried and the final output will be the one which maximizes the mean and median confidences over each parsed words.
-l, --language=LANGUAGE
Type: str
Default: 'eng'
language to look for in the image
-o, --output_path=OUTPUT_PATH
Type: Optional[str]
Default: None
if not None, will output to this path and erase its previous content.
--tesseract_args=TESSERACT_ARGS
Type: str
Default: '-...
default arguments for tesseract
-q, --quiet=QUIET
Default: False
if True, will only print the output and no logs
NOTES
You can also use flags syntax for POSITIONAL ARGUMENTS
Example
- Image:
- output from
OCR_with_format ./screenshot.png --thresholding_method="all" --quiet
@Unwateh (1) ~ Fork (3) (©
OCR_with_format [ Pir ][ | [ & <) [ s -]
About
&
Wrapper around pytesseract to
¥ Branches © Tags postprocess in a way that preserves
spacing and formattings.
i thiswillbeyourgithub addded license 10 minutes ago O 4
&5 GPL-3.0 license
@ LICENSE addded license 10 minutes ago - Activity
[u] __init__.py minor 11 minutes ago ¢ Ostars
[u] requirements.txt added empty requirements 11 minutes ago <& 1 watching
Y Oforks
Help people interested in this repository understand your project by
adding a README. Releases
Create No releases a new published release
Packages
No packages published
Publish your first package
Languages
———
® Python 100.0%
- output from
OCR_with_format ./screenshot.png --quiet --comparison_run*
OCR_with_format
[ pin | [ @unwateh (@) ~ | [ & Fork (O)
-] [ ¢ s (0
¥ main ~
¥ Branches © Tags
Wrapper around pytesseract to
postprocess in a way that preserves
. . . spacing and formattings.
- thiswillbeyourgithub addded license 10 minutes ago 'O 4
&5 GPL-3.0 license
@ LICENSE addded license 10 minutes ago A Activity
0O _init__py minor 11 minutes ago ¢ Ostars
O requirements.txt added empty requirements 11 minutes ago | @ 1watching
% 0forks
Help people interested in this repository understand your project by
adding a README. Releases
No releases published
Create a new release
Packages
No packages published
Publish your first package
Languages
————
@ Python 100.0%
Release files for OCR-with-format 0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ocr_with_format-0.14.tar.gz | 19.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ocr_with_format-0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.1 kB
Release files / ocr_with_format-0.14.tar.gz
| Download URL | ocr_with_format-0.14.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c3caa52ae3eae598bbe5d958b977e113a888db0e6a1e6e1fd1e579f3a1b945a
|
|
BLAKE2b-256 checksum How to use checksums |
ef5f18687fb1d2983794e0701dadacf0493db8e78f025403f50bfc2c9496e453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.14
|
Release files / ocr_with_format-0.14-py3-none-any.whl
| Download URL | ocr_with_format-0.14-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91099aa095bf4ea5a6c07ad21758a8f6fb2e150127f0b7977f4ecf7e48187746
|
|
BLAKE2b-256 checksum How to use checksums |
9398fcefd89786355b5c97c29fb4faaa0540aa523db9dd598c3f60a9a1301ef5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.14
|