ocrlib
Uso simples
from ocr_stream import File, TextRecognized, RecognizeImage, RecognizePdf
passo 1:
instânciar o objeto para reconhecer texto, utilizando o caminho do tesseract
tess: File = File('/usr/bin/tesseract') # Substitua pelo tesseract do seu sistema ocr = RecognizeImage.create(path_tesseract=tess)
passo 2:
instânciar um arquivo de imagem para extrair o texto.
image: File = File('path/to/file.png')
passo 3:
extrair o texto
text: str = ocr.image_to_string(image) print(text)
passo 4 opcional:
você pode salvar um arquivo PDF com o texto extraido
output_file: File = File('path/to/save.pdf') recognized: TextRecognized = ocr.image_recognize(image) recognized.to_document().to_file_pdf(output_file)
passo 5 opcional:
você pode salvar uma planilha com o texto da imagem
output_excel: File = File('path/to/file.xlsx') recognized: TextRecognized = ocr.image_recognize(image) recognized.to_document().to_excel(output_excel)
Metadata
Release files for ocr-stream 2.5.2
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_stream-2.5.2.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ocr_stream-2.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / ocr_stream-2.5.2.tar.gz
| Download URL | ocr_stream-2.5.2.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17c9ec70ce22e1ba85459be58e086d0ca1e512ee1b703a3f382243d08f6ef562
|
|
BLAKE2b-256 checksum How to use checksums |
c564e8d99215f5cc1fb5345acdc90c414af078f5da6882f88212f466f4022196
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / ocr_stream-2.5.2-py3-none-any.whl
| Download URL | ocr_stream-2.5.2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8915365ca103a5669bfbc060a432410984b4b678d525589047174fc4b4200534
|
|
BLAKE2b-256 checksum How to use checksums |
786a1c0e822995a88af1b610282fac9c535b1a7d120211c706b72154dcf0b773
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|