-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrecognize.py
More file actions
31 lines (21 loc) · 768 Bytes
/
recognize.py
File metadata and controls
31 lines (21 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import aspose.ocr as ocr
''' set license '''
#lic = ocr.license.License()
#lic.set_license('path')
''' initialize main class '''
api = ocr.AsposeOcr()
''' set preprocessing options '''
filters = ocr.models.preprocessingfilters.PreprocessingFilter()
filters.add(ocr.models.preprocessingfilters.PreprocessingFilter.auto_skew())
''' Create OcrInput and add images '''
input = ocr.OcrInput(ocr.InputType.SINGLE_IMAGE, filters)
input.add("Data\\OCR\\sample.png")
''' set recognition options '''
settings = ocr.RecognitionSettings()
settings.detect_areas_mode = ocr.DetectAreasMode.TABLE
settings.threads_count = 1
settings.language = ocr.Language.ENG
''' recognize '''
result = api.recognize(input, settings)
''' print result '''
print(result[0].recognition_text)