importiofromgroupdocs.search.optionsimportIndexingOptionstry:importpytesseract# pip install pytesseractfromPILimportImage# pip install pillowexceptImportError:pytesseract=NoneclassTesseractOcrConnector(object):defrecognize(self,context):image=context.image_stream.read()# Read the whole image streamifpytesseractisNone:print("pytesseract is not installed: an image of %d bytes is not recognized"%len(image))returnNonewithImage.open(io.BytesIO(image))aspicture:returnpytesseract.image_to_string(picture)options=IndexingOptions()options.ocr_indexing_options.enabled_for_separate_images=Trueoptions.ocr_indexing_options.ocr_connector=TesseractOcrConnector()
Aliases
These names call recognize too, limited to the overloads listed.