|
2 | 2 |
|
3 | 3 | from regula.documentreader.webclient.ext.api import DocumentReaderApi
|
4 | 4 | from regula.documentreader.webclient.ext.models import RecognitionRequest
|
5 |
| -from regula.documentreader.webclient.gen import ProcessParams, Scenario, Result, TextFieldType, Source, \ |
6 |
| - CheckResult |
| 5 | +from regula.documentreader.webclient.gen.models import ProcessParams, Scenario, Result, TextFieldType, Source, \ |
| 6 | + CheckResult, GraphicFieldType |
7 | 7 |
|
8 | 8 | host = os.getenv("API_BASE_PATH", "http://localhost:8080")
|
9 | 9 | license = os.getenv("TEST_LICENSE", None) # optional, used here only for smoke test purposes
|
|
16 | 16 |
|
17 | 17 | params = ProcessParams(
|
18 | 18 | scenario=Scenario.FULL_PROCESS,
|
19 |
| - result_type_output=[Result.STATUS, Result.TEXT, Result.IMAGES] |
| 19 | + result_type_output=[Result.RAW_IMAGE, Result.STATUS, Result.TEXT, Result.IMAGES] |
20 | 20 | )
|
21 | 21 | request = RecognitionRequest(process_params=params, images=[input_image])
|
22 | 22 | response = api.process(request)
|
|
33 | 33 | doc_number_mrz_validity = doc_number_field.source_validity(Source.MRZ)
|
34 | 34 | doc_number_mrz_visual_matching = doc_number_field.cross_source_comparison(Source.MRZ, Source.VISUAL)
|
35 | 35 |
|
36 |
| - response_images = response.images |
| 36 | + # images fields example |
| 37 | + normalized_input_image = response.images.normalized_input_image() |
| 38 | + portrait_Field = response.images.get_field(GraphicFieldType.PORTRAIT) |
| 39 | + portrait_From_Visual = portrait_Field.get_value(Source.VISUAL) |
| 40 | + with open('portraitFromVisual.jpg', 'wb') as f: f.write(portrait_From_Visual) |
| 41 | + with open('normalizedInputImage.jpg', 'wb') as f: f.write(normalized_input_image) |
| 42 | + |
| 43 | + # low-lvl(original) response |
| 44 | + response.low_lvl_response |
37 | 45 |
|
38 | 46 | print("""
|
39 | 47 | ---------------------------------------------------------------------------
|
|
0 commit comments