Skip to content

Commit 6661b85

Browse files
test
1 parent 07e5371 commit 6661b85

16 files changed

+6912
-4547
lines changed

dynamsoft_capture_vision_bundle/core.py

Lines changed: 653 additions & 36 deletions
Large diffs are not rendered by default.

dynamsoft_capture_vision_bundle/cvr.py

Lines changed: 156 additions & 23 deletions
Large diffs are not rendered by default.

dynamsoft_capture_vision_bundle/dbr.py

Lines changed: 300 additions & 22 deletions
Large diffs are not rendered by default.

dynamsoft_capture_vision_bundle/dcp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ParsedResultItem(CapturedResultItem):
3838
get_field_validation_status(self, field_name: str) -> int: Gets the validation status of a specified field from the parsed result.
3939
get_json_string(self) -> str: Gets the parsed result as a JSON formatted string.
4040
"""
41-
thisown = property(
41+
_thisown = property(
4242
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
4343
)
4444

@@ -107,7 +107,7 @@ def get_field_validation_status(self, field_name: str) -> int:
107107
_DynamsoftCodeParser.CParsedResultItem_register(ParsedResultItem)
108108

109109

110-
class ParsedResult(object):
110+
class ParsedResult:
111111
"""
112112
The ParsedResult class represents the results of a code parser process.
113113
@@ -118,7 +118,7 @@ class ParsedResult(object):
118118
get_error_code(self) -> int: Gets the error code of the parsed result, if an error occurred.
119119
get_error_string(self) -> str: Gets the error message of the parsed result, if an error occurred.
120120
"""
121-
thisown = property(
121+
_thisown = property(
122122
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
123123
)
124124
__destroy__ = _DynamsoftCodeParser.CParsedResult_Release
@@ -179,14 +179,14 @@ def get_error_string(self) -> str:
179179
_DynamsoftCodeParser.CParsedResult_register(ParsedResult)
180180

181181

182-
class CodeParserModule(object):
182+
class CodeParserModule:
183183
"""
184184
The CodeParserModule class defines general functions in the code parser module.
185185
186186
Methods:
187187
get_version() -> str: Returns a string representing the version of the code parser module.
188188
"""
189-
thisown = property(
189+
_thisown = property(
190190
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
191191
)
192192

@@ -201,7 +201,7 @@ def get_version() -> str:
201201
return __version__ + " (Algotithm " + _DynamsoftCodeParser.CCodeParserModule_GetVersion() + ")"
202202

203203
def __init__(self):
204-
_DynamsoftCodeParser.CCodeParserModule_init(
204+
_DynamsoftCodeParser.Class_init(
205205
self, _DynamsoftCodeParser.new_CCodeParserModule()
206206
)
207207

dynamsoft_capture_vision_bundle/ddn.py

Lines changed: 173 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from . import _DynamsoftDocumentNormalizer
1010
else:
1111
import _DynamsoftDocumentNormalizer
12-
from typing import List
12+
from typing import List, Tuple
1313

1414

1515
from enum import IntEnum
@@ -20,7 +20,7 @@ class EnumImageColourMode(IntEnum):
2020
ICM_GRAYSCALE = _DynamsoftDocumentNormalizer.ICM_GRAYSCALE
2121
ICM_BINARY = _DynamsoftDocumentNormalizer.ICM_BINARY
2222

23-
class SimplifiedDocumentNormalizerSettings(object):
23+
class SimplifiedDocumentNormalizerSettings:
2424
"""
2525
The SimplifiedDocumentNormalizerSettings class contains settings for document normalization. It is a sub-parameter of SimplifiedCaptureVisionSettings.
2626
@@ -36,7 +36,7 @@ class SimplifiedDocumentNormalizerSettings(object):
3636
min_quadrilateral_area_ratio(int): Specifies the minimum ratio between the target quadrilateral area and the total image area. Only those exceeding this value will be output (measured in percentages).
3737
expected_documents_count(int): Specifies the number of documents expected to be detected.
3838
"""
39-
thisown = property(
39+
_thisown = property(
4040
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
4141
)
4242

@@ -126,7 +126,7 @@ class SimplifiedDocumentNormalizerSettings(object):
126126
)
127127

128128
def __init__(self):
129-
_DynamsoftDocumentNormalizer.SimplifiedDocumentNormalizerSettings_init(
129+
_DynamsoftDocumentNormalizer.Class_init(
130130
self,
131131
_DynamsoftDocumentNormalizer.new_SimplifiedDocumentNormalizerSettings(),
132132
)
@@ -148,7 +148,7 @@ class DetectedQuadResultItem(CapturedResultItem):
148148
get_location(self) -> Quadrilateral: Gets the location of current object.
149149
get_confidence_as_document_boundary(self) -> int: Gets the confidence of current object as a document boundary.
150150
"""
151-
thisown = property(
151+
_thisown = property(
152152
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
153153
)
154154

@@ -187,7 +187,7 @@ class NormalizedImageResultItem(CapturedResultItem):
187187
get_image_data(self) -> ImageData: Gets the image data of current object.
188188
get_location(self) -> Quadrilateral: Gets the location of current object.
189189
"""
190-
thisown = property(
190+
_thisown = property(
191191
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
192192
)
193193

@@ -219,7 +219,7 @@ def get_location(self) -> Quadrilateral:
219219
NormalizedImageResultItem
220220
)
221221

222-
class DetectedQuadsResult(object):
222+
class DetectedQuadsResult:
223223
"""
224224
The DetectedQuadsResult class stores a captured result whose type is detected quads.
225225
@@ -231,7 +231,7 @@ class DetectedQuadsResult(object):
231231
get_original_image_hash_id(self) -> str: Gets the hash ID of the original image.
232232
get_original_image_tag(self) -> ImageTag: Gets the tag of the original image.
233233
"""
234-
thisown = property(
234+
_thisown = property(
235235
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
236236
)
237237

@@ -309,7 +309,7 @@ def get_error_string(self) -> str:
309309

310310
_DynamsoftDocumentNormalizer.CDetectedQuadsResult_register(DetectedQuadsResult)
311311

312-
class NormalizedImagesResult(object):
312+
class NormalizedImagesResult:
313313
"""
314314
The NormalizedImagesResult class stores a collection of captured result items whose type are normalized images.
315315
@@ -321,7 +321,7 @@ class NormalizedImagesResult(object):
321321
get_original_image_hash_id(self) -> str: Gets the hash ID of the original image that was normalized.
322322
get_original_image_tag(self) -> ImageTag: Gets the tag of the original image that was normalized.
323323
"""
324-
thisown = property(
324+
_thisown = property(
325325
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
326326
)
327327

@@ -402,14 +402,14 @@ def get_error_string(self) -> str:
402402
_DynamsoftDocumentNormalizer.CNormalizedImagesResult_register(NormalizedImagesResult)
403403

404404

405-
class DocumentNormalizerModule(object):
405+
class DocumentNormalizerModule:
406406
"""
407407
The DocumentNormalizerModule class defines general functions in the document normalizer module.
408408
409409
Methods:
410410
get_version() -> str: Returns the version of the document normalizer module.
411411
"""
412-
thisown = property(
412+
_thisown = property(
413413
lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag"
414414
)
415415

@@ -424,7 +424,7 @@ def get_version() -> str:
424424
return __version__ + " (Algotithm " + _DynamsoftDocumentNormalizer.CDocumentNormalizerModule_GetVersion() + ")"
425425

426426
def __init__(self):
427-
_DynamsoftDocumentNormalizer.CDocumentNormalizerModule_init(
427+
_DynamsoftDocumentNormalizer.Class_init(
428428
self, _DynamsoftDocumentNormalizer.new_CDocumentNormalizerModule()
429429
)
430430

@@ -434,3 +434,163 @@ def __init__(self):
434434
_DynamsoftDocumentNormalizer.CDocumentNormalizerModule_register(
435435
DocumentNormalizerModule
436436
)
437+
438+
439+
#new
440+
441+
class DetectedQuadElement(RegionObjectElement):
442+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
443+
444+
def __init__(self, *args, **kwargs):
445+
_DynamsoftDocumentNormalizer.Class_init(
446+
self, _DynamsoftDocumentNormalizer.CDocumentNormalizerModule_CreateDetectedQuadElement()
447+
)
448+
449+
def get_confidence_as_document_boundary(self) -> int:
450+
return _DynamsoftDocumentNormalizer.CDetectedQuadElement_GetConfidenceAsDocumentBoundary(self)
451+
452+
# Register CDetectedQuadElement in _DynamsoftDocumentNormalizer:
453+
_DynamsoftDocumentNormalizer.CDetectedQuadElement_register(DetectedQuadElement)
454+
class NormalizedImageElement(RegionObjectElement):
455+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
456+
457+
def __init__(self, *args, **kwargs):
458+
_DynamsoftDocumentNormalizer.Class_init(
459+
self, _DynamsoftDocumentNormalizer.CDocumentNormalizerModule_CreateNormalizedImageElement()
460+
)
461+
462+
463+
def get_image_data(self) -> ImageData:
464+
return _DynamsoftDocumentNormalizer.CNormalizedImageElement_GetImageData(self)
465+
466+
# Register CNormalizedImageElement in _DynamsoftDocumentNormalizer:
467+
_DynamsoftDocumentNormalizer.CNormalizedImageElement_register(NormalizedImageElement)
468+
class LongLinesUnit(IntermediateResultUnit):
469+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
470+
471+
def __init__(self, *args, **kwargs):
472+
raise AttributeError("No constructor defined - class is abstract")
473+
474+
475+
def get_count(self) -> int:
476+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_GetCount(self)
477+
478+
def get_long_line(self, index: int) -> LineSegment:
479+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_GetLongLine(self, index)
480+
481+
def remove_all_long_lines(self) -> None:
482+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_RemoveAllLongLines(self)
483+
484+
def remove_long_line(self, index: int) -> int:
485+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_RemoveLongLine(self, index)
486+
487+
def add_long_line(self, line: LineSegment, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
488+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_AddLongLine(self, line, matrix_to_original_image)
489+
490+
def set_long_line(self, index: int, line: LineSegment, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
491+
return _DynamsoftDocumentNormalizer.CLongLinesUnit_SetLongLine(self, index, line, matrix_to_original_image)
492+
493+
# Register CLongLinesUnit in _DynamsoftDocumentNormalizer:
494+
_DynamsoftDocumentNormalizer.CLongLinesUnit_register(LongLinesUnit)
495+
class CornersUnit(IntermediateResultUnit):
496+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
497+
498+
def __init__(self, *args, **kwargs):
499+
raise AttributeError("No constructor defined - class is abstract")
500+
501+
502+
def get_count(self) -> int:
503+
return _DynamsoftDocumentNormalizer.CCornersUnit_GetCount(self)
504+
505+
def get_corner(self, index: int) -> Tuple[int, Corner]:
506+
return _DynamsoftDocumentNormalizer.CCornersUnit_GetCorner(self, index)
507+
508+
def remove_all_corners(self) -> None:
509+
return _DynamsoftDocumentNormalizer.CCornersUnit_RemoveAllCorners(self)
510+
511+
def remove_corner(self, index: int) -> int:
512+
return _DynamsoftDocumentNormalizer.CCornersUnit_RemoveCorner(self, index)
513+
514+
def add_corner(self, corner: Corner, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
515+
return _DynamsoftDocumentNormalizer.CCornersUnit_AddCorner(self, corner, matrix_to_original_image)
516+
517+
def set_corner(self, index: int, corner: Corner, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
518+
return _DynamsoftDocumentNormalizer.CCornersUnit_SetCorner(self, index, corner, matrix_to_original_image)
519+
520+
# Register CCornersUnit in _DynamsoftDocumentNormalizer:
521+
_DynamsoftDocumentNormalizer.CCornersUnit_register(CornersUnit)
522+
class CandidateQuadEdgesUnit(IntermediateResultUnit):
523+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
524+
525+
def __init__(self, *args, **kwargs):
526+
raise AttributeError("No constructor defined - class is abstract")
527+
528+
529+
def get_count(self) -> int:
530+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_GetCount(self)
531+
532+
def get_candidate_quad_edge(self, index: int) -> Tuple[int, Edge]:
533+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_GetCandidateQuadEdge(self, index)
534+
535+
def remove_all_candidate_quad_edges(self) -> None:
536+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_RemoveAllCandidateQuadEdges(self)
537+
538+
def remove_candidate_quad_edge(self, index: int) -> int:
539+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_RemoveCandidateQuadEdge(self, index)
540+
541+
def add_candidate_quad_edge(self, edge: Edge, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
542+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_AddCandidateQuadEdge(self, edge, matrix_to_original_image)
543+
544+
def set_candidate_quad_edge(self, index: int, edge: Edge, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
545+
return _DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_SetCandidateQuadEdge(self, index, edge, matrix_to_original_image)
546+
547+
# Register CCandidateQuadEdgesUnit in _DynamsoftDocumentNormalizer:
548+
_DynamsoftDocumentNormalizer.CCandidateQuadEdgesUnit_register(CandidateQuadEdgesUnit)
549+
class DetectedQuadsUnit(IntermediateResultUnit):
550+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
551+
552+
def __init__(self, *args, **kwargs):
553+
raise AttributeError("No constructor defined - class is abstract")
554+
555+
556+
def get_count(self) -> int:
557+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_GetCount(self)
558+
559+
def get_detected_quad(self, index: int) -> DetectedQuadElement:
560+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_GetDetectedQuad(self, index)
561+
562+
def remove_all_detected_quads(self) -> None:
563+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_RemoveAllDetectedQuads(self)
564+
565+
def remove_detected_quad(self, index: int) -> int:
566+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_RemoveDetectedQuad(self, index)
567+
568+
def add_detected_quad(self, element: DetectedQuadElement, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
569+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_AddDetectedQuad(self, element, matrix_to_original_image)
570+
571+
def set_detected_quad(self, index: int, element: DetectedQuadElement, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
572+
return _DynamsoftDocumentNormalizer.CDetectedQuadsUnit_SetDetectedQuad(self, index, element, matrix_to_original_image)
573+
574+
# Register CDetectedQuadsUnit in _DynamsoftDocumentNormalizer:
575+
_DynamsoftDocumentNormalizer.CDetectedQuadsUnit_register(DetectedQuadsUnit)
576+
class NormalizedImagesUnit(IntermediateResultUnit):
577+
_thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
578+
579+
def __init__(self, *args, **kwargs):
580+
raise AttributeError("No constructor defined - class is abstract")
581+
582+
583+
def get_count(self) -> int:
584+
return _DynamsoftDocumentNormalizer.CNormalizedImagesUnit_GetCount(self)
585+
586+
def get_normalized_image(self, index: int) -> NormalizedImageElement:
587+
return _DynamsoftDocumentNormalizer.CNormalizedImagesUnit_GetNormalizedImage(self, index)
588+
589+
def remove_all_normalized_images(self) -> None:
590+
return _DynamsoftDocumentNormalizer.CNormalizedImagesUnit_RemoveAllNormalizedImages(self)
591+
592+
def set_normalized_image(self, element: NormalizedImageElement, matrix_to_original_image: List[float] = IDENTITY_MATRIX) -> int:
593+
return _DynamsoftDocumentNormalizer.CNormalizedImagesUnit_SetNormalizedImage(self, element, matrix_to_original_image)
594+
595+
# Register CNormalizedImagesUnit in _DynamsoftDocumentNormalizer:
596+
_DynamsoftDocumentNormalizer.CNormalizedImagesUnit_register(NormalizedImagesUnit)

0 commit comments

Comments
 (0)