Last active
September 8, 2021 00:29
-
-
Save zuphilip/7f6026e863b03e94121d073b0774e9b6 to your computer and use it in GitHub Desktop.
Tesseract IPython Notebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tesseract-ocr | |
tesseract-ocr-deu | |
tesseract-ocr-script-latn | |
tesseract-ocr-script-frak | |
libtesseract-dev | |
ocrmypdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"try:\n", | |
" from PIL import Image\n", | |
"except ImportError:\n", | |
" import Image\n", | |
"\n", | |
"import pytesseract" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"LooseVersion ('4.0.0-beta.1')" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pytesseract.get_tesseract_version()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"print(pytesseract.image_to_string(Image.open('test.png')))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Usage:\r\n", | |
" tesseract --help | --help-extra | --version\r\n", | |
" tesseract --list-langs\r\n", | |
" tesseract imagename outputbase [options...] [configfile...]\r\n", | |
"\r\n", | |
"OCR options:\r\n", | |
" -l LANG[+LANG] Specify language(s) used for OCR.\r\n", | |
"NOTE: These options must occur before any configfile.\r\n", | |
"\r\n", | |
"Single options:\r\n", | |
" --help Show this help message.\r\n", | |
" --help-extra Show extra help for advanced users.\r\n", | |
" --version Show version information.\r\n", | |
" --list-langs List available languages for tesseract engine.\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!tesseract -h" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"List of available languages (2):\r\n", | |
"osd\r\n", | |
"eng\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!tesseract --list-langs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pytesseract |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment