Returns: RecognizedImage: Structured recognized text containing lines, words and their bounding rectangles.
Example
fromgroupdocs.redactionimportRedactorfromgroupdocs.redaction.integration.ocrimportRecognizedImage,TextFragment,TextLinefromgroupdocs.redaction.optionsimportLoadOptions,RedactorSettingsfromgroupdocs.redaction.options.drawingimportColor,Rectanglefromgroupdocs.redaction.redactionsimportExactPhraseRedaction,ReplacementOptionsclassMyConnector:defrecognize(self,image_stream):# In a real implementation, hand the bytes to an OCR engine.data=image_stream.read()# One fragment per line: engine 26.10 paints no phrase that spans two fragments.line=TextLine([TextFragment("Emily Johnson",Rectangle(40,40,230,40))])returnRecognizedImage([line])withRedactor("scan.png",LoadOptions(),RedactorSettings(ocr_connector=MyConnector()))asredactor:result=redactor.apply(ExactPhraseRedaction("Emily Johnson",ReplacementOptions(Color.black)))print(result.status.name)
Aliases
These names call recognize too, limited to the overloads listed.