{ "info": { "author": "Emilio Cecchini", "author_email": "cecchini.mle@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "**************************\ngpyocr (Google-Python-OCR)\n**************************\n\n.. image:: https://img.shields.io/pypi/v/gpyocr.svg\n :target: https://pypi.org/project/gpyocr\n\n.. image:: https://img.shields.io/pypi/l/gpyocr.svg\n :target: https://pypi.org/project/gpyocr\n\n.. image:: https://img.shields.io/pypi/pyversions/gpyocr.svg\n :target: https://pypi.org/project/gpyocr/\n\n.. image:: https://travis-ci.org/ceccoemi/gpyocr.svg?branch=master\n :target: https://travis-ci.org/ceccoemi/gpyocr\n\n.. image:: https://codecov.io/gh/ceccoemi/gpyocr/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/ceccoemi/gpyocr\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/python/black\n\n\n\nPython wrapper for `Tesseract OCR `_ and `Google Vision OCR `_ to perform OCR on images and get a confidence value of the results.\n\nBoth OCR engines are Google's products. Tesseract is an open source software that needs some tweaks to get good results, especially if performed on images with poorly defined text. Google Vision OCR engine is a commercial product with much better performance, allowing you to skip the pre-processing jobs on the images.\n\nOnly Python >= 3.6 is supported.\n\nUsage\n#####\n\nThe ``gpyocr`` module have two main functions:\n\n- ``tesseract_ocr(image, lang='', psm=None, config='')``: it returns a tuple\n (*text*, *confidence*) obtained with Tesseract. The parameters are the same of\n the `command-line Tesseract tool `_\n except for the output file.\n- ``google_vision_ocr(image, langs=None)``: it returns a tuple\n (*text*, *confidence*) obtained with Google Vision API. The `langs` parameter\n is a list of languages to look for during the OCR process. More information\n about the supported languages are described on\n `this page `_\n\n\nThe parameter ``image`` could be:\n\n* a string containing the path to the image file\n* a numpy object (OpenCV)\n* an Image object (Pillow/PIL)\n\n\nIt is possible to get some information about the Tesseract and Google Vision\nversions found in the system with ``get_tesseract_version()`` and\n``get_google_vision_version()`` respectively.\n\nThe installation of the package also provides a command-line tool, please run\n\n.. code-block::\n\n $ gpyocr --help\n\nfor more information.\n\n\nExamples\n########\n\nExamples to read the text in the image ``tests/resources/european-test.png``\non this repository.\n\n.. code-block:: python\n\n >>> import gpyocr\n\n >>> gpyocr.tesseract_ocr('tests/resources/european-test.png')\n ('The (quick) [brown] {fox} ... ', 87.13636363636364)\n\n >>> gpyocr.google_vision_ocr('tests/resources/european-test.png')\n ('The (quick) [brown] {fox} ... ', 98.00000190734863)\n\n >>> import cv2 # support for OpenCV library\n >>> image = cv2.imread('tests/resources/european-test.png')\n >>> gpyocr.tesseract_ocr(image)\n ('The (quick) [brown] {fox} ... ', 87.13636363636364)\n\n >>> from PIL import Image # support for Pillow library\n >>> image = Image.open('tests/resources/european-test.png')\n >>> gpyocr.tesseract_ocr(image)\n ('The (quick) [brown] {fox} ... ', 87.13636363636364)\n\n >>> gpyocr.tesseract_ocr(\n 'tests/resources/european-test.png'),\n lang='ita',\n psm=7,\n config='tessedit_char_whitelist=abc',\n )\n ('bc aa cb b c a ... ', 18.5)\n\n >>> gpyocr.google_vision_ocr(\n 'tests/resources/european-test.png', langs=['en', 'it']\n )\n ('The (quick) [brown] {fox} ... ', 87.13636363636364)\n\nPlease see the unit tests for more examples.\n\n\nInstallation\n############\n\n``gpyocr`` is a pip package available in the Python Package Index.\nTo install it in your Python environment run:\n\n.. code-block::\n\n $ pip install gpyocr\n\nIf you want to run Tesseract with gpyocr you have to install it in your\nsystem. In order to get the confidence value, gpyocr needs Tesseract >= 3.05.\nYou could install Tesseract with the bash script `tesseract_installer.sh` that\nyou find in the repository. If you want Tesseract 3.05 (the suggested version)\nthen run:\n\n.. code-block::\n\n $ sudo ./tesseract_installer.sh 3.05\n\nIf you want to try Tesseract 4.1.0 then run:\n\n.. code-block::\n\n $ sudo ./tesseract_installer.sh 4.1.0\n\n**Note**: this bash script is tested in Ubuntu 18.04 and CentOS 7; if you\ndon't have these systems, there may be problems installing some dependencies.\nYou could install all the dependencies by your self and then run:\n\n.. code-block::\n\n $ sudo ./tesseract_installer.sh 3.05 --no-dependencies\n\n\nTo use Google Cloud Vision API, you have to authenticate with\n\n.. code-block::\n\n $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json\n\nPlease refer to\n`their documentation `_ for\nmore information about installing and using Google Cloud Vision services.\n\nLicense\n#######\n\nApache 2.0\n\nTesting\n#######\n\nFirst, install ``pytest``, ``pytest-cov`` and ``pytest-mock``. You could\ninstall them with ``pip install -r requirements.txt``.\n\nGo to the root directory of this repository.\n\nTo run unit tests without using the OCR libraries run:\n\n.. code-block::\n\n $ pytest\n\nTo run unit tests using the OCR libraries run:\n\n.. code-block::\n\n $ pytest --nomock\n\nTo get a coverage report, run\n\n.. code-block::\n\n $ pytest --cov --cov-report term-missing\n\nTo test only the Tesseract functions run:\n\n.. code-block::\n\n $ pytest -m tesseract\n\nTo test only the Google Cloud Vision functions run:\n\n.. code-block::\n\n $ pytest -m googlevision\n\nHow to contribute\n#################\n\nThis project is developed to be used by a specific application, so it is not\nvery versatile. If you wish to have new features or if you have any kind of\nproblems, please feel free to contact me via e-mail or open an issue here on\nGitHub.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ceccoemi/gpyocr", "keywords": "OCR tesseract google vision wrapper", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "gpyocr", "package_url": "https://pypi.org/project/gpyocr/", "platform": "", "project_url": "https://pypi.org/project/gpyocr/", "project_urls": { "Homepage": "https://github.com/ceccoemi/gpyocr" }, "release_url": "https://pypi.org/project/gpyocr/1.4/", "requires_dist": [ "opencv-python", "Pillow", "google-cloud-vision" ], "requires_python": "", "summary": "Python wrapper for Tesseract OCR and Google Vision OCR", "version": "1.4" }, "last_serial": 5441755, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "0f5f1d137964f75f3af753cfff8d0a86", "sha256": "ca06878501c350d74c13a206cce19f1d58af3a49b04ef37323e2bfec8f8fd715" }, "downloads": -1, "filename": "gpyocr-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0f5f1d137964f75f3af753cfff8d0a86", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9521, "upload_time": "2018-07-26T21:55:17", "url": "https://files.pythonhosted.org/packages/b7/f5/1db8e5a5545e7db01af2b9a5872234346323cd47853ee5a6ffd52391569c/gpyocr-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bcf01e1c2540f9d0e6a42a34aaa9ba3a", "sha256": "1007c06d00554640cb8c713c427e359b13be526dea3c4b95b892d82d943ea703" }, "downloads": -1, "filename": "Gpyocr-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bcf01e1c2540f9d0e6a42a34aaa9ba3a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6457, "upload_time": "2018-07-26T22:09:06", "url": "https://files.pythonhosted.org/packages/6a/0e/e07b73c649efac72d5b662a3177767c4cb39e3de7b4e00409c0d6b5e06a6/Gpyocr-0.2-py2.py3-none-any.whl" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "a1ae9f7da1e413721090f7be30a3af9d", "sha256": "f86640b1f89fd0759a7c9deb9a7cdc0bc0d02839f2d35d8c928d8cd7f9249203" }, "downloads": -1, "filename": "Gpyocr-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a1ae9f7da1e413721090f7be30a3af9d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6455, "upload_time": "2018-07-27T13:54:01", "url": "https://files.pythonhosted.org/packages/62/e8/e22b0fcebadf0fa1bc40675cf6cadf01e08a0ab7fb5110b5b0238421fa24/Gpyocr-0.3-py2.py3-none-any.whl" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "b0925203125d74a754ee0d7a697cfac7", "sha256": "d6993d7ab5ed885e15f72371447ff928225e56a92bec14e5f580109838634a75" }, "downloads": -1, "filename": "Gpyocr-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b0925203125d74a754ee0d7a697cfac7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6501, "upload_time": "2018-09-07T13:59:02", "url": "https://files.pythonhosted.org/packages/16/96/8037d04ed7679862074ca05888d767df0648f577bbc9f609e1e2334798e3/Gpyocr-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d4651b045db754eac3bdb7c127c9e146", "sha256": "a3271fc972b0738c560f325b96b8d264a42e705daaee2187d368d6ffff3c424f" }, "downloads": -1, "filename": "Gpyocr-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d4651b045db754eac3bdb7c127c9e146", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6720, "upload_time": "2018-09-08T10:47:06", "url": "https://files.pythonhosted.org/packages/64/82/428862eb96deab4f405952101f4edc35a95407cc0625a8b1715947a464a2/Gpyocr-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "07af9f52dc86294061070c9e910603d1", "sha256": "c93a7fb8fdf9eae85035a4b0df70248eef087e35345452cb9d3a98774b5cd6e1" }, "downloads": -1, "filename": "Gpyocr-0.4.tar.gz", "has_sig": false, "md5_digest": "07af9f52dc86294061070c9e910603d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9758, "upload_time": "2018-09-07T13:59:05", "url": "https://files.pythonhosted.org/packages/5c/5c/3fcfd8e9e61b4e2ee61893494c31beb0c943a82c2307b56aa57d06093675/Gpyocr-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "95eaba12492cd3a47be18c0efeca27c9", "sha256": "244bb67a8f06e2cca4cf75e08488734a5e335fde0a7bf66f8d234827d6eb1dc4" }, "downloads": -1, "filename": "Gpyocr-0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "95eaba12492cd3a47be18c0efeca27c9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6723, "upload_time": "2018-09-08T10:47:08", "url": "https://files.pythonhosted.org/packages/dc/c1/f29275425bfe126b0fb14948d023c887da131e5527bcf60512ddc5e56101/Gpyocr-0.5-py3-none-any.whl" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "1540d1bdc7475dc0e3f44ac06316d629", "sha256": "3f64b3893553cf988080e70937811809b74888f770cd132873e57c5039281e1f" }, "downloads": -1, "filename": "gpyocr-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1540d1bdc7475dc0e3f44ac06316d629", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11078, "upload_time": "2019-02-18T12:15:10", "url": "https://files.pythonhosted.org/packages/76/d0/126487dc22b19dc1da74b122583e3a65728b9252f1576e789cad538c1e71/gpyocr-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4aecc4257019b47f81c15fc8a1da9664", "sha256": "363831a04b68ac1f453ee11ea786ae26105b5817545ee1b22aeed1dec7f34c1b" }, "downloads": -1, "filename": "Gpyocr-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4aecc4257019b47f81c15fc8a1da9664", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11080, "upload_time": "2019-02-18T12:10:29", "url": "https://files.pythonhosted.org/packages/15/dd/114e998aeaa4d2744f8ea3873c36c3fec7eb739bda22a2b724b168433f28/Gpyocr-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "608a4aef4980730717728589fea4b700", "sha256": "ef565377eac318737ef47ffffc8a122ea59accd105e1ce266cdde39b7f563c12" }, "downloads": -1, "filename": "Gpyocr-1.0.tar.gz", "has_sig": false, "md5_digest": "608a4aef4980730717728589fea4b700", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10413, "upload_time": "2019-02-18T12:10:31", "url": "https://files.pythonhosted.org/packages/18/12/3579c30359200acaee90460b09ee851aaba703a39e3e9849e4d78eeb9baa/Gpyocr-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "96af18d95b3884be44eb50787cbd4129", "sha256": "0584e6fe78772100cfed8d934ebbba95cdb69d2a73431cb283b1781c3203c348" }, "downloads": -1, "filename": "gpyocr-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "96af18d95b3884be44eb50787cbd4129", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11078, "upload_time": "2019-02-18T12:16:25", "url": "https://files.pythonhosted.org/packages/29/fc/2d4fe868b200fe76cfd83b286778c3339ee9619af8d86b20ec89a67fcd43/gpyocr-1.1-py3-none-any.whl" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "fc76eaec3eedc031b1968b698f1069bd", "sha256": "47c574f977554193dfb36c3d64ee9006293a32e38996dcdc25ca23dcc5210a40" }, "downloads": -1, "filename": "gpyocr-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "fc76eaec3eedc031b1968b698f1069bd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11085, "upload_time": "2019-02-18T12:27:44", "url": "https://files.pythonhosted.org/packages/ad/dc/f5f0f0a316c2ffa30982178866387cef08b0acc28869773e47cc5b2927ab/gpyocr-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0161a04c2fffe77d38b2210988fb3fdd", "sha256": "29f9d0051b265002bd4c5f9119cbb79990ccee06af146ef2a4463ed8ffcb4359" }, "downloads": -1, "filename": "gpyocr-1.2.tar.gz", "has_sig": false, "md5_digest": "0161a04c2fffe77d38b2210988fb3fdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10315, "upload_time": "2019-02-18T12:27:46", "url": "https://files.pythonhosted.org/packages/dd/9b/214d07dec31c55dd8f07e69d47572fed75909452483f31c07b93e1460b92/gpyocr-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "4d981b8820bc6de5786bb37480040958", "sha256": "c1fab86b9121ab2e78376c831c84613b3a29a1153b9673faab37166cc9877aea" }, "downloads": -1, "filename": "gpyocr-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4d981b8820bc6de5786bb37480040958", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11084, "upload_time": "2019-02-18T12:31:43", "url": "https://files.pythonhosted.org/packages/f9/b8/cbb6d89e3e74431574bf3f3a5016981becc49256d7a3df0f26f45d0f4b5f/gpyocr-1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7623fa0cc4fbf0019c200cfbc7f2a62d", "sha256": "84c7965193e23c99a253b4fb9049eaddf6ca87cebe293ebfe1bab87de24a77b4" }, "downloads": -1, "filename": "gpyocr-1.3.tar.gz", "has_sig": false, "md5_digest": "7623fa0cc4fbf0019c200cfbc7f2a62d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10318, "upload_time": "2019-02-18T12:31:44", "url": "https://files.pythonhosted.org/packages/87/63/a20e8754281935174d57b7b357501780bd958420f9beb3dd71fbf92e1b5f/gpyocr-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "d2a0e08f5d0e438abb526a9ea780e1e7", "sha256": "6ab84ccd7439670e076d3423cd81dc30703f700aa0646356bb164c4635b7ca7e" }, "downloads": -1, "filename": "gpyocr-1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a0e08f5d0e438abb526a9ea780e1e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11124, "upload_time": "2019-06-24T17:25:58", "url": "https://files.pythonhosted.org/packages/2f/cc/a8a4031ffdcfd1860d8ba4f59e33c8c56f9d0fc6d8f96dcf2a9ec39919a7/gpyocr-1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64cae99be43745e7e7bc7b6ebcd8e8d1", "sha256": "a6db83b8bacd55e870b187ef01243b16d8b329e63d96ed2bf1e255aff7f642fc" }, "downloads": -1, "filename": "gpyocr-1.4.tar.gz", "has_sig": false, "md5_digest": "64cae99be43745e7e7bc7b6ebcd8e8d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10374, "upload_time": "2019-06-24T17:26:00", "url": "https://files.pythonhosted.org/packages/ce/5f/648b1da2f8ed1630733ad24947bbe925915a2ea04e55755a21e5af882a63/gpyocr-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d2a0e08f5d0e438abb526a9ea780e1e7", "sha256": "6ab84ccd7439670e076d3423cd81dc30703f700aa0646356bb164c4635b7ca7e" }, "downloads": -1, "filename": "gpyocr-1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a0e08f5d0e438abb526a9ea780e1e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11124, "upload_time": "2019-06-24T17:25:58", "url": "https://files.pythonhosted.org/packages/2f/cc/a8a4031ffdcfd1860d8ba4f59e33c8c56f9d0fc6d8f96dcf2a9ec39919a7/gpyocr-1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64cae99be43745e7e7bc7b6ebcd8e8d1", "sha256": "a6db83b8bacd55e870b187ef01243b16d8b329e63d96ed2bf1e255aff7f642fc" }, "downloads": -1, "filename": "gpyocr-1.4.tar.gz", "has_sig": false, "md5_digest": "64cae99be43745e7e7bc7b6ebcd8e8d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10374, "upload_time": "2019-06-24T17:26:00", "url": "https://files.pythonhosted.org/packages/ce/5f/648b1da2f8ed1630733ad24947bbe925915a2ea04e55755a21e5af882a63/gpyocr-1.4.tar.gz" } ] }