Aspose.OCR for Python via Java API docs
Loading...
Searching...
No Matches

AsposeOcr main class for recognition. More...

Public Member Functions

 __init__ (self)
 
typing.List[SkewOutput] calculate_skew (self, OcrInput input)
 Calculates the skew angles of an images.
 
bool compare_image_texts (self, str fullPath1, str fullPath2, RecognitionSettings settings=None, bool ignoreCase=True)
 Check if two images contain the same text.
 
str correct_spelling (self, str text, SpellCheckLanguage language)
 Corrects text (replaces misspelled words).
 
typing.List[RectangleOutput] detect_rectangles (self, OcrInput input, aspose.models.AreasType areasType, bool isDetectAreas)
 Detects text areas on images.
 
bool image_has_text (self, str fullPath, str text, RecognitionSettings settings=None, bool ignoreCase=True)
 Check if the image contains the provided text fragment.
 
float image_text_diff (self, str fullPath1, str fullPath2, RecognitionSettings settings=None, bool ignoreCase=True)
 Compare the texts on the two images and return a number representing how similar they are (0 to 1).
 
typing.List[RecognitionResult] recognize (self, OcrInput input, RecognitionSettings settings=None)
 Recognizes image with the ability to specify RecognitionSettings.
 
typing.List[RecognitionResult] recognize_car_plate (self, aspose.models.OcrInput input, aspose.recognitionsettings.CarPlateRecognitionSettings settings=None)
 Recognizes car plate with the ability to specify CarPlateRecognitionSettings.
 
typing.List[RecognitionResult] recognize_fast (self, OcrInput input)
 Recognizes text on good quality image.
 
typing.List[RecognitionResult] recognize_id_card (self, aspose.models.OcrInput input, aspose.recognitionsettings.IDCardRecognitionSettings settings=None)
 Recognizes ID card with the ability to specify IDCardRecognitionSettings.
 
typing.List[RecognitionResult] recognize_invoice (self, aspose.models.OcrInput input, aspose.recognitionsettings.InvoiceRecognitionSettings settings=None)
 Recognize invoice with the ability to specify InvoiceRecognitionSettings Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.
 
typing.List[RecognitionResult] recognize_lines (self, OcrInput input, RecognitionSettings settings=None)
 Recognizes single line image with the ability to specify RecognitionSettings.
 
typing.List[RecognitionResult] recognize_passport (self, aspose.models.OcrInput input, aspose.recognitionsettings.PassportRecognitionSettings settings=None)
 Recognizes passport with the ability to specify PassportRecognitionSettings.
 
typing.List[RecognitionResult] recognize_receipt (self, aspose.models.OcrInput input, aspose.recognitionsettings.ReceiptRecognitionSettings settings=None)
 Recognize receipts with the ability to specify ReceiptRecognitionSettings.
 
typing.List[RecognitionResult] recognize_street_photo (self, OcrInput input)
 Recognizes text on street photos.
 
 shutdown (self)
 Shut down the JVM machine.
 

Static Public Member Functions

 save_multipage_document (str fullFileName, Format saveFormat, List results)
 Allows to get multipage document from list of RecognitionResult objects.
 

Detailed Description

AsposeOcr main class for recognition.

This sample shows how to recognize image.

api = AsposeOcr()
input = OcrInput(InputType.SINGLE_IMAGE)
input.add(os.path.join(self.dataDir, "SpanishOCR.bmp"))
result = api.recognize(input)

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self)

Member Function Documentation

◆ calculate_skew()

typing.List[SkewOutput] calculate_skew (   self,
OcrInput  input 
)

Calculates the skew angles of an images.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance. The container with sources.
Returns
: List of skew angles in degrees - SkewOutput.

◆ compare_image_texts()

bool compare_image_texts (   self,
str  fullPath1,
str  fullPath2,
RecognitionSettings   settings = None,
bool   ignoreCase = True 
)

Check if two images contain the same text.

Parameters
fullPath1Path to the first image.
fullPath2Path to the second image.
settingsRecognition settings.
ignoreCaseTrue - means a case-insensitive search.
Returns
: True if images have the same text (90% similarity).

◆ correct_spelling()

str correct_spelling (   self,
str  text,
SpellCheckLanguage  language 
)

Corrects text (replaces misspelled words).

Parameters
textText for correction.
languageDictionary to use SpellCheckLanguage.
Returns
: Text with replaced words.

◆ detect_rectangles()

typing.List[RectangleOutput] detect_rectangles (   self,
OcrInput  input,
aspose.models.AreasType  areasType,
bool  isDetectAreas 
)

Detects text areas on images.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
areasTypeDeterminates wich rectangles to return - line, paragraphs or words.
isDetectAreasEnable automatic text areas detection.
Returns
: List of RectangleOutput with detected text areas or lines.

◆ image_has_text()

bool image_has_text (   self,
str  fullPath,
str  text,
RecognitionSettings   settings = None,
bool   ignoreCase = True 
)

Check if the image contains the provided text fragment.

Parameters
fullPathPath to the image.
textText fragment for searching on the image.
settingsRecognition settings.
ignoreCaseTrue - means a case-insensitive search.
Returns
: True if image contains text fragment. False - image doesn't contains text fragment.

◆ image_text_diff()

float image_text_diff (   self,
str  fullPath1,
str  fullPath2,
RecognitionSettings   settings = None,
bool   ignoreCase = True 
)

Compare the texts on the two images and return a number representing how similar they are (0 to 1).

Parameters
fullPath1Path to the first image.
fullPath2Path to the second image.
settingsRecognition settings.
ignoreCaseTrue - means a case-insensitive search.
Returns
: 0 means that the texts are completely different; 1 means the texts are identical.

◆ recognize()

typing.List[RecognitionResult] recognize (   self,
OcrInput  input,
RecognitionSettings   settings = None 
)

Recognizes image with the ability to specify RecognitionSettings.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsRecognitionSettings object.
Returns
: RecognitionResult list with images recognition results.

◆ recognize_car_plate()

typing.List[RecognitionResult] recognize_car_plate (   self,
aspose.models.OcrInput  input,
aspose.recognitionsettings.CarPlateRecognitionSettings   settings = None 
)

Recognizes car plate with the ability to specify CarPlateRecognitionSettings.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsCarPlateRecognitionSettings
Returns
: RecognitionResult list with images recognition results.

◆ recognize_fast()

typing.List[RecognitionResult] recognize_fast (   self,
OcrInput  input 
)

Recognizes text on good quality image.

Doesn't use automatic image skew correction and text areas detection. Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
Returns
: RecognitionResult list with images recognition results.

◆ recognize_id_card()

typing.List[RecognitionResult] recognize_id_card (   self,
aspose.models.OcrInput  input,
aspose.recognitionsettings.IDCardRecognitionSettings   settings = None 
)

Recognizes ID card with the ability to specify IDCardRecognitionSettings.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsIDCardRecognitionSettings
Returns
: RecognitionResult list with images recognition results.

◆ recognize_invoice()

typing.List[RecognitionResult] recognize_invoice (   self,
aspose.models.OcrInput  input,
aspose.recognitionsettings.InvoiceRecognitionSettings   settings = None 
)

Recognize invoice with the ability to specify InvoiceRecognitionSettings Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsInvoiceRecognitionSettings
Returns
: RecognitionResult list with images recognition results.

◆ recognize_lines()

typing.List[RecognitionResult] recognize_lines (   self,
OcrInput  input,
RecognitionSettings   settings = None 
)

Recognizes single line image with the ability to specify RecognitionSettings.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsRecognitionSettings object.
Returns
: RecognitionResult list with images recognition results.

◆ recognize_passport()

typing.List[RecognitionResult] recognize_passport (   self,
aspose.models.OcrInput  input,
aspose.recognitionsettings.PassportRecognitionSettings   settings = None 
)

Recognizes passport with the ability to specify PassportRecognitionSettings.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsPassportRecognitionSettings
Returns
: RecognitionResult list with images recognition results.

◆ recognize_receipt()

typing.List[RecognitionResult] recognize_receipt (   self,
aspose.models.OcrInput  input,
aspose.recognitionsettings.ReceiptRecognitionSettings   settings = None 
)

Recognize receipts with the ability to specify ReceiptRecognitionSettings.

Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
settingsReceiptRecognitionSettings
Returns
: RecognitionResult list with images recognition results.

◆ recognize_street_photo()

typing.List[RecognitionResult] recognize_street_photo (   self,
OcrInput  input 
)

Recognizes text on street photos.

Extract text from street photos, traffic camera images, ID cards, driver licenses, and other images with sparse text and noisy/colored backgrounds. Supports GIF, PNG, JPEG, WBMP, TIFF, JFIF, TIFF, PDF, binary array, folder, array, zip archive, URL, base64.

Parameters
input:py:any:~aspose.models.OcrInput. instance.
Returns
: RecognitionResult list with images recognition results.

◆ save_multipage_document()

save_multipage_document ( str  fullFileName,
Format  saveFormat,
List  results 
)
static

Allows to get multipage document from list of RecognitionResult objects.

Parameters
fullFileNameFilename with a path for saving recognition result in the selected format.
saveFormatDocument format (Docx, Txt, Pdf, Xlsx, Xml, Json).
results

◆ shutdown()

shutdown (   self)

Shut down the JVM machine.