Package: ocrlayout
OcrLayout LibraryProvides the ability to get more meaninful text out of common OCR outputs. It manipulates the Bounding Boxes of lines to rebuild a page layout to approximate human-reading experience.Problem StatementWhile OCR processing images containing lots of textual information, it becomes relevant to assemble the generated text into meaninful lines of text combining related paragraphs or sentences.Another way to see would be to cluster the lines of text based on their positions/coordinates in the original content.More meaningfull output for what?Text Analytics you may leverage any Text Analytics such as Key Phrases, Entities Extraction with more confidence of its outcomeAccessibility : Any infographic becomes alive, overcoming the alt text feature.Modern browser Read Aloud feature : it becomes easier to build solutions to read aloud an image, increasing verbal narrative of visual information.Machine Translation : get more accurate MT output as you can retain more context.Sentences/Paragraph Classification : from scanned-base images i.e. contracts, having a more meaninful textual output allows you to classify it at a granular level in terms of risk, personal clause or conditions.Ocr Output SupportToday bboxhelper supports the output ofAZUREAzure Batch Read API response.https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/concept-recognizing-text#read-apiAzure Computer Vision SDK Python Samplehttps://github.com/Azure/azure-sdk-for-python/tree/76a0d91c32a79561a7d5666e421908e7c4cffc6a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervisionGOOGLEGoogle Vision API Detect Texthttps://cloud.google.com/vision/docs/ocrhttps://cloud.google.com/vision/docs/ocr#vision_text_detection-pythonGoogle Vision Python Samplehttps://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/vision/cloud-client/document_text/doctext.pyAWS - Detect Document TextAWS Textract
Detects text in the input document. Amazon Textract can detect lines of text and the words that make up a line of text. The input document must be an image in JPEG or PNG format.https://aws.amazon.com/textract/features/https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.htmlhttps://docs.aws.amazon.com/textract/latest/dg/API_DetectDocumentText.htmlBBoxHelper - Get StartedMore information to get started can be found documentation of this repository:documentation.Known LimitationsMore information on knownlimitations.Upcoming improvementshOCR Suppporthttps://en.wikipedia.org/wiki/HOCRtoolsasyncio support for pages processingGoogle OCR for documents (PDF)AWS OCR for documents (PDF)Release History0.8 (2020-08-24)Support for AWS Detect Document TextGoogle support refactored for consistencySimplify the bboxtester script0.7 (2020-07-29)Configurable merge line character (default is a single space)0.6 (2020-07-09)Support for Azure OCR API0.5 (2020-06-07)Fix line/word X alignmentImproved sorting with with clusters within clusters supportadded words_count to each lineremoved dependency on OpenCV and Pillow0.4.2 (2020-06-06)Remove file logging as default0.4.1 (2020-06-01)Comment the determine_ppi method as unstable0.4 (2020-05-31)Bounding boxes rotation improvementsFix issues with inch unit support0.3 (2020-05-23)Refactoring variables namesImprovement on the end of blocks handling for generating the final text attribute0.2 (2020-05-22 Afternoon)Change to fit the new Azure Computer Vision SDK 0.6.0breaking changes.0.1 (2020-05-22 Morning)Initial releaseDisclaimerTHIS CODE IS PROVIDEDAS ISWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.