Generates text from image
Project description
shiftlab_ocr
SHIFT OCR is a library fo handwriting text segmentation and character recognition.
Get Started
Doc2Text
it transcribes an image into text
pip install shiftlab_ocr
from shiftlab_ocr import Scanner
PATH_TO_IMAGE = 'test.jpg'
scanner = Scanner(ocr_model='hw-cyr')
result = scanner.doc2text(PATH_TO_IMAGE)
('Директору Заявление 10 январе 2019г. Ирл Иванов А.П. ',
[<shift_ocr.crop.Crop at 0x7f158cffd1d0>,
<shift_ocr.crop.Crop at 0x7f158cffd610>,
<shift_ocr.crop.Crop at 0x7f158cffd790>,
<shift_ocr.crop.Crop at 0x7f158cffd8d0>,
<shift_ocr.crop.Crop at 0x7f158cffdd50>,
<shift_ocr.crop.Crop at 0x7f158cffd910>])
Generator of handwriting
It generates handwriting script with random backgrounds and handwriting fonts with given list of strings
from shiftlab_ocr import Generator
g = Generator(lang='ru')
g.upload_source('/content/source.txt')
s = g.generate_from_string('Москва',min_length=4,max_length=24) # get from a string
s
b = g.generate_batch(12,4,13) # get batch of random samples from source.txt
fig=plt.figure(figsize=(10, 10))
rows = int(len(b)/4) + 2
columns = int(len(b)/8) + 2
for i in range(len(b)):
fig.add_subplot(rows, columns, i+1)
plt.imshow(np.asarray(b[i][0]))
Also, see Google Colab Demo
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for shiftlab_ocr-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c9d7dad85765b4de5c77102527db0e53dfbd4322f8fec091b9ec1dad938364 |
|
MD5 | 56cc0991b32de7ed220c1231e519a241 |
|
BLAKE2b-256 | 96becb8920d33927c9f3900bf071103decb492dce02c6c97bb8426b4c9e7a63e |