dynamsoft-capture-vision-bundle 3.4.1000__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dynamsoft_capture_vision_bundle/ConfusableChars.data +0 -0
- dynamsoft_capture_vision_bundle/DynamicPdfx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftBarcodeReaderx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftCaptureVisionRouterx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftCodeParserDedicatorx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftCodeParserx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftCorex64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftDocumentNormalizerx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftIdentityUtilityx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftImageProcessingx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftLabelRecognizerx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftLicensex64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftNeuralNetworkx64.dll +0 -0
- dynamsoft_capture_vision_bundle/DynamsoftUtilityx64.dll +0 -0
- dynamsoft_capture_vision_bundle/Models/Code128Decoder.data +0 -0
- dynamsoft_capture_vision_bundle/Models/Code39ITFDecoder.data +0 -0
- dynamsoft_capture_vision_bundle/Models/DataMatrixQRCodeDeblur.data +0 -0
- dynamsoft_capture_vision_bundle/Models/DataMatrixQRCodeLocalization.data +0 -0
- dynamsoft_capture_vision_bundle/Models/EAN13Decoder.data +0 -0
- dynamsoft_capture_vision_bundle/Models/LetterCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/LowercaseCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/MRZCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/MRZLocalization.data +0 -0
- dynamsoft_capture_vision_bundle/Models/MRZTextLineRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/NumberCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/NumberLetterCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/NumberLowercaseCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/NumberUppercaseCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/OneDDeblur.data +0 -0
- dynamsoft_capture_vision_bundle/Models/OneDLocalization.data +0 -0
- dynamsoft_capture_vision_bundle/Models/PDF417Deblur.data +0 -0
- dynamsoft_capture_vision_bundle/Models/PDF417Localization.data +0 -0
- dynamsoft_capture_vision_bundle/Models/UppercaseCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/Models/VINCharRecognition.data +0 -0
- dynamsoft_capture_vision_bundle/OverlappingChars.data +1 -0
- dynamsoft_capture_vision_bundle/ParserResources/AADHAAR.data +0 -0
- dynamsoft_capture_vision_bundle/ParserResources/AAMVA_DL_ID.data +1 -0
- dynamsoft_capture_vision_bundle/ParserResources/GS1_AI.data +66 -0
- dynamsoft_capture_vision_bundle/ParserResources/MRTD.data +1 -0
- dynamsoft_capture_vision_bundle/ParserResources/SOUTH_AFRICA_DL.data +1 -0
- dynamsoft_capture_vision_bundle/ParserResources/VIN.data +0 -0
- dynamsoft_capture_vision_bundle/Templates/DBR-PresetTemplates.json +546 -0
- dynamsoft_capture_vision_bundle/Templates/DDN-PresetTemplates.json +316 -0
- dynamsoft_capture_vision_bundle/Templates/DLR-PresetTemplates.json +471 -0
- dynamsoft_capture_vision_bundle/Templates/DriverLicenseScanner.json +94 -0
- dynamsoft_capture_vision_bundle/Templates/MRZScanner.json +804 -0
- dynamsoft_capture_vision_bundle/Templates/VINScanner.json +299 -0
- dynamsoft_capture_vision_bundle/_DynamsoftBarcodeReader.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftCaptureVisionRouter.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftCodeParser.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftCodeParserDedicator.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftCore.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftDocumentNormalizer.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftIdentityUtility.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftImageProcessing.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftLabelRecognizer.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftLicense.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/_DynamsoftUtility.cp314-win_amd64.pyd +0 -0
- dynamsoft_capture_vision_bundle/__init__.py +13 -0
- dynamsoft_capture_vision_bundle/core.py +2785 -0
- dynamsoft_capture_vision_bundle/cvr.py +1347 -0
- dynamsoft_capture_vision_bundle/dbr.py +1223 -0
- dynamsoft_capture_vision_bundle/dcp.py +208 -0
- dynamsoft_capture_vision_bundle/dcpd.py +21 -0
- dynamsoft_capture_vision_bundle/ddn.py +985 -0
- dynamsoft_capture_vision_bundle/dip.py +24 -0
- dynamsoft_capture_vision_bundle/dlr.py +1136 -0
- dynamsoft_capture_vision_bundle/id_utility.py +98 -0
- dynamsoft_capture_vision_bundle/license.py +146 -0
- dynamsoft_capture_vision_bundle/utility.py +835 -0
- dynamsoft_capture_vision_bundle-3.4.1000.dist-info/METADATA +89 -0
- dynamsoft_capture_vision_bundle-3.4.1000.dist-info/RECORD +75 -0
- dynamsoft_capture_vision_bundle-3.4.1000.dist-info/WHEEL +5 -0
- dynamsoft_capture_vision_bundle-3.4.1000.dist-info/licenses/LICENSE.txt +1 -0
- dynamsoft_capture_vision_bundle-3.4.1000.dist-info/top_level.txt +12 -0
|
@@ -0,0 +1,1347 @@
|
|
|
1
|
+
__version__ = "3.4.10.7449"
|
|
2
|
+
|
|
3
|
+
if __package__ or "." in __name__:
|
|
4
|
+
from .core import *
|
|
5
|
+
else:
|
|
6
|
+
from core import *
|
|
7
|
+
|
|
8
|
+
if __package__ or "." in __name__:
|
|
9
|
+
from . import _DynamsoftCaptureVisionRouter
|
|
10
|
+
else:
|
|
11
|
+
import _DynamsoftCaptureVisionRouter
|
|
12
|
+
|
|
13
|
+
from abc import ABC, abstractmethod
|
|
14
|
+
from enum import Enum, IntEnum
|
|
15
|
+
from typing import Tuple, List, Union
|
|
16
|
+
|
|
17
|
+
class EnumPresetTemplate(str, Enum):
|
|
18
|
+
PT_DEFAULT = _DynamsoftCaptureVisionRouter.getPT_DEFAULT()
|
|
19
|
+
PT_READ_BARCODES = _DynamsoftCaptureVisionRouter.getPT_READ_BARCODES()
|
|
20
|
+
PT_RECOGNIZE_TEXT_LINES = _DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_TEXT_LINES()
|
|
21
|
+
PT_DETECT_DOCUMENT_BOUNDARIES = (
|
|
22
|
+
_DynamsoftCaptureVisionRouter.getPT_DETECT_DOCUMENT_BOUNDARIES()
|
|
23
|
+
)
|
|
24
|
+
PT_DETECT_AND_NORMALIZE_DOCUMENT = (
|
|
25
|
+
_DynamsoftCaptureVisionRouter.getPT_DETECT_AND_NORMALIZE_DOCUMENT()
|
|
26
|
+
)
|
|
27
|
+
PT_NORMALIZE_DOCUMENT = _DynamsoftCaptureVisionRouter.getPT_NORMALIZE_DOCUMENT()
|
|
28
|
+
PT_READ_BARCODES_SPEED_FIRST = (
|
|
29
|
+
_DynamsoftCaptureVisionRouter.getPT_READ_BARCODES_SPEED_FIRST()
|
|
30
|
+
)
|
|
31
|
+
PT_READ_BARCODES_READ_RATE_FIRST = (
|
|
32
|
+
_DynamsoftCaptureVisionRouter.getPT_READ_BARCODES_READ_RATE_FIRST()
|
|
33
|
+
)
|
|
34
|
+
PT_READ_SINGLE_BARCODE = _DynamsoftCaptureVisionRouter.getPT_READ_SINGLE_BARCODE()
|
|
35
|
+
PT_RECOGNIZE_NUMBERS = _DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_NUMBERS()
|
|
36
|
+
PT_RECOGNIZE_LETTERS = _DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_LETTERS()
|
|
37
|
+
PT_RECOGNIZE_NUMBERS_AND_LETTERS = (
|
|
38
|
+
_DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_NUMBERS_AND_LETTERS()
|
|
39
|
+
)
|
|
40
|
+
PT_RECOGNIZE_NUMBERS_AND_UPPERCASE_LETTERS = (
|
|
41
|
+
_DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_NUMBERS_AND_UPPERCASE_LETTERS()
|
|
42
|
+
)
|
|
43
|
+
PT_RECOGNIZE_UPPERCASE_LETTERS = (
|
|
44
|
+
_DynamsoftCaptureVisionRouter.getPT_RECOGNIZE_UPPERCASE_LETTERS()
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class EnumCaptureState(IntEnum):
|
|
49
|
+
CS_STARTED = _DynamsoftCaptureVisionRouter.CS_STARTED
|
|
50
|
+
CS_STOPPED = _DynamsoftCaptureVisionRouter.CS_STOPPED
|
|
51
|
+
CS_PAUSED = _DynamsoftCaptureVisionRouter.CS_PAUSED
|
|
52
|
+
CS_RESUMED = _DynamsoftCaptureVisionRouter.CS_RESUMED
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class EnumImageSourceState(IntEnum):
|
|
56
|
+
ISS_BUFFER_EMPTY = _DynamsoftCaptureVisionRouter.ISS_BUFFER_EMPTY
|
|
57
|
+
ISS_EXHAUSTED = _DynamsoftCaptureVisionRouter.ISS_EXHAUSTED
|
|
58
|
+
|
|
59
|
+
class SimplifiedCaptureVisionSettings:
|
|
60
|
+
"""
|
|
61
|
+
The SimplifiedCaptureVisionSettings class contains settings for capturing and recognizing images with the CaptureVisionRouter class.
|
|
62
|
+
|
|
63
|
+
Attributes:
|
|
64
|
+
captured_result_item_types (int): Specifies the type(s) of captured result item(s) that will be captured.
|
|
65
|
+
roi (Quadrilateral): Specifies the region of interest (ROI) where the image capture and recognition will take place.
|
|
66
|
+
roi_measured_in_percentage (int): Specifies whether the ROI is measured in pixels or as a percentage of the image size.
|
|
67
|
+
max_parallel_tasks (int): Specifies the maximum number of parallel tasks that can be used for image capture and recognition.
|
|
68
|
+
timeout (int): Specifies the maximum time (in milliseconds) allowed for image capture and recognition.
|
|
69
|
+
barcode_settings (SimplifiedBarcodeReaderSettings): Specifies the settings for barcode recognition.
|
|
70
|
+
label_settings (SimplifiedLabelRecognizerSettings): Specifies the settings for label recognition.
|
|
71
|
+
document_settings (SimplifiedDocumentNormalizerSettings): Specifies the settings for document normalization.
|
|
72
|
+
min_image_capture_interval (int): Specifies the minimum time interval (in milliseconds) allowed between consecutive image captures.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
_thisown = property(
|
|
76
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
output_original_image: int = property(
|
|
80
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_outputOriginalImage_get,
|
|
81
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_outputOriginalImage_set,
|
|
82
|
+
doc="Specifies the type(s) of captured result item(s) that will be captured. It is a bitwise OR combination of one or more values from the EnumCapturedResultItemType enumeration."
|
|
83
|
+
)
|
|
84
|
+
# roi: Quadrilateral = property(
|
|
85
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roi_get,
|
|
86
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roi_set,
|
|
87
|
+
# doc="Specifies the region of interest (ROI) where the image capture and recognition will take place."
|
|
88
|
+
# )
|
|
89
|
+
@property
|
|
90
|
+
def roi(self) -> Quadrilateral:
|
|
91
|
+
if not hasattr(self, '_roi') or self._roi is None:
|
|
92
|
+
self._roi = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roi_get(self)
|
|
93
|
+
return self._roi
|
|
94
|
+
@roi.setter
|
|
95
|
+
def roi(self, value: Quadrilateral):
|
|
96
|
+
if not hasattr(self, '_roi') or self._roi is None:
|
|
97
|
+
self._roi = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roi_get(self)
|
|
98
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roi_set(self, value)
|
|
99
|
+
self._roi = value
|
|
100
|
+
roi_measured_in_percentage: int = property(
|
|
101
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roiMeasuredInPercentage_get,
|
|
102
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_roiMeasuredInPercentage_set,
|
|
103
|
+
doc="Specifies whether the ROI is measured in pixels or as a percentage of the image size. Values: 0 the ROI is measured in pixels. 1 the ROI is measured as a percentage of the image size."
|
|
104
|
+
)
|
|
105
|
+
max_parallel_tasks: int = property(
|
|
106
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_maxParallelTasks_get,
|
|
107
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_maxParallelTasks_set,
|
|
108
|
+
doc="Specifies the maximum number of parallel tasks that can be used for image capture and recognition."
|
|
109
|
+
)
|
|
110
|
+
timeout: int = property(
|
|
111
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_timeout_get,
|
|
112
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_timeout_set,
|
|
113
|
+
doc="Specifies the maximum time (in milliseconds) allowed for image capture and recognition."
|
|
114
|
+
)
|
|
115
|
+
@property
|
|
116
|
+
def barcode_settings(self) -> "SimplifiedBarcodeReaderSettings":
|
|
117
|
+
if not hasattr(self, '_barcode_settings') or self._barcode_settings is None:
|
|
118
|
+
self._barcode_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_barcodeSettings_get(self)
|
|
119
|
+
return self._barcode_settings
|
|
120
|
+
@barcode_settings.setter
|
|
121
|
+
def barcode_settings(self, value: "SimplifiedBarcodeReaderSettings"):
|
|
122
|
+
if not hasattr(self, '_barcode_settings') or self._barcode_settings is None:
|
|
123
|
+
self._barcode_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_barcodeSettings_get(self)
|
|
124
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_barcodeSettings_set(self, value)
|
|
125
|
+
self._barcode_settings = value
|
|
126
|
+
@property
|
|
127
|
+
def label_settings(self) -> "SimplifiedLabelRecognizerSettings":
|
|
128
|
+
if not hasattr(self, '_label_settings') or self._label_settings is None:
|
|
129
|
+
self._label_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_labelSettings_get(self)
|
|
130
|
+
return self._label_settings
|
|
131
|
+
@label_settings.setter
|
|
132
|
+
def label_settings(self, value: "SimplifiedLabelRecognizerSettings"):
|
|
133
|
+
if not hasattr(self, '_label_settings') or self._label_settings is None:
|
|
134
|
+
self._label_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_labelSettings_get(self)
|
|
135
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_labelSettings_set(self, value)
|
|
136
|
+
self._label_settings = value
|
|
137
|
+
# barcode_settings: "SimplifiedBarcodeReaderSettings" = property(
|
|
138
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_barcodeSettings_get,
|
|
139
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_barcodeSettings_set,
|
|
140
|
+
# doc="Specifies the settings for barcode recognition."
|
|
141
|
+
# )
|
|
142
|
+
# label_settings: "SimplifiedLabelRecognizerSettings" = property(
|
|
143
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_labelSettings_get,
|
|
144
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_labelSettings_set,
|
|
145
|
+
# doc="Specifies the settings for label recognition."
|
|
146
|
+
# )
|
|
147
|
+
min_image_capture_interval: int = property(
|
|
148
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_minImageCaptureInterval_get,
|
|
149
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_minImageCaptureInterval_set,
|
|
150
|
+
doc="""
|
|
151
|
+
Specifies the minimum time interval (in milliseconds) allowed between consecutive image captures.
|
|
152
|
+
This property represents the minimum time interval (in milliseconds) that must elapse before the next image capture operation can be initiated.
|
|
153
|
+
Setting a larger value for this property will introduce a delay between image captures, while setting a smaller value allows for more frequent captures.
|
|
154
|
+
It can be used to reduce the computational frequency, which can effectively lower energy consumption.
|
|
155
|
+
Please note that the actual time interval between captures may be longer than the specified minimum interval due to various factors, such as image processing time and hardware limitations.
|
|
156
|
+
"""
|
|
157
|
+
)
|
|
158
|
+
@property
|
|
159
|
+
def document_settings(self) -> "SimplifiedDocumentNormalizerSettings":
|
|
160
|
+
if not hasattr(self, '_document_settings') or self._document_settings is None:
|
|
161
|
+
self._document_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_documentSettings_get(self)
|
|
162
|
+
return self._document_settings
|
|
163
|
+
@document_settings.setter
|
|
164
|
+
def document_settings(self, value: "SimplifiedDocumentNormalizerSettings"):
|
|
165
|
+
if not hasattr(self, '_document_settings') or self._document_settings is None:
|
|
166
|
+
self._document_settings = _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_documentSettings_get(self)
|
|
167
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_documentSettings_set(self, value)
|
|
168
|
+
self._document_settings = value
|
|
169
|
+
# document_settings: "SimplifiedDocumentNormalizerSettings" = property(
|
|
170
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_documentSettings_get,
|
|
171
|
+
# _DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_documentSettings_set,
|
|
172
|
+
# doc="Specifies the settings for document normalization."
|
|
173
|
+
# )
|
|
174
|
+
|
|
175
|
+
def __init__(self):
|
|
176
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
177
|
+
self, _DynamsoftCaptureVisionRouter.new_SimplifiedCaptureVisionSettings()
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_SimplifiedCaptureVisionSettings
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
_DynamsoftCaptureVisionRouter.SimplifiedCaptureVisionSettings_register(
|
|
184
|
+
SimplifiedCaptureVisionSettings
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
class CapturedResult(CapturedResultBase):
|
|
188
|
+
"""
|
|
189
|
+
The CapturedResult class represents the result of a capture operation on an image.
|
|
190
|
+
Internally, CaptureResult stores an array that contains multiple items, each of which may be a barcode, text line, detected quad, normalized image, original image, parsed item, etc.
|
|
191
|
+
|
|
192
|
+
Methods:
|
|
193
|
+
get_original_image_hash_id(self) -> str: Gets the hash ID of the original image.
|
|
194
|
+
get_original_image_tag(self) -> ImageTag: Gets the tag of the original image.
|
|
195
|
+
get_items(self) -> List[CapturedResultItem]: Gets all items in the captured result.
|
|
196
|
+
get_rotation_transform_matrix(self) -> List[float]: Gets the 3x3 rotation transformation matrix of the original image relative to the rotated image.
|
|
197
|
+
get_error_code(self) -> int: Gets the error code of the capture operation.
|
|
198
|
+
get_error_string(self) -> str: Gets the error message of the capture operation.
|
|
199
|
+
get_decoded_barcodes_result(self) -> DecodedBarcodesResult: Gets the decoded barcode items from the CapturedResult.
|
|
200
|
+
get_recognized_text_lines_result(self) -> RecognizedTextLinesResult: Gets the recognized text line items from the CapturedResult.
|
|
201
|
+
get_processed_document_result(self) -> ProcessedDocumentResult: Gets the normalized images items from the CapturedResult.
|
|
202
|
+
get_parsed_result(self) -> ParsedResult: Gets the parsed result items from the CapturedResult.
|
|
203
|
+
"""
|
|
204
|
+
_thisown = property(
|
|
205
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
def __init__(self):
|
|
209
|
+
raise AttributeError("No constructor defined - class is abstract")
|
|
210
|
+
|
|
211
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.CCapturedResult_Release
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def get_items(self) -> List[CapturedResultItem]:
|
|
215
|
+
"""
|
|
216
|
+
Gets all items in the captured result.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
A list of CapturedResultItem objects with all items in the captured result.
|
|
220
|
+
"""
|
|
221
|
+
if not hasattr(self, '_items') or self._items is None:
|
|
222
|
+
self._items = _DynamsoftCaptureVisionRouter.CCapturedResult_GetItems(self)
|
|
223
|
+
return self._items
|
|
224
|
+
|
|
225
|
+
def __getitem__(self, index: int) -> CapturedResultItem:
|
|
226
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResult_GetItem(self, index)
|
|
227
|
+
|
|
228
|
+
def get_decoded_barcodes_result(self) -> "DecodedBarcodesResult":
|
|
229
|
+
"""
|
|
230
|
+
Gets the decoded barcode items from the CapturedResult.
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
A DecodedBarcodesResult object containing the decoded barcode items.
|
|
234
|
+
"""
|
|
235
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResult_GetDecodedBarcodesResult(
|
|
236
|
+
self
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
def get_recognized_text_lines_result(self) -> "RecognizedTextLinesResult":
|
|
240
|
+
"""
|
|
241
|
+
Gets the recognized text line items from the CapturedResult.
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
A RecognizedTextLinesResult object containing the recognized text line items.
|
|
245
|
+
"""
|
|
246
|
+
return (
|
|
247
|
+
_DynamsoftCaptureVisionRouter.CCapturedResult_GetRecognizedTextLinesResult(
|
|
248
|
+
self
|
|
249
|
+
)
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
def get_processed_document_result(self) -> "ProcessedDocumentResult":
|
|
253
|
+
"""
|
|
254
|
+
Gets the processed document result items from the CapturedResult.
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
A DetectedQuadsResult object containing the processed document result items.
|
|
258
|
+
"""
|
|
259
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResult_GetProcessedDocumentResult(
|
|
260
|
+
self
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
def get_parsed_result(self) -> "ParsedResult":
|
|
264
|
+
"""
|
|
265
|
+
Gets the parsed result items from the CapturedResult.
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
A ParsedResult object containing the parsed result items.
|
|
269
|
+
"""
|
|
270
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResult_GetParsedResult(self)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
_DynamsoftCaptureVisionRouter.CCapturedResult_register(CapturedResult)
|
|
274
|
+
|
|
275
|
+
class CapturedResultArray:
|
|
276
|
+
_thisown = property(
|
|
277
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
278
|
+
)
|
|
279
|
+
def __init__(self):
|
|
280
|
+
raise AttributeError("No constructor defined - class is abstract")
|
|
281
|
+
|
|
282
|
+
def get_results(self) -> List[CapturedResult]:
|
|
283
|
+
list = []
|
|
284
|
+
count = _DynamsoftCaptureVisionRouter.CCapturedResultArray_GetResultsCount(self)
|
|
285
|
+
for i in range(count):
|
|
286
|
+
list.append(_DynamsoftCaptureVisionRouter.CCapturedResultArray_GetResult(self, i))
|
|
287
|
+
return list
|
|
288
|
+
|
|
289
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.CCapturedResultArray_Release
|
|
290
|
+
|
|
291
|
+
_DynamsoftCaptureVisionRouter.CCapturedResultArray_register(CapturedResultArray)
|
|
292
|
+
|
|
293
|
+
class CapturedResultReceiver:
|
|
294
|
+
"""
|
|
295
|
+
The CapturedResultReceiver class is responsible for receiving captured results.
|
|
296
|
+
It contains several callback functions for different types of results, including original image, decoded barcodes, recognized text lines, detected quads, normalized images, and parsed results.
|
|
297
|
+
|
|
298
|
+
Methods:
|
|
299
|
+
get_name(self) -> str: Gets the name of the captured result receiver.
|
|
300
|
+
set_name(self, name: str) -> None: Sets the name of the captured result receiver.
|
|
301
|
+
on_captured_result_received(self, captured_result: CapturedResult) -> None: Callback function triggered after processing each image and returns all captured results.
|
|
302
|
+
on_original_image_result_received(self, original_image_result: OriginalImageResultItem) -> None: Callback function triggered when start processing each image and returns the original image result.
|
|
303
|
+
on_decoded_barcodes_received(self, decoded_barcodes_result: DecodedBarcodesResult) -> None: Callback function triggered after processing each image and returns all decoded barcodes results.
|
|
304
|
+
on_recognized_text_lines_received(self, recognized_text_lines_result: RecognizedTextLinesResult) -> None: Callback function triggered after processing each image and returns all recognized text lines results.
|
|
305
|
+
on_processed_document_result_received(self, processed_document_result_result: ProcessedDocumentResult) -> None: Callback function triggered after processing each image and returns all normalized images results.
|
|
306
|
+
on_parsed_results_received(self, parsed_result: ParsedResult) -> None: Callback function triggered after processing each image and returns all parsed results.
|
|
307
|
+
"""
|
|
308
|
+
_thisown = property(
|
|
309
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
def __init__(self):
|
|
313
|
+
if type(self) is CapturedResultReceiver:
|
|
314
|
+
raise TypeError("Cannot create an instance of an abstract class.")
|
|
315
|
+
else:
|
|
316
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
317
|
+
self, _DynamsoftCaptureVisionRouter.new_CCapturedResultReceiver(self)
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CCapturedResultReceiver
|
|
321
|
+
def get_name(self) -> str:
|
|
322
|
+
"""
|
|
323
|
+
Gets the name of the captured result receiver.
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
The name of the captured result receiver.
|
|
327
|
+
"""
|
|
328
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_GetName(self)
|
|
329
|
+
|
|
330
|
+
def set_name(self, name: str) -> None:
|
|
331
|
+
"""
|
|
332
|
+
Sets the name of the captured result receiver.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
name(str): The name of the captured result receiver.
|
|
336
|
+
"""
|
|
337
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_SetName(self, name)
|
|
338
|
+
|
|
339
|
+
def on_captured_result_received(self, result: CapturedResult) -> None:
|
|
340
|
+
"""
|
|
341
|
+
Callback function triggered after processing each image and returns all captured results.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
result(CapturedResult): The captured result.
|
|
345
|
+
"""
|
|
346
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnCapturedResultReceived(
|
|
347
|
+
self, result
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
def on_original_image_result_received(
|
|
351
|
+
self, result: OriginalImageResultItem
|
|
352
|
+
) -> None:
|
|
353
|
+
"""
|
|
354
|
+
Callback function triggered when start processing each image and returns the original image result.
|
|
355
|
+
For the callback to be triggered, it is essential that the parameter `OutputOriginalImage` is set to value `1`.
|
|
356
|
+
|
|
357
|
+
Args:
|
|
358
|
+
result(OriginalImageResultItem): The original image result.
|
|
359
|
+
"""
|
|
360
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnOriginalImageResultReceived(
|
|
361
|
+
self, result
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
def on_decoded_barcodes_received(self, result: "DecodedBarcodesResult") -> None:
|
|
365
|
+
"""
|
|
366
|
+
Callback function triggered after processing each image and returns all decoded barcodes.
|
|
367
|
+
For the callback to be triggered, it is essential that the `BarcodeReaderTask` is properly configured.
|
|
368
|
+
|
|
369
|
+
Args:
|
|
370
|
+
result(DecodedBarcodesResult): The decoded barcodes result.
|
|
371
|
+
"""
|
|
372
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnDecodedBarcodesReceived(
|
|
373
|
+
self, result
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
def on_recognized_text_lines_received(
|
|
377
|
+
self, result: "RecognizedTextLinesResult"
|
|
378
|
+
) -> None:
|
|
379
|
+
"""
|
|
380
|
+
Callback function triggered after processing each image and returns all recognized text lines.
|
|
381
|
+
For the callback to be triggered, it is essential that the `LabelRecognizerTask` is properly configured.
|
|
382
|
+
|
|
383
|
+
Args:
|
|
384
|
+
result(RecognizedTextLinesResult): The recognized text lines result.
|
|
385
|
+
"""
|
|
386
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnRecognizedTextLinesReceived(
|
|
387
|
+
self, result
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
def on_processed_document_result_received(self, result: "ProcessedDocumentResult") -> None:
|
|
391
|
+
"""
|
|
392
|
+
Callback function triggered after processing each image and returns all normalized images.
|
|
393
|
+
For the callback to be triggered, it is essential that the `DocumentNormalizerTask` is properly configured.
|
|
394
|
+
|
|
395
|
+
Args:
|
|
396
|
+
result(ProcessedDocumentResult): The normalized images result.
|
|
397
|
+
"""
|
|
398
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnProcessedDocumentResultReceived(
|
|
399
|
+
self, result
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def on_parsed_results_received(self, result: "ParsedResult") -> None:
|
|
403
|
+
"""
|
|
404
|
+
Callback function triggered after processing each image and returns all parsed results.
|
|
405
|
+
For the callback to be triggered, it is essential that the `CodeParserTask` is properly configured.
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
result(ParsedResult): The parsed result.
|
|
409
|
+
"""
|
|
410
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultReceiver_OnParsedResultsReceived(
|
|
411
|
+
self, result
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
_DynamsoftCaptureVisionRouter.CCapturedResultReceiver_register(CapturedResultReceiver)
|
|
416
|
+
|
|
417
|
+
class CapturedResultFilter:
|
|
418
|
+
"""
|
|
419
|
+
The CapturedResultFilter class is responsible for filtering captured results.
|
|
420
|
+
It contains several callback functions for different types of results, including original image, decoded barcodes, recognized text lines, detected quads, normalized images, and parsed results.
|
|
421
|
+
|
|
422
|
+
Methods:
|
|
423
|
+
get_name(self): Gets the name of the captured result filter.
|
|
424
|
+
set_name(self, name: str): Sets the name of the captured result filter.
|
|
425
|
+
"""
|
|
426
|
+
_thisown = property(
|
|
427
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
def __init__(self):
|
|
431
|
+
if type(self) is CapturedResultFilter:
|
|
432
|
+
raise TypeError("Cannot create an instance of an abstract class.")
|
|
433
|
+
else:
|
|
434
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
435
|
+
self, _DynamsoftCaptureVisionRouter.new_CCapturedResultFilter(self)
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CCapturedResultFilter
|
|
439
|
+
|
|
440
|
+
def get_name(self) -> str:
|
|
441
|
+
"""
|
|
442
|
+
Gets the name of the captured result filter.
|
|
443
|
+
|
|
444
|
+
Returns:
|
|
445
|
+
str: The name of the captured result filter.
|
|
446
|
+
"""
|
|
447
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_GetName(self)
|
|
448
|
+
|
|
449
|
+
def set_name(self, name: str) -> None:
|
|
450
|
+
"""
|
|
451
|
+
Sets the name of the captured result filter.
|
|
452
|
+
|
|
453
|
+
Args:
|
|
454
|
+
name(str): The name of the captured result filter.
|
|
455
|
+
"""
|
|
456
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_SetName(self, name)
|
|
457
|
+
|
|
458
|
+
def on_original_image_result_received(
|
|
459
|
+
self, result: OriginalImageResultItem
|
|
460
|
+
) -> None:
|
|
461
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_OnOriginalImageResultReceived(
|
|
462
|
+
self, result
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
def on_decoded_barcodes_received(self, result: "DecodedBarcodesResult") -> None:
|
|
466
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_OnDecodedBarcodesReceived(
|
|
467
|
+
self, result
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
def on_recognized_text_lines_received(
|
|
471
|
+
self, result: "RecognizedTextLinesResult"
|
|
472
|
+
) -> None:
|
|
473
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_OnRecognizedTextLinesReceived(
|
|
474
|
+
self, result
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
def on_processed_document_result_received(self, result: "ProcessedDocumentResult") -> None:
|
|
478
|
+
return _DynamsoftCaptureVisionRouter.CCapturedResultFilter_OnProcessedDocumentReceived(
|
|
479
|
+
self, result
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
def on_parsed_results_received(self, result: "ParsedResult") -> None:
|
|
483
|
+
return (
|
|
484
|
+
_DynamsoftCaptureVisionRouter.CCapturedResultFilter_OnParsedResultsReceived(
|
|
485
|
+
self, result
|
|
486
|
+
)
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
_DynamsoftCaptureVisionRouter.CCapturedResultFilter_register(CapturedResultFilter)
|
|
491
|
+
|
|
492
|
+
class CaptureStateListener(ABC):
|
|
493
|
+
"""
|
|
494
|
+
Defines a listener for capture state changes.
|
|
495
|
+
|
|
496
|
+
Methods:
|
|
497
|
+
on_capture_state_changed(self, state: int) -> None: Called when the capture state changes.
|
|
498
|
+
"""
|
|
499
|
+
_thisown = property(
|
|
500
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
def __init__(self):
|
|
504
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
505
|
+
self, _DynamsoftCaptureVisionRouter.new_CCaptureStateListener(self)
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CCaptureStateListener
|
|
509
|
+
|
|
510
|
+
@abstractmethod
|
|
511
|
+
def on_capture_state_changed(self, state: int) -> None:
|
|
512
|
+
"""
|
|
513
|
+
Called when the capture state changes.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
state (int): The new capture state. It is one of the values of the EnumCaptureState enumeration.
|
|
517
|
+
"""
|
|
518
|
+
pass
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
_DynamsoftCaptureVisionRouter.CCaptureStateListener_register(CaptureStateListener)
|
|
522
|
+
|
|
523
|
+
class ImageSourceStateListener(ABC):
|
|
524
|
+
"""
|
|
525
|
+
Defines a listener for image source state changes.
|
|
526
|
+
|
|
527
|
+
Methods:
|
|
528
|
+
on_image_source_state_received(self, state: int) -> None: This method is called when the state of the image source changes.
|
|
529
|
+
"""
|
|
530
|
+
_thisown = property(
|
|
531
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
def __init__(self):
|
|
535
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
536
|
+
self, _DynamsoftCaptureVisionRouter.new_CImageSourceStateListener(self)
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CImageSourceStateListener
|
|
540
|
+
|
|
541
|
+
@abstractmethod
|
|
542
|
+
def on_image_source_state_received(self, state: int) -> None:
|
|
543
|
+
"""
|
|
544
|
+
This method is called when the state of the image source changes.
|
|
545
|
+
|
|
546
|
+
Args:
|
|
547
|
+
state (int): The state of the image source. It is one of the values of the EnumImageSourceState enumeration.
|
|
548
|
+
"""
|
|
549
|
+
pass
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
_DynamsoftCaptureVisionRouter.CImageSourceStateListener_register(
|
|
553
|
+
ImageSourceStateListener
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
class BufferedItemsManager:
|
|
557
|
+
"""
|
|
558
|
+
Defines a listener for image source state changes.
|
|
559
|
+
|
|
560
|
+
Methods:
|
|
561
|
+
set_max_buffered_items_count(self, count: int) -> None: Sets the maximum number of buffered items.
|
|
562
|
+
get_max_buffered_items_count(self) -> int: Gets the maximum number of buffered items.
|
|
563
|
+
get_buffered_character_item_set(self) -> "BufferedCharacterItemSet": Gets the buffered recognized character items.
|
|
564
|
+
"""
|
|
565
|
+
|
|
566
|
+
_thisown = property(
|
|
567
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
def __init__(self):
|
|
571
|
+
"""
|
|
572
|
+
Initializes a new instance of the BufferedItemsManager class.
|
|
573
|
+
|
|
574
|
+
Raises:
|
|
575
|
+
AttributeError: No constructor defined - class is abstract.
|
|
576
|
+
"""
|
|
577
|
+
raise AttributeError("No constructor defined - class is abstract")
|
|
578
|
+
|
|
579
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CBufferedItemsManager
|
|
580
|
+
|
|
581
|
+
def set_max_buffered_items_count(self, count: int) -> None:
|
|
582
|
+
"""
|
|
583
|
+
Sets the maximum number of buffered items.
|
|
584
|
+
|
|
585
|
+
Args:
|
|
586
|
+
count (int): The maximum number of buffered items.
|
|
587
|
+
"""
|
|
588
|
+
return _DynamsoftCaptureVisionRouter.CBufferedItemsManager_SetMaxBufferedItems(
|
|
589
|
+
self, count
|
|
590
|
+
)
|
|
591
|
+
|
|
592
|
+
def get_max_buffered_items_count(self) -> int:
|
|
593
|
+
"""
|
|
594
|
+
Gets the maximum number of buffered items.
|
|
595
|
+
|
|
596
|
+
Returns:
|
|
597
|
+
int: The maximum number of buffered items.
|
|
598
|
+
"""
|
|
599
|
+
return _DynamsoftCaptureVisionRouter.CBufferedItemsManager_GetMaxBufferedItems(
|
|
600
|
+
self
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
def get_buffered_character_item_set(self) -> "BufferedCharacterItemSet":
|
|
604
|
+
"""
|
|
605
|
+
Gets the buffered recognized character items.
|
|
606
|
+
|
|
607
|
+
Returns:
|
|
608
|
+
BufferedCharacterItemSet: The buffered recognized character items.
|
|
609
|
+
"""
|
|
610
|
+
return _DynamsoftCaptureVisionRouter.CBufferedItemsManager_GetBufferedCharacterItemSet(
|
|
611
|
+
self
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
_DynamsoftCaptureVisionRouter.CBufferedItemsManager_register(BufferedItemsManager)
|
|
615
|
+
|
|
616
|
+
#new
|
|
617
|
+
|
|
618
|
+
class IntermediateResultReceiver:
|
|
619
|
+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
|
|
620
|
+
|
|
621
|
+
def __init__(self):
|
|
622
|
+
if type(self) is IntermediateResultReceiver:
|
|
623
|
+
raise TypeError("Cannot create an instance of an abstract class.")
|
|
624
|
+
else:
|
|
625
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
626
|
+
self, _DynamsoftCaptureVisionRouter.new_CIntermediateResultReceiver(self)
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CIntermediateResultReceiver
|
|
630
|
+
|
|
631
|
+
def on_task_results_received(self, result: IntermediateResult, info: IntermediateResultExtraInfo) -> None:
|
|
632
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTaskResultsReceived(self, result, info)
|
|
633
|
+
|
|
634
|
+
def on_predetected_regions_received(self, result: PredetectedRegionsUnit, info: IntermediateResultExtraInfo) -> None:
|
|
635
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnPredetectedRegionsReceived(self, result, info)
|
|
636
|
+
|
|
637
|
+
def on_localized_barcodes_received(self, result: "LocalizedBarcodesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
638
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnLocalizedBarcodesReceived(self, result, info)
|
|
639
|
+
|
|
640
|
+
def on_decoded_barcodes_received(self, result: "DecodedBarcodesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
641
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnDecodedBarcodesReceived(self, result, info)
|
|
642
|
+
|
|
643
|
+
def on_localized_text_lines_received(self, result: "LocalizedTextLinesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
644
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnLocalizedTextLinesReceived(self, result, info)
|
|
645
|
+
|
|
646
|
+
def on_recognized_text_lines_received(self, result: "RecognizedTextLinesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
647
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnRecognizedTextLinesReceived(self, result, info)
|
|
648
|
+
|
|
649
|
+
def on_detected_quads_received(self, result: "DetectedQuadsUnit", info: IntermediateResultExtraInfo) -> None:
|
|
650
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnDetectedQuadsReceived(self, result, info)
|
|
651
|
+
|
|
652
|
+
def on_deskewed_image_received(self, result: "DeskewedImageUnit", info: IntermediateResultExtraInfo) -> None:
|
|
653
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnDeskewedImageReceived(self, result, info)
|
|
654
|
+
|
|
655
|
+
def on_colour_image_unit_received(self, result: ColourImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
656
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnColourImageUnitReceived(self, result, info)
|
|
657
|
+
|
|
658
|
+
def on_scaled_colour_image_unit_received(self, result: ScaledColourImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
659
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnScaledColourImageUnitReceived(self, result, info)
|
|
660
|
+
|
|
661
|
+
def on_grayscale_image_unit_received(self, result: GrayscaleImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
662
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnGrayscaleImageUnitReceived(self, result, info)
|
|
663
|
+
|
|
664
|
+
def on_transformed_grayscale_image_unit_received(self, result: TransformedGrayscaleImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
665
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTransformedGrayscaleImageUnitReceived(self, result, info)
|
|
666
|
+
|
|
667
|
+
def on_enhanced_grayscale_image_unit_received(self, result: EnhancedGrayscaleImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
668
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnEnhancedGrayscaleImageUnitReceived(self, result, info)
|
|
669
|
+
|
|
670
|
+
def on_binary_image_unit_received(self, result: BinaryImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
671
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnBinaryImageUnitReceived(self, result, info)
|
|
672
|
+
|
|
673
|
+
def on_texture_detection_result_unit_received(self, result: TextureDetectionResultUnit, info: IntermediateResultExtraInfo) -> None:
|
|
674
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTextureDetectionResultUnitReceived(self, result, info)
|
|
675
|
+
|
|
676
|
+
def on_texture_removed_grayscale_image_unit_received(self, result: TextureRemovedGrayscaleImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
677
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTextureRemovedGrayscaleImageUnitReceived(self, result, info)
|
|
678
|
+
|
|
679
|
+
def on_texture_removed_binary_image_unit_received(self, result: TextureRemovedBinaryImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
680
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTextureRemovedBinaryImageUnitReceived(self, result, info)
|
|
681
|
+
|
|
682
|
+
def on_contours_unit_received(self, result: ContoursUnit, info: IntermediateResultExtraInfo) -> None:
|
|
683
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnContoursUnitReceived(self, result, info)
|
|
684
|
+
|
|
685
|
+
def on_short_lines_unit_received(self, result: ShortLinesUnit, info: IntermediateResultExtraInfo) -> None:
|
|
686
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnShortLinesUnitReceived(self, result, info)
|
|
687
|
+
|
|
688
|
+
def on_line_segments_unit_received(self, result: LineSegmentsUnit, info: IntermediateResultExtraInfo) -> None:
|
|
689
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnLineSegmentsUnitReceived(self, result, info)
|
|
690
|
+
|
|
691
|
+
def on_text_zones_unit_received(self, result: TextZonesUnit, info: IntermediateResultExtraInfo) -> None:
|
|
692
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTextZonesUnitReceived(self, result, info)
|
|
693
|
+
|
|
694
|
+
def on_text_removed_binary_image_unit_received(self, result: TextRemovedBinaryImageUnit, info: IntermediateResultExtraInfo) -> None:
|
|
695
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTextRemovedBinaryImageUnitReceived(self, result, info)
|
|
696
|
+
|
|
697
|
+
def on_long_lines_unit_received(self, result: "LongLinesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
698
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnLongLinesUnitReceived(self, result, info)
|
|
699
|
+
|
|
700
|
+
def on_corners_unit_received(self, result: "CornersUnit", info: IntermediateResultExtraInfo) -> None:
|
|
701
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnCornersUnitReceived(self, result, info)
|
|
702
|
+
|
|
703
|
+
def on_candidate_quad_edges_unit_received(self, result: "CandidateQuadEdgesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
704
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnCandidateQuadEdgesUnitReceived(self, result, info)
|
|
705
|
+
|
|
706
|
+
def on_candidate_barcode_zones_unit_received(self, result: "CandidateBarcodeZonesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
707
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnCandidateBarcodeZonesUnitReceived(self, result, info)
|
|
708
|
+
|
|
709
|
+
def on_scaled_barcode_image_unit_received(self, result: "ScaledBarcodeImageUnit", info: IntermediateResultExtraInfo) -> None:
|
|
710
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnScaledBarcodeImageUnitReceived(self, result, info)
|
|
711
|
+
|
|
712
|
+
def on_deformation_resisted_barcode_image_unit_received(self, result: "DeformationResistedBarcodeImageUnit", info: IntermediateResultExtraInfo) -> None:
|
|
713
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnDeformationResistedBarcodeImageUnitReceived(self, result, info)
|
|
714
|
+
|
|
715
|
+
def on_complemented_barcode_image_unit_received(self, result: "ComplementedBarcodeImageUnit", info: IntermediateResultExtraInfo) -> None:
|
|
716
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnComplementedBarcodeImageUnitReceived(self, result, info)
|
|
717
|
+
|
|
718
|
+
def on_raw_text_lines_unit_received(self, result: "RawTextLinesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
719
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnRawTextLinesUnitReceived(self, result, info)
|
|
720
|
+
|
|
721
|
+
def on_logic_lines_unit_received(self, result: "LogicLinesUnit", info: IntermediateResultExtraInfo) -> None:
|
|
722
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnLogicLinesUnitReceived(self, result, info)
|
|
723
|
+
|
|
724
|
+
def on_enhanced_image_received(self, result: "EnhancedImageUnit", info: IntermediateResultExtraInfo) -> None:
|
|
725
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnEnhancedImageReceived(self, result, info)
|
|
726
|
+
|
|
727
|
+
def on_target_roi_results_received(self, result: IntermediateResult, info: IntermediateResultExtraInfo) -> None:
|
|
728
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_OnTargetROIResultsReceived(self, result, info)
|
|
729
|
+
|
|
730
|
+
def on_unit_result_received(self, unit: IntermediateResultUnit, info: IntermediateResultExtraInfo) -> None:
|
|
731
|
+
pass
|
|
732
|
+
|
|
733
|
+
def get_observation_parameters(self) -> ObservationParameters:
|
|
734
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_GetObservationParameters(self)
|
|
735
|
+
|
|
736
|
+
# Register CIntermediateResultReceiver in _DynamsoftCaptureVisionRouter:
|
|
737
|
+
_DynamsoftCaptureVisionRouter.CIntermediateResultReceiver_register(IntermediateResultReceiver)
|
|
738
|
+
class IntermediateResultManager:
|
|
739
|
+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
|
|
740
|
+
|
|
741
|
+
def __init__(self):
|
|
742
|
+
raise AttributeError("No constructor defined - class is abstract")
|
|
743
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CIntermediateResultManager
|
|
744
|
+
|
|
745
|
+
def add_result_receiver(self, receiver: IntermediateResultReceiver) -> int:
|
|
746
|
+
if not hasattr(self, '_receivers') or self._receivers is None:
|
|
747
|
+
self._receivers = []
|
|
748
|
+
self._receivers.append(receiver)
|
|
749
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultManager_AddResultReceiver(self, receiver)
|
|
750
|
+
|
|
751
|
+
def remove_result_receiver(self, receiver: IntermediateResultReceiver) -> int:
|
|
752
|
+
if not hasattr(self, '_receivers') or self._receivers is None:
|
|
753
|
+
self._receivers = []
|
|
754
|
+
self._receivers.remove(receiver)
|
|
755
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultManager_RemoveResultReceiver(self, receiver)
|
|
756
|
+
|
|
757
|
+
def get_original_image(self, image_hash_id: str)->ImageData:
|
|
758
|
+
return _DynamsoftCaptureVisionRouter.CIntermediateResultManager_GetOriginalImage(self, image_hash_id)
|
|
759
|
+
|
|
760
|
+
# Register CIntermediateResultManager in _DynamsoftCaptureVisionRouter:
|
|
761
|
+
_DynamsoftCaptureVisionRouter.CIntermediateResultManager_register(IntermediateResultManager)
|
|
762
|
+
|
|
763
|
+
#new end
|
|
764
|
+
class CaptureVisionRouter:
|
|
765
|
+
"""
|
|
766
|
+
The CaptureVisionRouter class is what a user uses to interact with image-processing and semantic-processing products in their applications.
|
|
767
|
+
It accepts an image source and returns processing results which may contain Final results.
|
|
768
|
+
|
|
769
|
+
Methods:
|
|
770
|
+
init_settings(self, content: str) -> Tuple[int, str]: Loads and initializes a template from a string.
|
|
771
|
+
init_settings_from_file(self, file_path: str) -> Tuple[int, str]: Loads and initializes a template from a file.
|
|
772
|
+
output_settings(self, template_name: str) -> Tuple[int, str, str]: Exports a specific template to a string.
|
|
773
|
+
output_settings_to_file(self, template_name: str, file_path: str) -> Tuple[int, str]: Exports a specific template to a file.
|
|
774
|
+
get_simplified_settings(self, template_name: str) -> Tuple[int, str, SimplifiedCaptureVisionSettings]: Retrieves a simplified version of the capture settings for a specific template.
|
|
775
|
+
update_settings(self, template_name: str, settings: SimplifiedCaptureVisionSettings) -> Tuple[int, str]: Updates a template with simplified capture settings.
|
|
776
|
+
reset_settings(self) -> Tuple[int, str]: Resets all templates to factory settings.
|
|
777
|
+
capture(self, *args) -> CapturedResult: Process an image or file to derive important information. It can optionally use a specified template for the capture.
|
|
778
|
+
set_input(self, adapter: ImageSourceAdapter) -> Tuple[int, str]: Sets an image source to provide images for consecutive process.
|
|
779
|
+
get_input(self) -> ImageSourceAdapter: Gets the attached image source adapter object of the capture vision router.
|
|
780
|
+
add_image_source_state_listener(self, listener: ImageSourceStateListener) -> Tuple[int, str]: Adds an object that listens to state changes of the image source.
|
|
781
|
+
remove_image_source_state_listener(self, listener: ImageSourceStateListener) -> Tuple[int, str]: Removes an object which listens to state changes of the image source.
|
|
782
|
+
add_result_receiver(self, receiver: CapturedResultReceiver) -> Tuple[int, str]: Adds an object as the receiver of captured results.
|
|
783
|
+
remove_result_receiver(self, receiver: CapturedResultReceiver) -> Tuple[int, str]: Removes an object which was added as a receiver of captured results.
|
|
784
|
+
add_result_filter(self, filter: CapturedResultFilter) -> Tuple[int, str]: Adds an object as the filter of captured results.
|
|
785
|
+
remove_result_filter(self, filter: CapturedResultFilter) -> Tuple[int, str]: Removes an object which was added as a filter of captured results.
|
|
786
|
+
add_capture_state_listener(self, listener: CaptureStateListener) -> Tuple[int, str]: Adds an object that listens to the state changes of the capture process.
|
|
787
|
+
remove_capture_state_listener(self, listener: CaptureStateListener) -> Tuple[int, str]: Removes an object which listens to the state changes of the capture process.
|
|
788
|
+
start_capturing(self, template_name: str = "", wait_for_thread_exit: bool = False) -> Tuple[int, str]: Starts to process images consecutively.
|
|
789
|
+
stop_capturing(self, wait_for_remaining_tasks: bool = True, wait_for_thread_exit: bool = True) -> None: Stops the multiple-file processing.
|
|
790
|
+
pause_capturing(self) -> None: Pauses the capture process. The current thread will be blocked until the capture process is resumed.
|
|
791
|
+
resume_capturing(self) -> None: Resumes the capture process. The current thread will be unblocked after the capture process is resumed.
|
|
792
|
+
get_buffered_items_manager(self) -> BufferedItemsManager: Gets a BufferedItemsManager object.
|
|
793
|
+
"""
|
|
794
|
+
|
|
795
|
+
_thisown = property(
|
|
796
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
def __init__(self):
|
|
800
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
801
|
+
self, _DynamsoftCaptureVisionRouter.new_CCaptureVisionRouter()
|
|
802
|
+
)
|
|
803
|
+
self._input = None
|
|
804
|
+
self._intermediate_result_manager = None
|
|
805
|
+
self._cross_filter = []
|
|
806
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CCaptureVisionRouter
|
|
807
|
+
|
|
808
|
+
def init_settings(self, content: str) -> Tuple[int, str]:
|
|
809
|
+
"""
|
|
810
|
+
Loads and initializes a template from a string.
|
|
811
|
+
|
|
812
|
+
Args:
|
|
813
|
+
content (str): The string containing the template.
|
|
814
|
+
|
|
815
|
+
Returns:
|
|
816
|
+
A tuple containing following elements:
|
|
817
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
818
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
819
|
+
"""
|
|
820
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_InitSettings(
|
|
821
|
+
self, content
|
|
822
|
+
)
|
|
823
|
+
|
|
824
|
+
def init_settings_from_file(self, file_path: str) -> Tuple[int, str]:
|
|
825
|
+
"""
|
|
826
|
+
Loads and initializes a template from a file.
|
|
827
|
+
|
|
828
|
+
Args:
|
|
829
|
+
file_path (str): The path to the file containing the template.
|
|
830
|
+
|
|
831
|
+
Returns:
|
|
832
|
+
A tuple containing following elements:
|
|
833
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
834
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
835
|
+
"""
|
|
836
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_InitSettingsFromFile(
|
|
837
|
+
self, file_path
|
|
838
|
+
)
|
|
839
|
+
|
|
840
|
+
def output_settings(self, template_name: str, include_default_values: bool = False) -> Tuple[int, str, str]:
|
|
841
|
+
"""
|
|
842
|
+
Exports a specific template to a string.
|
|
843
|
+
It is supported to export all loaded templates by specifying the template_name as '*'.
|
|
844
|
+
|
|
845
|
+
Args:
|
|
846
|
+
template_name (str): The name of the template to be exported.
|
|
847
|
+
include_default_values (bool): Specifies whether to include default values in the exported template. Default values is False.
|
|
848
|
+
|
|
849
|
+
Returns:
|
|
850
|
+
A tuple containing an error code, a string containing the exported template, and error message.
|
|
851
|
+
"""
|
|
852
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_OutputSettings(
|
|
853
|
+
self, template_name, include_default_values
|
|
854
|
+
)
|
|
855
|
+
|
|
856
|
+
def output_settings_to_file(
|
|
857
|
+
self, template_name: str, file_path: str, include_default_values: bool = False
|
|
858
|
+
) -> Tuple[int, str]:
|
|
859
|
+
"""
|
|
860
|
+
Exports a specific template to a file.
|
|
861
|
+
It is supported to export all loaded templates by specifying the template_name as '*'.
|
|
862
|
+
|
|
863
|
+
Args:
|
|
864
|
+
template_name (str): The name of the template to be exported.
|
|
865
|
+
file_path (str): The path to the output file.
|
|
866
|
+
include_default_values (bool): Specifies whether to include default values in the exported template.
|
|
867
|
+
|
|
868
|
+
Returns:
|
|
869
|
+
A tuple containing following elements:
|
|
870
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
871
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
872
|
+
"""
|
|
873
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_OutputSettingsToFile(
|
|
874
|
+
self, template_name, file_path, include_default_values
|
|
875
|
+
)
|
|
876
|
+
|
|
877
|
+
def get_simplified_settings(
|
|
878
|
+
self, template_name: str
|
|
879
|
+
) -> Tuple[int, str, SimplifiedCaptureVisionSettings]:
|
|
880
|
+
"""
|
|
881
|
+
Retrieves a simplified version of the capture settings for a specific template.
|
|
882
|
+
|
|
883
|
+
Args:
|
|
884
|
+
template_name (str): The name of the template.
|
|
885
|
+
|
|
886
|
+
Returns:
|
|
887
|
+
A tuple containing an error code, error message, and a SimplifiedCaptureVisionSettings object.
|
|
888
|
+
"""
|
|
889
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_GetSimplifiedSettings(
|
|
890
|
+
self, template_name
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
def update_settings(
|
|
894
|
+
self, template_name: str, settings: SimplifiedCaptureVisionSettings
|
|
895
|
+
) -> Tuple[int, str]:
|
|
896
|
+
"""
|
|
897
|
+
Updates a template with simplified capture settings.
|
|
898
|
+
|
|
899
|
+
Args:
|
|
900
|
+
template_name (str): The name of the template to update.
|
|
901
|
+
settings (SimplifiedCaptureVisionSettings): A pointer to a SimplifiedCaptureVisionSettings object.
|
|
902
|
+
|
|
903
|
+
Returns:
|
|
904
|
+
A tuple containing following elements:
|
|
905
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
906
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
907
|
+
"""
|
|
908
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_UpdateSettings(
|
|
909
|
+
self, template_name, settings
|
|
910
|
+
)
|
|
911
|
+
|
|
912
|
+
def reset_settings(self) -> Tuple[int, str]:
|
|
913
|
+
"""
|
|
914
|
+
Resets all templates to factory settings.
|
|
915
|
+
|
|
916
|
+
Returns:
|
|
917
|
+
A tuple containing following elements:
|
|
918
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
919
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
920
|
+
"""
|
|
921
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_ResetSettings(self)
|
|
922
|
+
|
|
923
|
+
def capture(self, *args) -> CapturedResult:
|
|
924
|
+
"""
|
|
925
|
+
Process an image or file to derive important information. It can optionally use a specified template for the capture.
|
|
926
|
+
|
|
927
|
+
Args:
|
|
928
|
+
A variable-length argument list. Can be one of the following:
|
|
929
|
+
- file_path (str), template_name (str, optional): Specifies the path of the file to process and the template to use for capturing.
|
|
930
|
+
- file_bytes (bytes), template_name (str, optional): Specifies the image file bytes in memory to process and the template to use for capturing.
|
|
931
|
+
- image_data (ImageData), template_name (str, optional): Specifies the image data to process and the template to use for capturing.
|
|
932
|
+
- image (numpy.ndarray), image_pixel_format (EnumImagePixelFormat, optional), template_name (str, optional): Decodes barcodes from the memory buffer containing image pixels in defined format.
|
|
933
|
+
|
|
934
|
+
Returns:
|
|
935
|
+
A CapturedResult object containing the captured items.
|
|
936
|
+
"""
|
|
937
|
+
if len(args) not in {1, 2, 3}:
|
|
938
|
+
raise ValueError("Method capture only accepts 1 to 3 arguments")
|
|
939
|
+
image = args[0]
|
|
940
|
+
template_name = ""
|
|
941
|
+
if not isinstance(image, str) and not isinstance(image, bytes) and not isinstance(image, ImageData) and image is not None:
|
|
942
|
+
pixel_format = EnumImagePixelFormat.IPF_RGB_888
|
|
943
|
+
if len(args) > 1:
|
|
944
|
+
for arg in args[1:]:
|
|
945
|
+
if isinstance(arg, str):
|
|
946
|
+
template_name = arg
|
|
947
|
+
elif isinstance(arg, EnumImagePixelFormat):
|
|
948
|
+
pixel_format = arg
|
|
949
|
+
image = ImageData(image.tobytes(),image.shape[1],image.shape[0],image.strides[0], pixel_format)
|
|
950
|
+
else:
|
|
951
|
+
if len(args) == 2:
|
|
952
|
+
template_name = args[1]
|
|
953
|
+
|
|
954
|
+
ret = _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_Capture(self, image, template_name)
|
|
955
|
+
return ret
|
|
956
|
+
|
|
957
|
+
def capture_multi_pages(self, file: Union[str, bytes], template_name: str = "") -> CapturedResultArray:
|
|
958
|
+
"""
|
|
959
|
+
Processes a multi-page image file to derive important information. It can optionally use a specified template for the capture.
|
|
960
|
+
|
|
961
|
+
Args:
|
|
962
|
+
file (Union[str, bytes]): Specifies the path of the file or the memory location containing the image to be processed.
|
|
963
|
+
template_name (str, optional): Specifies the template to use for capturing. Default value is an empty string which means the factory default template.
|
|
964
|
+
|
|
965
|
+
Returns:
|
|
966
|
+
A 'CapturedResultArray' object containing the captured result.
|
|
967
|
+
"""
|
|
968
|
+
if isinstance(file, str):
|
|
969
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_CaptureMultiPages(self, file, template_name)
|
|
970
|
+
elif isinstance(file, bytes):
|
|
971
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_CaptureMultiPagesFromMemory(self, file, template_name)
|
|
972
|
+
else:
|
|
973
|
+
raise TypeError("The input must be a string or bytes")
|
|
974
|
+
|
|
975
|
+
def set_input(self, adapter: ImageSourceAdapter) -> Tuple[int, str]:
|
|
976
|
+
"""
|
|
977
|
+
Sets an image source to provide images for consecutive process.
|
|
978
|
+
|
|
979
|
+
Args:
|
|
980
|
+
adapter (ImageSourceAdapter): Specifies an object which has implemented the ImageSourceAdapter Class.
|
|
981
|
+
|
|
982
|
+
Returns:
|
|
983
|
+
A tuple containing following elements:
|
|
984
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
985
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
986
|
+
"""
|
|
987
|
+
ret = _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_SetInput(self, adapter)
|
|
988
|
+
if ret[0] == 0:
|
|
989
|
+
self._input = adapter
|
|
990
|
+
return ret
|
|
991
|
+
|
|
992
|
+
def get_input(self) -> ImageSourceAdapter:
|
|
993
|
+
"""
|
|
994
|
+
Gets the attached image source adapter object of the capture vision router.
|
|
995
|
+
|
|
996
|
+
Returns:
|
|
997
|
+
The attached image source adapter object of the capture vision router.
|
|
998
|
+
"""
|
|
999
|
+
return self._input
|
|
1000
|
+
|
|
1001
|
+
def add_image_source_state_listener(
|
|
1002
|
+
self, listener: ImageSourceStateListener
|
|
1003
|
+
) -> Tuple[int, str]:
|
|
1004
|
+
"""
|
|
1005
|
+
Adds an object that listens to state changes of the image source.
|
|
1006
|
+
|
|
1007
|
+
Args:
|
|
1008
|
+
listener (ImageSourceStateListener): Specifies a listening object of the type ImageSourceStateListener.
|
|
1009
|
+
|
|
1010
|
+
Returns:
|
|
1011
|
+
A tuple containing following elements:
|
|
1012
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1013
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1014
|
+
"""
|
|
1015
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AddImageSourceStateListener(
|
|
1016
|
+
self, listener
|
|
1017
|
+
)
|
|
1018
|
+
|
|
1019
|
+
def remove_image_source_state_listener(
|
|
1020
|
+
self, listener: ImageSourceStateListener
|
|
1021
|
+
) -> Tuple[int, str]:
|
|
1022
|
+
"""
|
|
1023
|
+
Removes an object which listens to state changes of the image source.
|
|
1024
|
+
|
|
1025
|
+
Args:
|
|
1026
|
+
listener (ImageSourceStateListener): Specifies a listening object of the type ImageSourceStateListener.
|
|
1027
|
+
|
|
1028
|
+
Returns:
|
|
1029
|
+
A tuple containing following elements:
|
|
1030
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1031
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1032
|
+
"""
|
|
1033
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_RemoveImageSourceStateListener(
|
|
1034
|
+
self, listener
|
|
1035
|
+
)
|
|
1036
|
+
|
|
1037
|
+
def add_result_receiver(self, receiver: CapturedResultReceiver) -> Tuple[int, str]:
|
|
1038
|
+
"""
|
|
1039
|
+
Adds an object as the receiver of captured results.
|
|
1040
|
+
|
|
1041
|
+
Args:
|
|
1042
|
+
receiver (CapturedResultReceiver): Specifies a receiver object of the type CapturedResultReceiver.
|
|
1043
|
+
|
|
1044
|
+
Returns:
|
|
1045
|
+
A tuple containing following elements:
|
|
1046
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1047
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1048
|
+
"""
|
|
1049
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AddResultReceiver(
|
|
1050
|
+
self, receiver
|
|
1051
|
+
)
|
|
1052
|
+
|
|
1053
|
+
def remove_result_receiver(
|
|
1054
|
+
self, receiver: CapturedResultReceiver
|
|
1055
|
+
) -> Tuple[int, str]:
|
|
1056
|
+
"""
|
|
1057
|
+
Removes an object which was added as a receiver of captured results.
|
|
1058
|
+
|
|
1059
|
+
Args:
|
|
1060
|
+
receiver (CapturedResultReceiver): Specifies a receiver object of the type CapturedResultReceiver.
|
|
1061
|
+
|
|
1062
|
+
Returns:
|
|
1063
|
+
A tuple containing following elements:
|
|
1064
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1065
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1066
|
+
"""
|
|
1067
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_RemoveResultReceiver(
|
|
1068
|
+
self, receiver
|
|
1069
|
+
)
|
|
1070
|
+
|
|
1071
|
+
def add_result_filter(self, filter: CapturedResultFilter) -> Tuple[int, str]:
|
|
1072
|
+
"""
|
|
1073
|
+
Adds an object as the filter of captured results.
|
|
1074
|
+
|
|
1075
|
+
Args:
|
|
1076
|
+
filter (CapturedResultFilter): Specifies a filter object of the type CapturedResultFilter.
|
|
1077
|
+
|
|
1078
|
+
Returns:
|
|
1079
|
+
A tuple containing following elements:
|
|
1080
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1081
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1082
|
+
"""
|
|
1083
|
+
if any(filter is x for x in self._cross_filter):
|
|
1084
|
+
return (0, "Success.")
|
|
1085
|
+
self._cross_filter.append(filter)
|
|
1086
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AddResultFilter(
|
|
1087
|
+
self, filter
|
|
1088
|
+
)
|
|
1089
|
+
|
|
1090
|
+
def remove_result_filter(self, filter: CapturedResultFilter) -> Tuple[int, str]:
|
|
1091
|
+
"""
|
|
1092
|
+
Removes an object which was added as a filter of captured results.
|
|
1093
|
+
|
|
1094
|
+
Args:
|
|
1095
|
+
filter (CapturedResultFilter): Specifies a filter object of the type CapturedResultFilter.
|
|
1096
|
+
|
|
1097
|
+
Returns:
|
|
1098
|
+
A tuple containing following elements:
|
|
1099
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1100
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1101
|
+
"""
|
|
1102
|
+
index = -1
|
|
1103
|
+
for i, x in enumerate(self._cross_filter):
|
|
1104
|
+
if x is filter:
|
|
1105
|
+
index = i
|
|
1106
|
+
break
|
|
1107
|
+
if index != -1:
|
|
1108
|
+
self._cross_filter.pop(index)
|
|
1109
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_RemoveResultFilter(
|
|
1110
|
+
self, filter
|
|
1111
|
+
)
|
|
1112
|
+
return (0, "Success.")
|
|
1113
|
+
def add_capture_state_listener(
|
|
1114
|
+
self, listener: CaptureStateListener
|
|
1115
|
+
) -> Tuple[int, str]:
|
|
1116
|
+
"""
|
|
1117
|
+
Adds an object that listens to the state changes of the capture process.
|
|
1118
|
+
|
|
1119
|
+
Args:
|
|
1120
|
+
listener (CaptureStateListener): Specifies a listening object of the type CaptureStateListener.
|
|
1121
|
+
|
|
1122
|
+
Returns:
|
|
1123
|
+
A tuple containing following elements:
|
|
1124
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1125
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1126
|
+
"""
|
|
1127
|
+
return (
|
|
1128
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AddCaptureStateListener(
|
|
1129
|
+
self, listener
|
|
1130
|
+
)
|
|
1131
|
+
)
|
|
1132
|
+
def remove_capture_state_listener(
|
|
1133
|
+
self, listener: CaptureStateListener
|
|
1134
|
+
) -> Tuple[int, str]:
|
|
1135
|
+
"""
|
|
1136
|
+
Removes an object which listens to the state changes of the capture process.
|
|
1137
|
+
|
|
1138
|
+
Args:
|
|
1139
|
+
listener (CaptureStateListener): Specifies a listening object of the type CaptureStateListener.
|
|
1140
|
+
|
|
1141
|
+
Returns:
|
|
1142
|
+
A tuple containing following elements:
|
|
1143
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1144
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1145
|
+
"""
|
|
1146
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_RemoveCaptureStateListener(
|
|
1147
|
+
self, listener
|
|
1148
|
+
)
|
|
1149
|
+
|
|
1150
|
+
def start_capturing(
|
|
1151
|
+
self, template_name: str = "", wait_for_thread_exit: bool = False
|
|
1152
|
+
) -> Tuple[int, str]:
|
|
1153
|
+
"""
|
|
1154
|
+
Starts to process images consecutively.
|
|
1155
|
+
|
|
1156
|
+
Args:
|
|
1157
|
+
template_name (str): Specifies a template to use for capturing. Setting an empty string means the factory default template.
|
|
1158
|
+
wait_for_thread_exit (bool): Indicates whether to wait for the capture process to complete before returning. The default value is False.
|
|
1159
|
+
|
|
1160
|
+
Returns:
|
|
1161
|
+
A tuple containing following elements:
|
|
1162
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1163
|
+
- error_message <str>: A descriptive message explaining the error.
|
|
1164
|
+
"""
|
|
1165
|
+
ret = _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_StartCapturing(
|
|
1166
|
+
self, template_name, wait_for_thread_exit
|
|
1167
|
+
)
|
|
1168
|
+
return ret
|
|
1169
|
+
|
|
1170
|
+
def stop_capturing(
|
|
1171
|
+
self, wait_for_remaining_tasks: bool = True, wait_for_thread_exit: bool = True
|
|
1172
|
+
) -> None:
|
|
1173
|
+
"""
|
|
1174
|
+
Stops the multiple-file processing.
|
|
1175
|
+
|
|
1176
|
+
Args:
|
|
1177
|
+
wait_for_remaining_tasks (bool): Indicates whether to wait for the remaining tasks to complete before returning. The default value is True.
|
|
1178
|
+
wait_for_thread_exit (bool): Indicates whether to wait for the capture process to complete before returning. The default value is True.
|
|
1179
|
+
"""
|
|
1180
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_StopCapturing(
|
|
1181
|
+
self, wait_for_remaining_tasks, wait_for_thread_exit
|
|
1182
|
+
)
|
|
1183
|
+
|
|
1184
|
+
def pause_capturing(self) -> None:
|
|
1185
|
+
"""
|
|
1186
|
+
Pauses the capture process. The current thread will be blocked until the capture process is resumed.
|
|
1187
|
+
"""
|
|
1188
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_PauseCapturing(self)
|
|
1189
|
+
|
|
1190
|
+
def resume_capturing(self) -> None:
|
|
1191
|
+
"""
|
|
1192
|
+
Resumes the capture process. The current thread will be unblocked after the capture process is resumed.
|
|
1193
|
+
"""
|
|
1194
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_ResumeCapturing(self)
|
|
1195
|
+
|
|
1196
|
+
def get_buffered_items_manager(self) -> BufferedItemsManager:
|
|
1197
|
+
"""
|
|
1198
|
+
Gets a BufferedItemsManager object.
|
|
1199
|
+
|
|
1200
|
+
Returns:
|
|
1201
|
+
A BufferedItemsManager object.
|
|
1202
|
+
"""
|
|
1203
|
+
return (
|
|
1204
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouter_GetBufferedItemsManager(
|
|
1205
|
+
self
|
|
1206
|
+
)
|
|
1207
|
+
)
|
|
1208
|
+
|
|
1209
|
+
def get_parameter_template_count(self) -> int:
|
|
1210
|
+
"""
|
|
1211
|
+
Gets the count of parameter templates.
|
|
1212
|
+
|
|
1213
|
+
Returns:
|
|
1214
|
+
An integer representing the count of parameter templates.
|
|
1215
|
+
"""
|
|
1216
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_GetParameterTemplateCount(self)
|
|
1217
|
+
|
|
1218
|
+
def get_parameter_template_name(self, index: int) -> Tuple[int, str]:
|
|
1219
|
+
"""
|
|
1220
|
+
Gets the name of a parameter template at the specified index.
|
|
1221
|
+
|
|
1222
|
+
Args:
|
|
1223
|
+
index (int): Specifies the index of the parameter template.
|
|
1224
|
+
|
|
1225
|
+
Returns:
|
|
1226
|
+
A tuple containing following elements:
|
|
1227
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1228
|
+
- template_name (str): The name of the parameter template.
|
|
1229
|
+
"""
|
|
1230
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_GetParameterTemplateName(self, index)
|
|
1231
|
+
|
|
1232
|
+
@staticmethod
|
|
1233
|
+
def append_model_buffer(model_name: str, model_buffer: bytes, max_model_instances: int) -> Tuple[int, str]:
|
|
1234
|
+
"""
|
|
1235
|
+
Appends a model to the model buffer.
|
|
1236
|
+
|
|
1237
|
+
Args:
|
|
1238
|
+
model_name (str): Specifies the name of the model.
|
|
1239
|
+
model_buffer (bytes): Specifies the model buffer in bytes.
|
|
1240
|
+
max_model_instances (int): Specifies the maximum number of model instances.
|
|
1241
|
+
|
|
1242
|
+
Returns:
|
|
1243
|
+
A tuple containing following elements:
|
|
1244
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1245
|
+
- error_message (str): A descriptive message explaining the error.
|
|
1246
|
+
"""
|
|
1247
|
+
import warnings
|
|
1248
|
+
warnings.warn(
|
|
1249
|
+
"Function 'append_model_buffer' Will be removed in future versions. Please use `append_dl_model_buffer` function instead.",
|
|
1250
|
+
DeprecationWarning,
|
|
1251
|
+
stacklevel=2
|
|
1252
|
+
)
|
|
1253
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AppendModelBuffer(
|
|
1254
|
+
model_name, model_buffer, max_model_instances
|
|
1255
|
+
)
|
|
1256
|
+
|
|
1257
|
+
@staticmethod
|
|
1258
|
+
def append_dl_model_buffer(model_name: str, model_buffer: bytes, max_model_instances: int) -> Tuple[int, str]:
|
|
1259
|
+
"""
|
|
1260
|
+
Appends a deep learning model to the memory buffer.
|
|
1261
|
+
|
|
1262
|
+
Args:
|
|
1263
|
+
model_name (str): The name of the model.
|
|
1264
|
+
model_buffer (bytes): The bytes of the model.
|
|
1265
|
+
max_model_instances (int): The max instances created for the model.
|
|
1266
|
+
|
|
1267
|
+
Returns:
|
|
1268
|
+
A tuple containing following elements:
|
|
1269
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1270
|
+
- error_message (str): A descriptive message explaining the error.
|
|
1271
|
+
"""
|
|
1272
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_AppendDLModelBuffer(
|
|
1273
|
+
model_name, model_buffer, max_model_instances
|
|
1274
|
+
)
|
|
1275
|
+
|
|
1276
|
+
@staticmethod
|
|
1277
|
+
def clear_dl_model_buffers() -> None:
|
|
1278
|
+
"""
|
|
1279
|
+
Clears all deep learning models from buffer to free up memory.
|
|
1280
|
+
"""
|
|
1281
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouter_ClearDLModelBuffers()
|
|
1282
|
+
|
|
1283
|
+
def switch_capturing_template(self, template_name: str) -> Tuple[int, str]:
|
|
1284
|
+
"""
|
|
1285
|
+
Switch the capturing template during the image processing workflow.
|
|
1286
|
+
|
|
1287
|
+
Args:
|
|
1288
|
+
template_name (str): The name of the new capturing template to apply.
|
|
1289
|
+
|
|
1290
|
+
Returns:
|
|
1291
|
+
A tuple containing following elements:
|
|
1292
|
+
- error_code (int): The error code indicating the status of the operation.
|
|
1293
|
+
- error_message (str): A descriptive message explaining the error.
|
|
1294
|
+
"""
|
|
1295
|
+
return _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_SwitchCapturingTemplate(self, template_name)
|
|
1296
|
+
|
|
1297
|
+
@staticmethod
|
|
1298
|
+
def set_global_intra_op_num_threads(intra_op_num_threads: int) -> None:
|
|
1299
|
+
"""
|
|
1300
|
+
Sets the global number of threads used internally for model execution.
|
|
1301
|
+
|
|
1302
|
+
Args:
|
|
1303
|
+
intra_op_num_threads (int): Number of threads used internally for model execution. Valid range: [0, 256]. If the value is outside the range [0, 256], it will be treated as 0 (default).
|
|
1304
|
+
"""
|
|
1305
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouter_SetGlobalIntraOpNumThreads(intra_op_num_threads)
|
|
1306
|
+
|
|
1307
|
+
def get_intermediate_result_manager(self)->IntermediateResultManager:
|
|
1308
|
+
if self._intermediate_result_manager is None:
|
|
1309
|
+
self._intermediate_result_manager = _DynamsoftCaptureVisionRouter.CCaptureVisionRouter_GetIntermediateResultManager(self)
|
|
1310
|
+
return self._intermediate_result_manager
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouter_register(CaptureVisionRouter)
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
class CaptureVisionRouterModule:
|
|
1317
|
+
"""
|
|
1318
|
+
The CaptureVisionRouterModule class defines general functions in the capture vision router module.
|
|
1319
|
+
|
|
1320
|
+
Methods:
|
|
1321
|
+
get_version() -> str: Returns the version of the capture vision router module.
|
|
1322
|
+
"""
|
|
1323
|
+
_thisown = property(
|
|
1324
|
+
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
|
|
1325
|
+
)
|
|
1326
|
+
|
|
1327
|
+
@staticmethod
|
|
1328
|
+
def get_version() -> str:
|
|
1329
|
+
"""
|
|
1330
|
+
Returns the version of the capture vision router module.
|
|
1331
|
+
|
|
1332
|
+
Returns:
|
|
1333
|
+
A string representing the version of the capture vision router module.
|
|
1334
|
+
"""
|
|
1335
|
+
return __version__ + " (Algorithm " + _DynamsoftCaptureVisionRouter.CCaptureVisionRouterModule_GetVersion() + ")"
|
|
1336
|
+
|
|
1337
|
+
def __init__(self):
|
|
1338
|
+
_DynamsoftCaptureVisionRouter.Class_init(
|
|
1339
|
+
self, _DynamsoftCaptureVisionRouter.new_CCaptureVisionRouterModule()
|
|
1340
|
+
)
|
|
1341
|
+
|
|
1342
|
+
__destroy__ = _DynamsoftCaptureVisionRouter.delete_CCaptureVisionRouterModule
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
_DynamsoftCaptureVisionRouter.CCaptureVisionRouterModule_register(
|
|
1346
|
+
CaptureVisionRouterModule
|
|
1347
|
+
)
|