Skip to main content

A package used for OCR.

Project description

QQOcr

A package used for simple OCR.


Examples are as follows:

For learn:

from qqocr import QQOcr

# You must provide a method to binarize the characters in the picture 
# and import the external library in the function.
def binary(image):
    import numpy as np
    import cv2

    low_range = np.array([0, 0, 0][::-1])
    high_range = np.array([100, 100, 100][::-1])
    return cv2.inRange(image, low_range, high_range)

qq = QQOcr()
# Dataset folder consists of many pictures and a 'label.txt'.
# For 'label.txt', the format of each line is "[filename]\t[text]".
# For example, it can be: "1.png   12345".
qq.load_dataset('./dataset')
qq.set_binary(binary)
qq.learn()
# The suffix must be '.qmodel'.
qq.save_model('./1.qmodel')

For predict:

from qqocr import QQOcr
import cv2

qq = QQOcr()
qq.load_model('./1.qmodel')
text = qq.predict(cv2.imread('test.png'))
print(text)

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

qqocr-0.3.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

qqocr-0.3.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file qqocr-0.3.1.tar.gz.

File metadata

  • Download URL: qqocr-0.3.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.8

File hashes

Hashes for qqocr-0.3.1.tar.gz
Algorithm Hash digest
SHA256 877bf353e32db56c14d97b05e5bb9ad9f0d4d87536e42b903bb26d6c9a8a4ec8
MD5 7f1fb5eef977a49b6b8d7c6ec0acc68f
BLAKE2b-256 88ccbb2c25c43973e62f5a0ea2de642720176538dbb369a5a9736bc6144c0be3

See more details on using hashes here.

File details

Details for the file qqocr-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: qqocr-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.8

File hashes

Hashes for qqocr-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39ff04d378c02aff280831d24049e94a386fa994c0ad4e25f4744e25d2243e4
MD5 8d5afada0870e6a276370d5e59bc791d
BLAKE2b-256 dbf2e569b9db94f65a3c75113b5bf44ab34930d5f033f49c4633d8dd615a4da1

See more details on using hashes here.

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