Skip to main content

ocr for recognizing text on computer screen

Project description

# ocrscreen

ocr for recognizing text on computer screen

## Install ` pip install ocrscreen `

## Use

To create recognition database you need to create few (tens to hundreds) training samples in form of file pairs: png image file containing image of one line of text, and text file containing same line of text. Image and text should have same name except extension: .png for image and .gt.txt for text. Each character you want to recognize should be present in at least three samples.

If you have samples you can convert it into database with this command:

` ocrscreen-learn path/to/samples -o path/to/database `

Recognintion database is a list of directories, each directory contains .png files (one or many) representing character and .id file with text containing character (to avoid filesystem limitations). Directory name and file name does not matter. This form allows easy tuning and troubleshooting recognition problems.

When you have database you can run ocr on image

` ocrscreen-recognize -d path/to/database -i path/to/image `

or on screen ` ocrscreen-recognize -d path/to/database --screen `

or on portion of screen with –rect x y w h

` ocrscreen-recognize -d path/to/database --screen --rect 10 10 640 480 `

Inspect samples and database directory in the sources to get better understanding of data format.

## Notes

This ocr uses black and white bitmaps as search pattern to search on binarized image and only perfect equality counts as match. It doesn’t use dpi and neural networks, it cannot recognize scanned text or text in photo images, it is only for recognizing perfect digital text.

If you have linux and wayland you need to install pyscreenshot package. ` pip install pyscreenshot `

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocrscreen-0.0.5.tar.gz (136.9 kB view hashes)

Uploaded Source

Built Distributions

ocrscreen-0.0.5-cp311-cp311-win_amd64.whl (83.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

ocrscreen-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (556.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

ocrscreen-0.0.5-cp310-cp310-win_amd64.whl (84.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

ocrscreen-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (528.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

ocrscreen-0.0.5-cp39-cp39-win_amd64.whl (95.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

ocrscreen-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (537.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page