diff --git a/_config.yml b/_config.yml index 74734f6..50abb12 100644 --- a/_config.yml +++ b/_config.yml @@ -14,6 +14,9 @@ ddn_cpp_release_notes: /document-normalizer/docs/server/programming/cplusplus/re ddn_dotnet: /document-normalizer/docs/server/programming/dotnet/ ddn_dotnet_api: /document-normalizer/docs/server/programming/dotnet/api-reference/ ddn_dotnet_release_notes: /document-normalizer/docs/server/programming/dotnet/release-notes/ +ddn_python: /document-normalizer/docs/server/programming/python/ +ddn_python_api: /document-normalizer/docs/server/programming/python/api-reference/ +ddn_python_release_notes: /document-normalizer/docs/server/programming/python/release-notes/ ddn_js: /document-normalizer/docs/web/programming/javascript/ ddn_ios: /document-normalizer/docs/mobile/programming/ios/ @@ -25,10 +28,12 @@ dcv_parameters_reference: /capture-vision/docs/core/parameters/reference/ dcv_cpp_api: /capture-vision/docs/server/programming/cplusplus/api-reference/ dcv_dotnet_api: /capture-vision/docs/server/programming/dotnet/api-reference/ +dcv_python_api: /capture-vision/docs/server/programming/python/api-reference/ dcv_introduction: /capture-vision/docs/core/introduction/ dcv_enumerations: /capture-vision/docs/core/enums/ -useVersionTree: true +useVersionTree: false +isDCV: true assets: /document-normalizer/docs/server/assets/ edit_icon: /document-normalizer/docs/server/assets/img-icon/edit-icon.png @@ -72,6 +77,16 @@ defaults: values: docRootName: "Document Normalizer C" docHomePage: "/document-normalizer/docs/server/programming/c/" + - scope: + path: "programming/dotnet" + values: + docRootName: "Document Normalizer .NET Edition" + docHomePage: "/document-normalizer/docs/server/programming/dotnet/" + - scope: + path: "programming/python" + values: + docRootName: "Document Normalizer Python Edition" + docHomePage: "/document-normalizer/docs/server/programming/python/" - scope: path: "Hide_Tree_Page.html" values: diff --git a/_data/full_tree.yml b/_data/full_tree.yml index c162ddd..33662af 100644 --- a/_data/full_tree.yml +++ b/_data/full_tree.yml @@ -6,4 +6,5 @@ tree_file_list: - sidelist-programming/programming-cpp-v2.0.20.html - sidelist-programming/programming-cpp-v2.2.0.html - sidelist-programming/programming-c.html - - sidelist-programming/programming-dotnet.html \ No newline at end of file + - sidelist-programming/programming-dotnet.html + - sidelist-programming/programming-python.html diff --git a/_data/product_version.yml b/_data/product_version.yml index 9c5eef6..617b88e 100644 --- a/_data/product_version.yml +++ b/_data/product_version.yml @@ -4,15 +4,17 @@ version_info_list: - value: latest version(2.4.10) - value: 2.x child: - - 2.2.10 - - 2.2.0 - - 2.0.20 - - 2.0.10 - - 2.0.0 + - 2.2.0_cplusplus + - 2.0.20_cplusplus + - 2.0.10_cplusplus + - 2.0.0_cplusplus - value: 1.x child: - - 1.0.20 - - 1.0.10 - - 1.0.0 + - 1.0.20_cplusplus + - 1.0.10_cplusplus + - 1.0.0_cplusplus + - 1.0.20_c + - 1.0.10_c + - 1.0.0_c \ No newline at end of file diff --git a/_includes/ddnNav.html b/_includes/ddnNav.html index 909bee6..343d77b 100644 --- a/_includes/ddnNav.html +++ b/_includes/ddnNav.html @@ -1,15 +1,14 @@
@@ -18,24 +17,13 @@
@@ -52,15 +40,7 @@
+
  • OTHER EDITIONS
  • +
  • Choose a Language + +
  • \ No newline at end of file diff --git a/_includes/sidelist-programming/programming-cpp.html b/_includes/sidelist-programming/programming-cpp.html index 3bbc8a1..501e255 100644 --- a/_includes/sidelist-programming/programming-cpp.html +++ b/_includes/sidelist-programming/programming-cpp.html @@ -180,4 +180,11 @@
  • Version 1.x
  • -
  • Upgrade Instructions
  • \ No newline at end of file +
  • Upgrade Instructions
  • +
  • OTHER EDITIONS
  • +
  • Choose a Language + +
  • \ No newline at end of file diff --git a/_includes/sidelist-programming/programming-dotnet.html b/_includes/sidelist-programming/programming-dotnet.html index 57f788c..afd0314 100644 --- a/_includes/sidelist-programming/programming-dotnet.html +++ b/_includes/sidelist-programming/programming-dotnet.html @@ -126,3 +126,10 @@
  • Version 2.x
  • +
  • OTHER EDITIONS
  • +
  • Choose a Language + +
  • \ No newline at end of file diff --git a/_includes/sidelist-programming/programming-python.html b/_includes/sidelist-programming/programming-python.html new file mode 100644 index 0000000..542f854 --- /dev/null +++ b/_includes/sidelist-programming/programming-python.html @@ -0,0 +1,129 @@ +
  • DEVELOPMENT
  • +
  • User Guide
  • +
  • API Reference + +
  • +
  • USEFUL RESOURCES
  • + +
  • Release Notes + +
  • +
  • OTHER EDITIONS
  • +
  • Choose a Language + +
  • \ No newline at end of file diff --git a/_layouts/default-layout.html b/_layouts/default-layout-OLD.html similarity index 100% rename from _layouts/default-layout.html rename to _layouts/default-layout-OLD.html diff --git a/_layouts/search-page.html b/_layouts/search-page-OLD.html similarity index 100% rename from _layouts/search-page.html rename to _layouts/search-page-OLD.html diff --git a/programming/index.md b/programming/index.md index 128abb0..a71dd02 100644 --- a/programming/index.md +++ b/programming/index.md @@ -10,3 +10,4 @@ permalink: /programming/index.html - [C++]({{ site.ddn_cpp}}) - [C]({{ site.ddn_c}}) - [.NET]({{ site.ddn_dotnet}}) +- [Python]({{ site.ddn_python}}) diff --git a/programming/python/api-reference/detected-quad-result-item.md b/programming/python/api-reference/detected-quad-result-item.md new file mode 100644 index 0000000..25d8f3f --- /dev/null +++ b/programming/python/api-reference/detected-quad-result-item.md @@ -0,0 +1,55 @@ +--- +layout: default-layout +title: DetectedQuadResultItem Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of DetectedQuadResultItem class in Dynamsoft Document Normalizer Module Python Edition. +keywords: get_location, get_confidence_as_document_boundary, DetectedQuadResultItem, api reference +--- + +# DetectedQuadResultItem Class + +The `DetectedQuadResultItem` class stores a captured result whose type is detected quad. + +## Definition + +*Module:* dynamsoft_document_normalizer + +```python +class DetectedQuadResultItem(dynamsoft_core.CapturedResultItem) +``` + +*Inheritance:* [CapturedResultItem]({{ site.dcv_python_api }}core/basic-classes/captured-result-item.html) -> DetectedQuadResultItem + +## Methods + +| Method | Description | +|--------|-------------| +| [`get_location`](#get_location) | Gets the location of current object. | +| [`get_confidence_as_document_boundary`](#get_confidence_as_document_boundary) | Gets the confidence of current object as a document boundary. | + +### get_location + +Gets the location of current object. + +```python +def get_location(self) -> Quadrilateral: +``` + +**Return Value** + +The location of current object. + +**See Also** + +[Quadrilateral]({{ site.dcv_python_api }}core/basic-classes/quadrilateral.html) + +### get_confidence_as_document_boundary + +Gets the confidence of current object as a document boundary. + +```python +def get_confidence_as_document_boundary(self) -> int: +``` + +**Return Value** + +The confidence as document boundary of the detected quad result. diff --git a/programming/python/api-reference/detected-quads-result.md b/programming/python/api-reference/detected-quads-result.md new file mode 100644 index 0000000..94c9f3a --- /dev/null +++ b/programming/python/api-reference/detected-quads-result.md @@ -0,0 +1,114 @@ +--- +layout: default-layout +title: DetectedQuadsResult Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of DetectedQuadsResult class in Dynamsoft Document Normalizer Module Python Edition. +keywords: get_items, get_error_code, get_error_string, get_original_image_hash_id, get_original_image_tag, DetectedQuadsResult, api reference +--- + +# DetectedQuadsResult Class + +The `DetectedQuadsResult` class stores a captured result whose type is detected quads. + +## Definition + +*Module:* dynamsoft_document_normalizer + +```python +class DetectedQuadsResult(object) +``` + +## Methods + +| Method | Description | +|--------|-------------| +| [`get_error_code`](#get_error_code) | Gets the error code of the detection operation. | +| [`get_error_string`](#get_error_string) | Gets the error message of the detection operation. | +| [`get_items`](#get_items) | Gets the detected quadrilateral item at a specified index. | +| [`get_rotation_transform_matrix`](#get_rotation_transform_matrix) | Gets the 3x3 rotation transformation matrix of the original image relative to the rotated image.| +| [`get_original_image_hash_id`](#get_original_image_hash_id) | Gets the hash ID of the original image. | +| [`get_original_image_tag`](#get_original_image_tag) | Gets the tag of the original image. | + +### get_error_code + +Gets the error code of the detection operation. + +```python +def get_error_code(self) -> int: +``` + +**Return Value** + +Returns the error code. + +**See Also** + +[EnumErrorCode]({{ site.dcv_enumerations }}core/error-code.html?lang=python) + +### get_error_string + +Gets the error message of the detection operation. + +```python +def get_error_string(self) -> str: +``` + +**Return Value** + +Returns a string that represents the error message. + +### get_items + +Gets all the detected quadrilateral items. + +```python +def get_items(self) -> List[DetectedQuadResultItem]: +``` + +**Return Value** + +Returns a `DetectedQuadResultItem` list. + +**See Also** + +[DetectedQuadResultItem]({{ site.ddn_python_api }}detected-quad-result-item.html) + +### get_rotation_transform_matrix + +Gets the 3x3 rotation transformation matrix of the original image relative to the rotated image. + +```python +def get_rotation_transform_matrix(self) -> List[float]: +``` + +**Return Value** + +Returns a float list of length 9 which represents a 3x3 rotation matrix. + +### get_original_image_hash_id + +Gets the hash ID of the original image. + +```python +def get_original_image_hash_id(self) -> str: +``` + +**Return Value** + +Returns a string that represents the hash ID of the original image. + +### get_original_image_tag + +Gets the tag of the original image. + +```python +def get_original_image_tag(self) -> ImageTag: +``` + +**Return Value** + +Returns an `ImageTag` object that represents the tag of the original image. + +**See Also** + +[ImageTag]({{ site.dcv_python_api }}core/basic-classes/image-tag.html) + diff --git a/programming/python/api-reference/document-normalizer-module.md b/programming/python/api-reference/document-normalizer-module.md new file mode 100644 index 0000000..5fef768 --- /dev/null +++ b/programming/python/api-reference/document-normalizer-module.md @@ -0,0 +1,44 @@ +--- +layout: default-layout +title: DocumentNormalizerModule Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of DocumentNormalizerModule class in Dynamsoft Document Normalizer Module Python Edition. +keywords: document normalizer module, python +needAutoGenerateSidebar: true +needGenerateH3Content: true +--- + +# DocumentNormalizerModule + +The `DocumentNormalizerModule` class defines general functions in the document normalizer module. + +## Definition + +*Module:* dynamsoft_document_normalizer + +```python +class DocumentNormalizerModule(object) +``` + +## Methods + +| Method | Description | +| ------------------------------------------------------------- | ------------------------------------------------------ | +| [get_version](#get_version) | Returns the version of the document normalizer module. | + +### get_version + +Returns the version of the document normalizer module. + +```python +@staticmethod +def get_version() -> str: +``` + +**Parameters** + +None. + +**Return Value** + +Returns a string representing the version of the document normalizer module. + diff --git a/programming/python/api-reference/index.md b/programming/python/api-reference/index.md new file mode 100644 index 0000000..0a7cb8d --- /dev/null +++ b/programming/python/api-reference/index.md @@ -0,0 +1,104 @@ +--- +layout: default-layout +title: Dynamsoft Document Normalizer Python Edition API Reference - Main Page +description: This is the main page of Dynamsoft Document Normalizer SDK API Reference for Python Edition. +keywords: CDocumentNormalizer, api reference, python +--- + +# API Reference - Python + +## DynamsoftCaptureVisionRouter + +### [CaptureVisionRouter]({{ site.dcv_python_api }}capture-vision-router/capture-vision-router.html) + +- [`Constructor`]({{ site.dcv_python_api }}capture-vision-router/instantiate.html) +- [`Single-File Processing`]({{ site.dcv_python_api }}capture-vision-router/single-file-processing.html) +- [`Multiple-File Processing`]({{ site.dcv_python_api }}capture-vision-router/multiple-file-processing.html) +- [`Settings`]({{ site.dcv_python_api }}capture-vision-router/settings.html) +- [`Buffered Items`]({{ site.dcv_python_api }}capture-vision-router/buffered-items.html) + +### Classes + +- [`BufferedItemsManager`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/buffered-items-manager.html) +- [`CaptureStateListener`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/capture-state-listener.html) +- [`CaptureVisionRouterModule`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/capture-vision-router-module.html) +- [`CapturedResultFilter`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/captured-result-filter.html) +- [`CapturedResultReceiver`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/captured-result-receiver.html) +- [`CapturedResult`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/captured-result.html) +- [`ImageSourceStateListener`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/image-source-state-listener.html) +- [`SimplifiedCaptureVisionSettings`]({{ site.dcv_python_api }}capture-vision-router/auxiliary-classes/simplified-capture-vision-settings.html) + +### Enums + +- [`EnumCaptureState`]({{ site.dcv_enumerations }}capture-vision-router/capture-state.html?lang=python) +- [`EnumImageSourceState`]({{ site.dcv_enumerations }}capture-vision-router/image-source-state.html?lang=python) +- [`EnumPresetTemplate`]({{ site.dcv_enumerations }}capture-vision-router/preset-template.html?lang=python) + +## DynamsoftDocumentNormalizer + +### Classes + +- [`DetectedQuadResultItem`]({{ site.ddn_python_api }}detected-quad-result-item.html) +- [`DetectedQuadsResult`]({{ site.ddn_python_api }}detected-quads-result.html) +- [`DocumentNormalizerModule`]({{ site.ddn_python_api }}document-normalizer-module.html) +- [`NormalizedImageResultItem`]({{ site.ddn_python_api }}normalized-image-result-item.html) +- [`NormalizedImagesResult`]({{ site.ddn_python_api }}normalized-images-result.html) +- [`SimplifiedDocumentNormalizerSettings`]({{ site.ddn_python_api }}simplified-document-normalizer-settings.html) + + +### Enums + +- [`EnumImageColourMode`]({{ site.dcv_enumerations }}document-normalizer/image-colour-mode.html?lang=python) + +## DynamsoftCore + +### Classes + +- [`CapturedResultItem`]({{ site.dcv_python_api }}core/basic-classes/captured-result-item.html) +- [`CoreModule`]({{ site.dcv_python_api }}core/basic-classes/core-module.html) +- [`FileImageTag`]({{ site.dcv_python_api }}core/basic-classes/file-image-tag.html) +- [`ImageData`]({{ site.dcv_python_api }}core/basic-classes/image-data.html) +- [`ImageSourceAdapter`]({{ site.dcv_python_api }}core/basic-classes/image-source-adapter.html) +- [`ImageSourceErrorListener`]({{ site.dcv_python_api }}core/basic-classes/image-source-error-listener.html) +- [`ImageTag`]({{ site.dcv_python_api }}core/basic-classes/image-tag.html) +- [`OriginalImageResultItem`]({{ site.dcv_python_api }}core/basic-classes/original-image-result-item.html) +- [`PDFReadingParameter`]({{ site.dcv_python_api }}core/basic-classes/pdf-reading-parameter.html) +- [`Point`]({{ site.dcv_python_api }}core/basic-classes/point.html) +- [`Quadrilateral`]({{ site.dcv_python_api }}core/basic-classes/quadrilateral.html) +- [`Rect`]({{ site.dcv_python_api }}core/basic-classes/rect.html) +- [`VideoFrameTag`]({{ site.dcv_python_api }}core/basic-classes/video-frame-tag.html) + +### Enums + +- [`EnumBufferOverflowProtectionMode`]({{ site.dcv_enumerations }}core/buffer-overflow-protection-mode.html?lang=python) +- [`EnumCapturedResultItemType`]({{ site.dcv_enumerations }}core/captured-result-item-type.html?lang=python) +- [`EnumColourChannelUsageType`]({{ site.dcv_enumerations }}core/colour-channel-usage-type.html?lang=python) +- [`EnumErrorCode`]({{ site.dcv_enumerations }}core/error-code.html?lang=python) +- [`EnumGrayscaleEnhancementMode`]({{ site.dcv_enumerations }}core/grayscale-enhancement-mode.html?lang=python) +- [`EnumGrayscaleTransformationMode`]({{ site.dcv_enumerations }}core/grayscale-transformation-mode.html?lang=python) +- [`EnumImageCaptureDistanceMode`]({{ site.dcv_enumerations }}core/image-capture-distance-mode.html?lang=python) +- [`EnumImagePixelFormat`]({{ site.dcv_enumerations }}core/image-pixel-format.html?lang=python) +- [`EnumImageTagType`]({{ site.dcv_enumerations }}core/image-tag-type.html?lang=python) +- [`EnumPDFReadingMode`]({{ site.dcv_enumerations }}core/pdf-reading-mode.html?lang=python) +- [`EnumRasterDataSource`]({{ site.dcv_enumerations }}core/raster-data-source.html?lang=python) +- [`EnumVideoFrameQuality`]({{ site.dcv_enumerations }}core/video-frame-quality.html?lang=python) + +## DynamsoftUtility + +- [`DirectoryFetcher`]({{ site.dcv_python_api }}utility/directory-fetcher.html) +- [`FileFetcher`]({{ site.dcv_python_api }}utility/file-fetcher.html) +- [`ImageManager`]({{ site.dcv_python_api }}utility/image-manager.html) +- [`MultiFrameResultCrossFilter`]({{ site.dcv_python_api }}utility/multi-frame-result-cross-filter.html) +- [`ProactiveImageSourceAdapter`]({{ site.dcv_python_api }}utility/proactive-image-source-adapter.html) +- [`UtilityModule`]({{ site.dcv_python_api }}utility/utility-module.html) + +## DynamsoftLicense + +- [`LicenseManager`]({{ site.dcv_python_api }}license/license-manager.html) +- [`LicenseModule`]({{ site.dcv_python_api }}license/license-module.html) + + +## DynamsoftImageProcessing + +- [`ImageProcessingModule`]({{ site.dcv_python_api }}image-processing/image-processing-module.html) + diff --git a/programming/python/api-reference/normalized-image-result-item.md b/programming/python/api-reference/normalized-image-result-item.md new file mode 100644 index 0000000..6c9103c --- /dev/null +++ b/programming/python/api-reference/normalized-image-result-item.md @@ -0,0 +1,59 @@ +--- +layout: default-layout +title: NormalizedImageResultItem Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of NormalizedImageResultItem class in Dynamsoft Document Normalizer Module Python Edition. +keywords: get_image_data, get_location, NormalizedImageResultItem, api reference +--- + +# NormalizedImageResultItem Class + +The `NormalizedImageResultItem` class stores a captured result item whose type is normalized image. + +## Definition + +*Module:* dynamsoft_document_normalizer + +```python +class NormalizedImageResultItem(dynamsoft_core.CapturedResultItem) +``` + +*Inheritance:* [CapturedResultItem]({{ site.dcv_python_api }}core/basic-classes/captured-result-item.html) -> NormalizedImageResultItem + +## Methods + +| Method | Description | +|--------|-------------| +| [`get_image_data`](#get_image_data) | Gets the ImageData of current object. | +| [`get_location`](#get_location) | Get the quadrilateral from which you get the normalized image result item. | + +### get_image_data + +Gets the image data of current object. + +```python +def get_image_data(self) -> ImageData : +``` + +**Return Value** + +The image data. + +**See Also** + +[ImageData]({{ site.dcv_python_api }}core/basic-classes/image-data.html) + +### get_location + +Gets the location of current object. + +```python +def get_location(self) -> Quadrilateral: +``` + +**Return Value** + +The location of current object. + +**See Also** + +[Quadrilateral]({{ site.dcv_python_api }}core/basic-classes/quadrilateral.html) diff --git a/programming/python/api-reference/normalized-images-result.md b/programming/python/api-reference/normalized-images-result.md new file mode 100644 index 0000000..03a2b5c --- /dev/null +++ b/programming/python/api-reference/normalized-images-result.md @@ -0,0 +1,113 @@ +--- +layout: default-layout +title: NormalizedImagesResult Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of NormalizedImagesResult class in Dynamsoft Document Normalizer Module Python Edition. +keywords: get_items, get_error_code, get_error_string, get_original_image_hash_id, get_original_image_tag, NormalizedImagesResult, api reference +--- + +# NormalizedImagesResult + +The NormalizedImagesResult class stores a collection of captured result items whose type are normalized images. + +## Definition + +*Module:* dynamsoft_document_normalizer + +```python +class NormalizedImagesResult(object) +``` + +## Methods + +| Method | Description | +|----------------------|-------------| +| [`get_error_code`](#get_error_code) | Gets the error code of the operation. | +| [`get_error_string`](#get_error_string) | Gets the error message of the operation. | +| [`get_items`](#get_items) | Gets a specific normalized image from the result. | +| [`get_rotation_transform_matrix`](#get_rotation_transform_matrix) | Gets the 3x3 rotation transformation matrix of the original image relative to the rotated image.| +| [`get_original_image_hash_id`](#get_original_image_hash_id) | Gets the hash ID of the original image, from which you get the normalized image. | +| [`get_original_image_tag`](#get_original_image_tag) | Gets the tag of the original image, from which you get the normalized image. | + +### get_error_code + +Gets the error code of the operation. + +```python +def get_error_code(self) -> int: +``` + +**Return Value** + +Returns the error code of the operation. A non-zero value indicates an error occurred. + +**See Also** + +[EnumErrorCode]({{ site.dcv_enumerations }}core/error-code.html?lang=python) + +### get_error_string + +Gets the error message of the operation. + +```python +def get_error_string(self) -> str: +``` + +**Return Value** + +Returns the error message of the operation. + +### get_items + +Gets all the normalized images. + +```python +def get_items(self) -> List[NormalizedImageResultItem]: +``` + +**Return Value** + +Returns a `NormalizedImageResultItem` list. + +**See Also** + +[NormalizedImageResultItem]({{ site.ddn_python_api }}normalized-image-result-item.html) + +### get_rotation_transform_matrix + +Gets the 3x3 rotation transformation matrix of the original image relative to the rotated image. + +```python +def get_rotation_transform_matrix(self) -> List[float]: +``` + +**Return Value** + +Returns a float list of length 9 which represents a 3x3 rotation matrix. + +### get_original_image_hash_id + +Gets the hash ID of the original image that was normalized. + +```python +def get_original_image_hash_id(self) -> str: +``` + +**Return Value** + +Returns the hash ID of the original image that was normalized. + +### get_original_image_tag + +Gets the tag of the original image that was normalized. + +```python +def get_original_image_tag(self) -> ImageTag: +``` + +**Return Value** + +Returns a tag of the original image that was normalized. + +**See Also** + +[ImageTag]({{ site.dcv_python_api }}core/basic-classes/image-tag.html) diff --git a/programming/python/api-reference/simplified-document-normalizer-settings.md b/programming/python/api-reference/simplified-document-normalizer-settings.md new file mode 100644 index 0000000..d7b483b --- /dev/null +++ b/programming/python/api-reference/simplified-document-normalizer-settings.md @@ -0,0 +1,154 @@ +--- +layout: default-layout +title: SimplifiedDocumentNormalizerSettings Class - Dynamsoft Document Normalizer Module Python Edition API Reference +description: Definition of the SimplifiedDocumentNormalizerSettings class in Dynamsoft Document Normalizer Module Python Edition. +keywords: class, python, SimplifiedDocumentNormalizerSettings +needAutoGenerateSidebar: true +needGenerateH3Content: true +--- + +# SimplifiedDocumentNormalizerSettings + +The `SimplifiedDocumentNormalizerSettings` class contains settings for document normalization. It is a sub-parameter of `SimplifiedCaptureVisionSettings` + +```python +class SimplifiedDocumentNormalizerSettings(object) +``` + +## Properties Summary + +| Property | Type | +| --------- | ---- | +| [`grayscale_transformation_modes`](#grayscale_transformation_modes) | *List[int]* | +| [`grayscale_enhancement_modes`](#grayscale_enhancement_modes) | *List[int]* | +| [`colour_mode`](#colour_mode) | *int* | +| [`page_size`](#page_size) | *List[int]* | +| [`brightness`](#brightness) | *int* | +| [`contrast`](#contrast) | *int* | +| [`max_threads_in_one_task`](#max_threads_in_one_task) | *int* | +| [`scale_down_threshold`](#scale_down_threshold) | *int* | +| [`min_quadrilateral_area_ratio`](#min_quadrilateral_area_ratio) | *int* | +| [`expected_documents_count`](#expected_documents_count) | *int* | + +### grayscale_transformation_modes + +Specifies how grayscale transformations should be applied, including whether to process inverted grayscale images and the specific transformation mode to use. + +It is a list of 8 integers, where each integer represents a mode specified by the [`EnumGrayscaleTransformationMode`]({{ site.dcv_enumerations }}core/grayscale-transformation-mode.html?lang=python) enumeration. + +View the parameter reference page of `GrayscaleTransformationModes` for more detail about grayscale transformation modes. + +### grayscale_enhancement_modes + +Specifies how to enhance the quality of the grayscale image. + +It is a list of 8 integers, where each integer represents a mode specified by the [`EnumGrayscaleEnhancementMode`]({{ site.dcv_enumerations }}core/grayscale-enhancement-mode.html?lang=python) enumeration. + +View the parameter reference page of `GrayscaleEnhancementModes` for more detail about grayscale enhancement modes. + +### colour_mode + +Specifies the colour mode of the output image. + +It is a value of the [`EnumImageColourMode`]({{ site.dcv_enumerations }}document-normalizer/image-colour-mode.html?lang=python) enumeration. + +View the parameter reference page of `ColourMode` for more detail about colour mode. + +**Default value** + +0, which means output image in colour mode. + +### page_size + +Specifies the page size (width by height in pixels) of the normalized image. + +### brightness + +Specifies the brightness of the normalized image. + +**Value Range** + +[-100,100] + +**Default value** + +0 + +### contrast + +Specifies the contrast of the normalized image. + +**Value Range** + +[-100,100] + +**Default value** + +0 + +### max_threads_in_one_task + +Specifies the maximum available threads count in one document normalization task. + +**Value Range** + +[1, 256] + +**Default value** + +4 + +### scale_down_threshold + +Specifies the threshold for the image shrinking. + +**Value Range** + +[512, 0x7fffffff] + +**Default Value** + +2300 + +**Remarks** + +If the shorter edge size is larger than the given threshold value, the library will calculate the required height and width of the barcode image and shrink the image to that size before detection. Otherwise, the library will perform document detection on the original image. + +### min_quadrilateral_area_ratio + +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). + +**Value Range** + +[0, 100] + +**Default Value** + +0, which means no limitation. + +### expected_documents_count + +Specifies the number of documents expected to be detected. + +**Value Range** + +[0, 0x7fffffff] + +**Default Value** + +0, which means the count is unknown. The library will try to find at least 1 document. + +## Methods + +| Method | Description | +|------- | ---- | +| [`__init__`](#__init__) | Initializes a new instance of the `SimplifiedDocumentNormalizerSettings` class. | + +### \_\_init\_\_ + +Initializes a new instance of the `SimplifiedDocumentNormalizerSettings` class. + +```python +def __init__(self): +``` + diff --git a/programming/python/index.md b/programming/python/index.md new file mode 100644 index 0000000..7ff0020 --- /dev/null +++ b/programming/python/index.md @@ -0,0 +1,57 @@ +--- +title: Introduction - Dynamsoft Document Normalizer Python Edition +keywords: python, cplusplus, documentation +description: This page introduces the Python Edition of Dynamsoft Document Normalizer +needAutoGenerateSidebar: false +--- + +# Dynamsoft Document Normalizer Documentation for Python Edition + +Dynamsoft Document Normalizer (DDN) SDK Python Edition is a document normalization tool designed specifically for .NET developers. + +Leveraging the efficiency and flexibility of the .NET language, DDN Python Edition provides rich APIs for developers to easily integrate document normalization functionality into your .NET applications. Please take a look at [API Reference](api-reference/index.md) to see details. + +In addition, DDN Python Edition provides cross-platform support, running on multiple operating systems such as Windows, Linux, and Mac, to meet the needs of different development environments + +As one of the functional products of the Dynamsoft Capture Vision (DCV) framework, DDN is also designed to seamlessly integrate with other DCV components and provide developers with a comprehensive set of image processing tools, which cover image capturing, content understanding, result parsing, and interactive workflow. If you are building such a document capturing and processing solution, take a look at Introduction to Dynamsoft Capture Vision. + +Furthermore, DDN provides a powerful parameter system in order to cope with various scenarios. Read Parameter Reference for details. + +## Getting Started with DDN Python Edition + +The best way to start with the Dynamsoft Document Normalizer Python Edition, is following the [`User Guide`](user-guide/getting-started.md) to build your first document normalization application. Please note that the system requirements is as below: + +### System Requirements + +- Windows: + - Supported Versions: Windows 7 and higher, or Windows Server 2003 and higher + - Architecture: x64 and x86 + - Development Environment: Visual Studio 2012 or higher. + +- Linux: + - Supported Distributions: Ubuntu 14.04.4+ LTS, Debian 8+, CentOS 6+ + - Architectures: x64 + - Minimum GLIBC Version: GLIBC_2.18 or higher + +- Supported .NET versions + - .NET Framework 3.5 and above + - .NET 6, 7, 8 + +## License Subscription + +To develop and run your application with Dynamsoft Document Normalizer SDK, you need an active license key: +* Request a 30-day free trial license + +## Other Edition + +DDN is designed to provide document border detection and document normalization functionality for web, desktop and mobile applications. If you are developing with other programming languages, please checkout following editions: + +* Dynamsoft Document Normalizer Documentation for Javascript +* Dynamsoft Document Normalizer Documentation for Android +* Dynamsoft Document Normalizer Documentation for iOS +* Dynamsoft Document Normalizer Documentation for Xamarin.Forms +* Dynamsoft Document Normalizer Documentation for C++ + +## Contact Us + +Feel free to contact us if you have any questions. diff --git a/programming/python/release-notes/dotnet-2.md b/programming/python/release-notes/dotnet-2.md new file mode 100644 index 0000000..2db75b9 --- /dev/null +++ b/programming/python/release-notes/dotnet-2.md @@ -0,0 +1,15 @@ +--- +layout: default-layout +title: Release Notes for Python Edition - v2.x +description: This is the release notes page of Dynamsoft Document Normalizer SDK Python Edition for version 2.x. +keywords: release notes, python, +needGenerateH3Content: false +--- + +# Release Notes for Python Edition - v2.x + +## 2.4.10 (08/27/2024) + +### Highlights + +{%- include release-notes/python-highlight-2.4.10.md -%} diff --git a/programming/python/release-notes/index.md b/programming/python/release-notes/index.md new file mode 100644 index 0000000..6989385 --- /dev/null +++ b/programming/python/release-notes/index.md @@ -0,0 +1,11 @@ +--- +layout: default-layout +title: Dynamsoft Document Normalizer Python Edition - Release Notes +description: This is the release notes page of Dynamsoft Document Normalizer SDK Python Edition. +keywords: release notes, python +needAutoGenerateSidebar: false +--- + +# Release Notes - Python Edition + +- [2.4.10 (08/27/2024)](python-2.md#2410-08272024) diff --git a/programming/python/user-guide/getting-started.md b/programming/python/user-guide/getting-started.md new file mode 100644 index 0000000..96f57af --- /dev/null +++ b/programming/python/user-guide/getting-started.md @@ -0,0 +1,289 @@ +--- +layout: default-layout +title: User Guide - Dynamsoft Document Normalizer SDK Python Edition +description: This is the user guide of Dynamsoft Document Normalizer SDK Python Edition. +keywords: user guide, python +needAutoGenerateSidebar: true +needGenerateH3Content: true +noTitleIndex: true +--- + +# Getting Started with Dynamsoft Document Normalizer SDK Python Edition + +In this guide, you will learn step by step on how to build a document normalization application with Dynamsoft Document Normalizer SDK using C#. + +- [Getting Started with Dynamsoft Document Normalizer SDK Python Edition](#getting-started-with-dynamsoft-document-normalizer-sdk-python-edition) + - [System Requirements](#system-requirements) + - [Build Your First Application](#build-your-first-application) + - [Create a New Project](#create-a-new-project) + - [Install the NuGet Package](#install-the-nuget-package) + - [Import the Namespace](#import-the-namespace) + - [Initialize the License Key](#initialize-the-license-key) + - [Create a CaptureVisionRouter Instance](#create-a-capturevisionrouter-instance) + - [Invoke the Document Capturing](#invoke-the-document-capturing) + - [Filter and Get Document Detection and Normalization Results](#filter-and-get-document-detection-and-normalization-results) + - [Build and Run the Project](#build-and-run-the-project) + - [Process Multiple Images](#process-multiple-images) + - [Import the Additional Namespace.](#import-the-additional-namespace) + - [Create an ImageSource as the Input](#create-an-imagesource-as-the-input) + - [Implement a CapturedResultReceiver as the Output Listener](#implement-a-capturedresultreceiver-as-the-output-listener) + - [Handle Capture Stoppage by Implementing a ImageSource State Listener](#handle-capture-stoppage-by-implementing-a-imagesource-state-listener) + - [Register the Input, Output Listener and ImageSource State Listener to the CaptureVisionRouter Instance](#register-the-input-output-listener-and-imagesource-state-listener-to-the-capturevisionrouter-instance) + - [Start the Capturing Process](#start-the-capturing-process) + - [Build and Run the Project Again](#build-and-run-the-project-again) + +## System Requirements + +To find out whether your environment is supported, please read the [System Requirements]({{ site.ddn_python }}index.html#system-requirements). + +## Build Your First Application + +Let's start by creating a console application which demonstrates how to use the minimum code to detect and normalize a document from an image file. + +> You can download the entire source code from here. + +### Create a New Project + +Start Visual Studio or your preferred C# IDE. + +Create a new C# Console Application project. + +### Install the NuGet Package + +In the Solution Explorer, right-click on your project and select Manage NuGet Packages. + +Search for and install the `Dynamsoft.DotNet.DocumentNormalizer.Bundle` nuget package. + +> If you prefer to use the offline packages, please +> +> Download the `python Package` now and extract it into a directory of your choice. +> +> Add the extracted `.\Dynamsoft\Packages` directory as a new package source +> +> Install following packages from the added package source: +> * Dynamsoft.DotNet.DocumentNormalizer +> * Dynamsoft.DotNet.CaptureVisionRouter +> * Dynamsoft.DotNet.Core +> * Dynamsoft.DotNet.ImageProcessing +> * Dynamsoft.DotNet.License +> * Dynamsoft.DotNet.Utility + +### Import the Namespace + +Open the `Program.cs` file and add the following namespaces. + +```python +using Dynamsoft.DDN +using Dynamsoft.Core +using Dynamsoft.CVR +using Dynamsoft.License +``` + +### Initialize the License Key + +Open the `Program.cs` file and add the following code inside the `Main` method to initialize the license for using the SDK in the application: + +```python +int error_code = 1 +string errorMsg +error_code = LicenseManager.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", out errorMsg) +if (error_code != (int)EnumErrorCode.EC_OK && error_code != (int)EnumErrorCode.EC_LICENSE_CACHE_USED) + Console.WriteLine("License initialization error: " + errorMsg) +``` + +> The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work. When it expires, you can request a 30-day trial license via the Request a Trial License link. + +### Create a CaptureVisionRouter Instance + +```python +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + //code for invoking the document capturing +} +``` + +### Invoke the Document Capturing + +```python +using (CaptureVisionRouter cvr = new CaptureVisionRouter()) +{ + string imageFile = "[PATH-TO-THE-IMAGE-FILE]" + CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_DETECT_AND_NORMALIZE_DOCUMENT) + //code for filtering and getting document detection and normalization results +} +``` + +> Please change the `[PATH-TO-THE-IMAGE-FILE]` to a real image file path. +> +> Sample images are also available in the `\Dynamsoft\Resources\DocumentNormalizer\Images` directory within the downloaded `python Package`. + +### Filter and Get Document Detection and Normalization Results + +```python +if (result == null) +{ + Console.WriteLine("No Result.") +} +else if(result.get_error_code() != 0) +{ + Console.WriteLine("Error: " + result.get_error_code() + ", " + result.get_error_string()) +} +else +{ + NormalizedImagesResult? normalizedImagesResult = result.get_normalized_images_result() + if (normalizedImagesResult != null) + { + NormalizedImageResultItem[] items = normalizedImagesResult.get_items() + Console.WriteLine("Detected and Normalized " + items.Length + " documents") + foreach (NormalizedImageResultItem normalizedItem in items) + { + string outPath = "normalizedResult_" + Array.IndexOf(items, normalizedItem) + ".png" + ImageManager imageManager = new ImageManager() + var image = normalizedItem.get_image_data() + if (image != null) + { + error_code = imageManager.save_to_file(image, outPath) + if (error_code == 0) + { + Console.WriteLine("Document " + Array.IndexOf(items, normalizedItem) + " file: " + outPath) + } + } + } + } +} +``` + +### Build and Run the Project + +Save the `Program.cs` file and then compile and run the program using your IDE (such as Visual Studio). You will see the output message in the console like + +``` +Detected and Normalized 1 documents +Document 1 file: normalizedResult_1.png +``` + +## Process Multiple Images + +If, instead of processing one single image, you need to process many images at once, you can follow these steps: + +> These steps follow the step [Create a CaptureVisionRouter Instance](#create-a-capturevisionrouter-instance) mentioned above. + +> You can download the entire source code from here. + +### Import the Additional Namespace. + +```python +using Dynamsoft.Utility +``` + +### Create an ImageSource as the Input + +An `ImageSource` is required when crreating a multi-image processing application. You can either utilize ready-made image sources such as [`FileFetcher`]({{ site.dcv_python_api }}utility/file-fetcher.html) and [`DirectoryFetcher`]({{ site.dcv_python_api }}utility/directory-fetcher.html), or customize your own image source based on the base class [`ImageSourceAdapter`]({{ site.dcv_python_api }}core/basic-classes/image-source-adapter.html). + +In this sample, we will use the `DirectoryFetcher` to retrieve images from a local directory. + +```python +DirectoryFetcher fetcher = new DirectoryFetcher() +fetcher.set_directory("[THE DIRECTORY THAT HOLDS THE IMAGES]") +``` + +> Please change the `[THE DIRECTORY THAT HOLDS THE IMAGES]` to full path of the directory holding image files. +> +> Sample images are also available in the `\Dynamsoft\Resources\DocumentNormalizer\Images` directory within the downloaded `python Package`. + +### Implement a CapturedResultReceiver as the Output Listener + +Create a class `MyCapturedResultReceiver` to implement the `CapturedResultReceiver` class, and get the barocde results in `on_normalized_images_received` callback function. + +```python +class MyCapturedResultReceiver : CapturedResultReceiver +{ + public override void on_normalized_images_received(NormalizedImagesResult result) + { + FileImageTag? tag = (FileImageTag?)result.get_original_image_tag() + Console.WriteLine("File: " + tag.get_file_path()) + if (result.get_error_code() != (int)EnumErrorCode.EC_OK) + { + Console.WriteLine("Error: " + result.get_error_string()) + } + else + { + NormalizedImagesResult? normalizedImagesResult = result.get_normalized_images_result() + if (normalizedImagesResult != null) + { + NormalizedImageResultItem[] items = normalizedImagesResult.get_items() + Console.WriteLine("Detected and Normalized " + items.Length + " documents") + foreach (NormalizedImageResultItem normalizedItem in items) + { + string outPath = "normalizedResult_" + Array.IndexOf(items, normalizedItem) + ".png" + ImageManager imageManager = new ImageManager() + var image = normalizedItem.get_image_data() + if (image != null) + { + error_code = imageManager.save_to_file(image, outPath) + if (error_code == 0) + { + Console.WriteLine("Document " + Array.IndexOf(items, normalizedItem) + " file: " + outPath) + } + } + } + } + } + Console.WriteLine() + } +} +``` + +### Handle Capture Stoppage by Implementing a ImageSource State Listener + +Create a class `MyImageSourceStateListener` to implement the `ImageSourceStateListener` class, and call stop_capturing in `on_image_source_state_received` callback function when the state is `ISS_EXHAUSTED`. + +```python +class MyImageSourceStateListener : ImageSourceStateListener +{ + private CaptureVisionRouter? cvr = null + public MyImageSourceStateListener(CaptureVisionRouter cvr) + { + this.cvr = cvr + } + public void on_image_source_state_received(EnumImageSourceState state) + { + if (state == EnumImageSourceState.ISS_EXHAUSTED) + { + if (cvr != null) + { + cvr.stop_capturing() + } + } + } +} +``` + +### Register the Input, Output Listener and ImageSource State Listener to the CaptureVisionRouter Instance + +```python +cvr.set_input(fetcher) +CapturedResultReceiver receiver = new MyCapturedResultReceiver() +cvr.add_result_receiver(receiver) +MyImageSourceStateListener listener = new MyImageSourceStateListener(cvr) +cvr.add_image_source_state_listener(listener) +``` + +### Start the Capturing Process + +Call the method `start_capturing()` to start processing all the images in the specified folder. + +```python +error_code = cvr.start_capturing(PresetTemplate.PT_DETECT_AND_NORMALIZE_DOCUMENT, true, out errorMsg) +if (error_code != (int)EnumErrorCode.EC_OK) +{ + Console.WriteLine("error: " + errorMsg) +} +``` + +During the process, the callback function `on_normalized_images_received()` is triggered each time processing of an image is finished. After all images are processed, the listener function `on_image_source_state_received()` will be triggered while the image source state is `ISS_EXHAUSTED` and the process is stopped with the method `stop_capturing()`. + +### Build and Run the Project Again + +Please refer to [Build and Run the Project](#build-and-run-the-project). + diff --git a/search.md b/search.md index 1a49355..8b06a39 100644 --- a/search.md +++ b/search.md @@ -2,4 +2,5 @@ layout: search-page title: Dynamsoft Document Normalizer Documentation Search keywords: Dynamsoft Document Normalizer Documentation Search +cx: 90b37820e9a5e454e --- \ No newline at end of file