{"id":14037042,"url":"https://github.com/verifid/mocr","last_synced_at":"2025-07-13T02:32:59.881Z","repository":{"id":41512277,"uuid":"158028286","full_name":"verifid/mocr","owner":"verifid","description":"Meaningful Optical Character Recognition from identity cards with Deep Learning.","archived":false,"fork":false,"pushed_at":"2021-02-20T22:16:46.000Z","size":94599,"stargazers_count":26,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T09:49:02.740Z","etag":null,"topics":["cards","computer-vision","deep-learning","face-detection","identity","opencv","optical-character-recognition","tessaract"],"latest_commit_sha":null,"homepage":"https://mocr.verifid.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/verifid.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-17T21:56:31.000Z","updated_at":"2024-05-01T19:57:56.000Z","dependencies_parsed_at":"2022-08-26T04:21:22.914Z","dependency_job_id":null,"html_url":"https://github.com/verifid/mocr","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verifid%2Fmocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verifid%2Fmocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verifid%2Fmocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verifid%2Fmocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/verifid","download_url":"https://codeload.github.com/verifid/mocr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225850164,"owners_count":17534067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cards","computer-vision","deep-learning","face-detection","identity","opencv","optical-character-recognition","tessaract"],"created_at":"2024-08-12T03:02:25.861Z","updated_at":"2024-11-22T06:13:51.992Z","avatar_url":"https://github.com/verifid.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"mocr\n======\n\n.. image:: https://github.com/verifid/mocr/workflows/mocr%20ci/badge.svg\n    :target: https://github.com/verifid/mocr/actions\n\n.. image:: https://img.shields.io/pypi/v/mocr.svg\n    :target: https://pypi.org/pypi/mocr/\n\n.. image:: https://img.shields.io/pypi/pyversions/mocr.svg\n    :target: https://pypi.org/project/mocr\n\n.. image:: https://travis-ci.org/verifid/mocr.svg?branch=master\n    :target: https://travis-ci.org/verifid/mocr\n\n.. image:: https://codecov.io/gh/verifid/mocr/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/verifid/mocr\n\n.. image:: https://pepy.tech/badge/mocr\n    :target: https://pepy.tech/project/mocr\n\n\nMeaningful Optical Character Recognition from identity cards with Deep Learning.\n\nIntroduction\n============\n\n**mocr** is a library that can be used to detect meaningful optical characters from identity cards. Code base is pure ``Python`` and\nworks with 3.x versions. It has some low level dependencies such as ``Tesseract``. **mocr** uses a pre-trained east\ndetector with OpenCV and applies it's Deep Learning techniques.\n\nIt has a pre-trained east detector inside the module and a custom trained model can be given as a parameter.\n\nPrerequisites\n=============\n\n* `Tessaract \u003chttps://github.com/tesseract-ocr/tesseract\u003e`_ must be installed on your computer before using OCR. Please check `installation link \u003chttps://github.com/tesseract-ocr/tesseract#installing-tesseract\u003e`_ for details.\n* The other dependencies are listed on ``requirements.txt`` and will be installed when you install with pip.\n\nInstallation\n============\n\n**From source**\n\nInstall module using `pip`::\n\n    $ pip install mocr\n\nDownload the latest `mocr` library from: https://github.com/verifid/mocr\n\nInstall module using `pip`::\n\n    $ pip install -e .\n\nExtract the source distribution and run::\n\n    $ python setup.py build\n    $ python setup.py install\n\nRunning Tests\n=============\n\nThe test suite can be run against a single Python version which requires ``pip install pytest`` and optionally ``pip install pytest-cov`` (these are included if you have installed dependencies from ``requirements.testing.txt``)\n\nTo run the unit tests with a single Python version::\n\n    $ py.test -v\n\nto also run code coverage::\n\n    $ py.test -v --cov-report html --cov=mocr\n\nTo run the unit tests against a set of Python versions::\n\n    $ tox\n\nSample Usage\n============\n\n* ``text_recognition`` Initiating the ``TextRecognizer`` with identity image and then finding the texts with their frames:\n\n.. code:: python\n\n    import os\n    from mocr import TextRecognizer\n\n    image_path = os.path.join('tests', 'data/sample_uk_identity_card.png')\n    east_path = os.path.join('mocr', 'model/frozen_east_text_detection.pb')\n\n    text_recognizer = TextRecognizer(image_path, east_path)\n    (image, _, _) = text_recognizer.load_image()\n    (resized_image, ratio_height, ratio_width, _, _) = text_recognizer.resize_image(image, 320, 320)\n    (scores, geometry) = text_recognizer.geometry_score(east_path, resized_image)\n    boxes = text_recognizer.boxes(scores, geometry)\n    results = text_recognizer.get_results(boxes, image, ratio_height, ratio_width)\n\n    # results: Meaningful texts with bounding boxes\n\n* ``face_detection``:\n\n.. code:: python\n\n    from mocr import face_detection\n\n    image_path = 'YOUR_IDENTITY_IMAGE_PATH'\n    face_image = face_detection.detect_face(image_path)\n    # face_image is the byte array detected and cropped image from original image\n\n.. code:: python\n\n    from mocr import face_detection\n\n    video_path = 'YOUR_IDENTITY_VIDEO_PATH'\n    face_image = face_detection.detect_face_from_video(video_path)\n    # face_image is the byte array detected and cropped image from original video\n\nCLI\n===\n\nSample command line usage\n\n* Optical Character Recognition\n\n.. code::\n\n    python -m mocr --image tests/data/sample_uk_identity_card.png --east tests/model/frozen_east_text_detection.pb\n\n* Face detection from image file\n\n.. code::\n\n    python -m mocr --image-face 'tests/data/sample_de_identity_card.jpg'\n\n* Face detection from video file\n\n.. code::\n\n    python -m mocr --video-face 'tests/data/face-demographics-walking.mp4'\n\nScreenshots\n-----------\n\n**Before**\n\n|image_before|\n\n**After**\n\n|image_after|\n\n.. |image_before| image:: https://raw.githubusercontent.com/verifid/mocr/master/screenshots/sample_uk_identity_card.png\n.. |image_after| image:: https://raw.githubusercontent.com/verifid/mocr/master/screenshots/uk_identity_card_after_detection.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverifid%2Fmocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fverifid%2Fmocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverifid%2Fmocr/lists"}