dynamsoft-capture-vision-react-native 2.6.1016 → 3.0.5100

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.
Files changed (138) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +7 -9
  3. package/android/build.gradle +73 -42
  4. package/android/src/main/cpp/CMakeLists.txt +22 -0
  5. package/android/src/main/cpp/ImgHO.cpp +95 -0
  6. package/android/src/main/cpp/ImgHO.h +34 -0
  7. package/android/src/main/cpp/JsiCore.cpp +284 -0
  8. package/android/src/main/cpp/JsiCore.h +51 -0
  9. package/android/src/main/cpp/JsiCvr.cpp +327 -0
  10. package/android/src/main/cpp/JsiCvr.h +54 -0
  11. package/android/src/main/cpp/JsiDbr.cpp +38 -0
  12. package/android/src/main/cpp/JsiDbr.h +26 -0
  13. package/android/src/main/cpp/JsiDce.cpp +59 -0
  14. package/android/src/main/cpp/JsiDce.h +17 -0
  15. package/android/src/main/cpp/JsiDcp.cpp +51 -0
  16. package/android/src/main/cpp/JsiDcp.h +31 -0
  17. package/android/src/main/cpp/JsiDdn.cpp +50 -0
  18. package/android/src/main/cpp/JsiDdn.h +28 -0
  19. package/android/src/main/cpp/JsiDlr.cpp +51 -0
  20. package/android/src/main/cpp/JsiDlr.h +26 -0
  21. package/android/src/main/cpp/JsiUtility.cpp +196 -0
  22. package/android/src/main/cpp/JsiUtility.h +16 -0
  23. package/android/src/main/cpp/RawBuffer.cpp +24 -0
  24. package/android/src/main/cpp/RawBuffer.h +24 -0
  25. package/android/src/main/cpp/android_log.h +14 -0
  26. package/android/src/main/dysJniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  27. package/android/src/main/dysJniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  28. package/android/src/main/dysJniLibs/debug/x86/librn_dys.so +0 -0
  29. package/android/src/main/dysJniLibs/debug/x86_64/librn_dys.so +0 -0
  30. package/android/src/main/dysJniLibs/release/arm64-v8a/librn_dys.so +0 -0
  31. package/android/src/main/dysJniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  32. package/android/src/main/dysJniLibs/release/x86/librn_dys.so +0 -0
  33. package/android/src/main/dysJniLibs/release/x86_64/librn_dys.so +0 -0
  34. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
  35. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +10 -0
  36. package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
  37. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
  38. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +25 -25
  39. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +23 -2
  40. package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
  41. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
  42. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
  43. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
  44. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
  45. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
  46. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
  47. package/dynamsoft-capture-vision-react-native.podspec +9 -7
  48. package/ios/CPP/DSImageData+HostObject.h +1 -1
  49. package/ios/CPP/RNDynamsoft+JSI.h +2 -2
  50. package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
  51. package/ios/CPP/RNDynamsoft+Json.h +2 -13
  52. package/ios/CPP/RNDynamsoft+Json.m +48 -39
  53. package/ios/CPP/YeetJSIUtils.h +3 -1
  54. package/ios/CPP/YeetJSIUtils.mm +5 -0
  55. package/ios/RNDynamsoftCameraView.m +1 -1
  56. package/ios/RNDynamsoftCameraViewManager.m +23 -8
  57. package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
  58. package/ios/RNDynamsoftImageEditorView.m +1 -1
  59. package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
  60. package/ios/RNDynamsoftImageManager.mm +33 -4
  61. package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
  62. package/ios/RNDynamsoftLicense.m +1 -1
  63. package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
  64. package/ios/RNDynamsoftVersions.m +1 -13
  65. package/package.json +3 -11
  66. package/src/core/CapturedResultBase.tsx +18 -0
  67. package/src/core/EnumCaptureResultItemType.tsx +12 -6
  68. package/src/core/EnumCrossVerificationStatus.tsx +6 -6
  69. package/src/core/ImageData.tsx +1 -1
  70. package/src/core/index.tsx +1 -0
  71. package/src/cvr/CaptureVisionRouter.tsx +47 -51
  72. package/src/cvr/CapturedResult.tsx +24 -46
  73. package/src/cvr/CapturedResultReceiver.tsx +12 -19
  74. package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
  75. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
  76. package/src/dbr/DecodedBarcodesResult.tsx +3 -17
  77. package/src/dce/CameraEnhancer.tsx +9 -0
  78. package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
  79. package/src/dce/EnumResolution.tsx +7 -0
  80. package/src/dce/NativeDynamsoftCameraViewModule.tsx +4 -0
  81. package/src/dce/index.tsx +1 -0
  82. package/src/dcp/ParsedResult.tsx +3 -14
  83. package/src/ddn/DeskewedImageResultItem.tsx +40 -0
  84. package/src/ddn/DetectedQuadResultItem.tsx +3 -1
  85. package/src/ddn/EnhancedImageResultItem.tsx +20 -0
  86. package/src/ddn/ProcessedDocumentResult.tsx +27 -0
  87. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
  88. package/src/ddn/index.tsx +3 -3
  89. package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
  90. package/src/index.tsx +0 -1
  91. package/src/utility/ImageManager.tsx +66 -45
  92. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
  93. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
  94. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
  95. package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
  96. package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
  97. package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
  98. package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
  99. package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
  100. package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
  101. package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
  102. package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
  103. package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
  104. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
  105. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
  106. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
  107. package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
  108. package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
  109. package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
  110. package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
  111. package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
  112. package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
  113. package/ios/RNDynamsoftBarcodeScanner.h +0 -14
  114. package/ios/RNDynamsoftBarcodeScanner.m +0 -169
  115. package/ios/RNDynamsoftMRZScanner.h +0 -14
  116. package/ios/RNDynamsoftMRZScanner.m +0 -140
  117. package/src/ddn/DetectedQuadsResult.tsx +0 -31
  118. package/src/ddn/NormalizedImageResultItem.tsx +0 -32
  119. package/src/ddn/NormalizedImagesResult.tsx +0 -27
  120. package/src/rtu/BarcodeScanConfig.tsx +0 -104
  121. package/src/rtu/BarcodeScanResult.tsx +0 -31
  122. package/src/rtu/BarcodeScanner.tsx +0 -112
  123. package/src/rtu/EnumResultState.tsx +0 -21
  124. package/src/rtu/MRZScanConfig.tsx +0 -67
  125. package/src/rtu/MRZScanResult.tsx +0 -84
  126. package/src/rtu/MRZScanner.tsx +0 -90
  127. package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
  128. package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
  129. package/src/rtu/index.tsx +0 -7
  130. /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
  131. /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
  132. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
  133. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
  134. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
  135. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
  136. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
  137. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
  138. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
@@ -1,8 +1,9 @@
1
1
  import type {CapturedResult} from "./CapturedResult";
2
2
  import type {DecodedBarcodesResult} from "../dbr";
3
- import type {DetectedQuadsResult, NormalizedImagesResult} from "../ddn";
4
3
  import type {RecognizedTextLinesResult} from "../dlr";
5
4
  import type {ParsedResult} from "../dcp";
5
+ import type {ProcessedDocumentResult} from "../ddn";
6
+ import { CaptureVisionRouter } from ".";
6
7
 
7
8
  /**
8
9
  * The CapturedResultReceiver class is designed as a standardized way for retrieving captured results in the Dynamsoft Capture Vision architecture.
@@ -42,24 +43,6 @@ export interface CapturedResultReceiver {
42
43
  * */
43
44
  onDecodedBarcodesReceived?: (result: DecodedBarcodesResult) => void;
44
45
 
45
- /**
46
- * Event triggered when detected quads are available.
47
- * This event is used to handle the detection of quadrilateral shapes, typically used as document boundaries,
48
- * by Dynamsoft Document Normalizer.
49
- *
50
- * @see {@link DetectedQuadsResult}
51
- * */
52
- onDetectedQuadsReceived?: (result: DetectedQuadsResult) => void;
53
-
54
- /**
55
- * Event triggered when normalized images are available.
56
- * This event is used for handling images that have been processed or normalized (e.g., corrected for skew or perspective),
57
- * by Dynamsoft Document Normalizer.
58
- *
59
- * @see {@link NormalizedImagesResult}
60
- * */
61
- onNormalizedImagesReceived?: (result: NormalizedImagesResult) => void;
62
-
63
46
  /**
64
47
  * Event triggered when recognized text lines are available.
65
48
  * This event is used to handle the result of text recognition by Dynamsoft Label Recognizer.
@@ -75,4 +58,14 @@ export interface CapturedResultReceiver {
75
58
  * @see {@link ParsedResult}
76
59
  * */
77
60
  onParsedResultsReceived?: (result: ParsedResult) => void;
61
+
62
+ /**
63
+ * Event triggered when processed document result are available.
64
+ * This event is used for handling images that have been processed or normalized (e.g., corrected for skew or perspective),
65
+ * by Dynamsoft Document Normalizer.
66
+ *
67
+ * @see {@link ProcessedDocumentResult}
68
+ * */
69
+ onProcessedDocumentResultReceived?: (result: ProcessedDocumentResult) => void;
70
+
78
71
  }
@@ -13,8 +13,8 @@ export interface Spec extends TurboModule {
13
13
  updateSettings(settings: unknown, templateName: string): Promise<void>;
14
14
  initSettings(content: string): Promise<void>;
15
15
  initSettingsFromFile(file: string): Promise<void>;
16
- outputSettings(templateName: string): Promise<string | null>;
17
- outputSettingsToFile(file: string, templateName: string): Promise<void>;
16
+ outputSettings(templateName: string, includeDefaultValues: boolean): Promise<string | null>;
17
+ outputSettingsToFile(file: string, templateName: string, includeDefaultValues: boolean): Promise<void>;
18
18
 
19
19
  addListener(type: string): void;
20
20
  removeListeners(count: number): void;
@@ -1,4 +1,4 @@
1
- import type {EnumCapturedResultItemType, Quadrilateral} from "../core";
1
+ import type {Quadrilateral} from "../core";
2
2
  import type {SimplifiedBarcodeReaderSettings} from "../dbr";
3
3
  import type {SimplifiedLabelRecognizerSettings} from "../dlr";
4
4
  import type {SimplifiedDocumentNormalizerSettings} from "../ddn";
@@ -10,9 +10,9 @@ import type {SimplifiedDocumentNormalizerSettings} from "../ddn";
10
10
  * */
11
11
  export interface SimplifiedCaptureVisionSettings {
12
12
  /**
13
- * Specifies the types of result items that are expected to be returned. It is of type {@link EnumCapturedResultItemType}.
14
- * */
15
- capturedResultItemTypes?: EnumCapturedResultItemType | number;
13
+ * Specifies whether to output the original image.
14
+ * */
15
+ outputOriginalImage?: boolean;
16
16
 
17
17
  /**
18
18
  * Designates the region of interest (ROI) within an image,
@@ -1,28 +1,14 @@
1
1
  import type {BarcodeResultItem} from "./BarcodeResultItem";
2
- import type {CapturedResultReceiver, IntermediateResultManager} from "../cvr";
2
+ import type {CapturedResultReceiver} from "../cvr";
3
+ import type {CapturedResultBase} from "../core";
3
4
 
4
5
  /**
5
6
  * Interface DecodedBarcodesResult represents information of decoded barcodes from an image.
6
7
  * @see {@link CapturedResultReceiver.onDecodedBarcodesReceived}
7
8
  * */
8
- export interface DecodedBarcodesResult {
9
- /**
10
- * A unique identifier or hash of the original image from which the barcodes were decoded. It can be used to associate the result with a specific input image.
11
- * @see {@link IntermediateResultManager.getOriginalImage}
12
- * */
13
- originalImageHashId: string;
14
-
9
+ export interface DecodedBarcodesResult extends CapturedResultBase{
15
10
  /**
16
11
  * An array of {@link BarcodeResultItem} objects, representing the list of decoded barcodes found in the image.
17
12
  * */
18
13
  items?: Array<BarcodeResultItem>;
19
-
20
- /**The error code of the barcode reading result, if an error occurred.*/
21
- errorCode: number;
22
-
23
- /**The error message of the barcode reading result, if an error occurred.*/
24
- errorMessage?: string;
25
-
26
- /**the rotation transformation matrix of the original image relative to the rotated image.*/
27
- rotationTransformMatrix: Array<number>;
28
14
  }
@@ -4,6 +4,7 @@ import {CameraView} from "./CameraView"
4
4
  import type {EnumCameraPosition} from "./EnumCameraPosition";
5
5
  import type {EnumFocusMode} from "./EnumFocusMode";
6
6
  import type {EnumEnhancedFeatures} from "./EnumEnhancedFeatures";
7
+ import type {EnumResolution} from "./EnumResolution";
7
8
 
8
9
  // @ts-ignore Check whether __turboModuleProxy exists, it may not
9
10
  const isTurboModuleEnabled = global.__turboModuleProxy != null;
@@ -220,6 +221,14 @@ export class CameraEnhancer extends ImageSourceAdapter {
220
221
  DynamsoftCameraEnhancerModule.turnOffTorch()
221
222
  }
222
223
 
224
+ /**
225
+ * Set the resolution of the camera.
226
+ * @param resolution - One of the {@link EnumResolution}.
227
+ * */
228
+ setResolution(resolution: EnumResolution) {
229
+ DynamsoftCameraEnhancerModule.setResolution(resolution);
230
+ }
231
+
223
232
  destroy() {
224
233
  this.close()
225
234
  super.destroy();
@@ -3,13 +3,13 @@ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNati
3
3
  import type {Int32} from "react-native/Libraries/Types/CodegenTypes";
4
4
  import type {DecodedBarcodesResult} from "../dbr";
5
5
  import type {RecognizedTextLinesResult} from "../dlr";
6
- import type {DetectedQuadsResult, NormalizedImagesResult} from "../ddn";
6
+ import type {ProcessedDocumentResult} from "../ddn";
7
7
 
8
8
  export interface CameraViewNativeProps extends ViewProps {
9
9
  /**
10
10
  * CameraView has three default drawing layers corresponding to
11
11
  * {@link EnumDrawingLayerId.DBR_LAYER_ID}/{@link EnumDrawingLayerId.DLR_LAYER_ID}/{@link EnumDrawingLayerId.DDN_LAYER_ID},
12
- * they will draw the corresponding {@link DecodedBarcodesResult}/{@link RecognizedTextLinesResult}/{@link DetectedQuadsResult} or {@link NormalizedImagesResult} on the camera preview.
12
+ * they will draw the corresponding {@link DecodedBarcodesResult}/{@link RecognizedTextLinesResult}/{@link ProcessedDocumentResult} on the camera preview.
13
13
  * If visibleLayerIds is undefined, all layer will be visible.
14
14
  * If defined, only the DrawingLayer corresponding to the layerId in the array will be visible.
15
15
  *
@@ -0,0 +1,7 @@
1
+ export enum EnumResolution {
2
+ RESOLUTION_AUTO = 0,
3
+ RESOLUTION_480P = 1,
4
+ RESOLUTION_720P = 2,
5
+ Resolution1080P = 3,
6
+ RESOLUTION_4K = 4,
7
+ }
@@ -35,6 +35,10 @@ export interface Spec extends TurboModule {
35
35
 
36
36
  turnOffTorch(): void;
37
37
 
38
+ setResolution(resolution: number): void;
39
+
40
+ getResolution(): Promise<unknown>;
41
+
38
42
  beep(): void;
39
43
 
40
44
  vibrate(): void;
package/src/dce/index.tsx CHANGED
@@ -8,5 +8,6 @@ export * from "./EnumFocusMode"
8
8
  export * from "./EnumTorchState"
9
9
  export * from "./FeedBack"
10
10
  export * from "./ImageEditorView"
11
+ export * from "./EnumResolution"
11
12
  export type {CameraViewNativeProps} from "./DynamsoftCameraViewNativeComponent"
12
13
  export type {ImageEditorViewNativeProps} from "./DynamsoftImageEditorViewNativeComponent"
@@ -1,25 +1,14 @@
1
1
  import type {ParsedResultItem} from "./ParsedResultItem";
2
- import type {CapturedResultReceiver, IntermediateResultManager} from "../cvr";
2
+ import type {CapturedResultReceiver} from "../cvr";
3
+ import type {CapturedResultBase} from "../core/CapturedResultBase";
3
4
 
4
5
  /**
5
6
  * The ParsedResult interface provides a structure representing the result object returned by Dynamsoft Code Parser.
6
7
  * @see {@link CapturedResultReceiver.onParsedResultsReceived}
7
8
  * */
8
- export interface ParsedResult {
9
- /**
10
- * A unique identifier or hash of the original image from which the barcodes were decoded. It can be used to associate the result with a specific input image.
11
- * @see {@link IntermediateResultManager.getOriginalImage}
12
- * */
13
- originalImageHashId: string;
14
-
9
+ export interface ParsedResult extends CapturedResultBase {
15
10
  /**An array that contains all {@link ParsedResultItem}s.
16
11
  * @see {@link ParsedResultItem}
17
12
  * */
18
13
  items?: Array<ParsedResultItem>;
19
-
20
- /**The error code of the parsing operation., if an error occurred.*/
21
- errorCode: number;
22
-
23
- /**The error message of parsing operation., if an error occurred.*/
24
- errorMessage?: string;
25
14
  }
@@ -0,0 +1,40 @@
1
+ import {type CapturedResultItem, EnumCrossVerificationStatus, type ImageData, type Quadrilateral, EnumCapturedResultItemType} from "../core";
2
+ import { type ProcessedDocumentResult } from "./ProcessedDocumentResult";
3
+ import {CaptureVisionRouter} from "../cvr";
4
+ import {MultiFrameResultCrossFilter} from "../utility"
5
+
6
+ /**
7
+ * The DeskewedImageResultItem interface extends the {@link CapturedResultItem} interface and represents a deskewed image.
8
+ * @see {@link EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE}
9
+ * @see {@link ProcessedDocumentResult.deskewedImageResultItems}
10
+ * */
11
+ export interface DeskewedImageResultItem extends CapturedResultItem {
12
+ /**
13
+ * The quadrilateral from which you get the deskewed image result item.
14
+ * @see {@link Quadrilateral}
15
+ * */
16
+ sourceDeskewQuad: Quadrilateral;
17
+
18
+ /**
19
+ * The cross verification status of type {@link EnumCrossVerificationStatus}.
20
+ *
21
+ * @remarks If {@link CaptureVisionRouter} doesn't add {@link MultiFrameResultCrossFilter} via {@link CaptureVisionRouter.addFilter}
22
+ * or added {@link MultiFrameResultCrossFilter} doesn't enable verification for the corresponding type,
23
+ * the crossVerificationStatus property of the item for that type will always remain {@link EnumCrossVerificationStatus.CVS_NOT_VERIFIED}.
24
+ *
25
+ * @see {@link EnumCrossVerificationStatus}
26
+ * @see {@link MultiFrameResultCrossFilter.enableResultCrossVerification}
27
+ * */
28
+ crossVerificationStatus: EnumCrossVerificationStatus | number;
29
+
30
+ /**
31
+ * The transformation matrix from the original image coordinate system to the local coordinate system.
32
+ * */
33
+ originalToLocalMatrix: Array<number>;
34
+
35
+ /**
36
+ * An ImageData object as the deskewed image.
37
+ * @see {@link ImageData}
38
+ * */
39
+ imageData: ImageData;
40
+ }
@@ -1,10 +1,12 @@
1
1
  import type {CapturedResultItem, Quadrilateral, EnumCapturedResultItemType, EnumCrossVerificationStatus} from "../core";
2
2
  import {MultiFrameResultCrossFilter} from "../utility";
3
3
  import {CaptureVisionRouter} from "../cvr";
4
+ import { type ProcessedDocumentResult } from "./ProcessedDocumentResult";
5
+
4
6
  /**
5
7
  * The DetectedQuadResultItem interface extends the {@link CapturedResultItem} interface and represents a detected quadrilateral result item.
6
8
  * @see {@link EnumCapturedResultItemType.CRIT_DETECTED_QUAD}
7
- * @see {@link DetectedQuadsResult}
9
+ * @see {@link ProcessedDocumentResult.detectedQuadResultItems}
8
10
  * */
9
11
  export interface DetectedQuadResultItem extends CapturedResultItem {
10
12
  /**
@@ -0,0 +1,20 @@
1
+ import { type ProcessedDocumentResult } from "./ProcessedDocumentResult";
2
+ import type {CapturedResultItem, ImageData, EnumCapturedResultItemType} from "../core";
3
+
4
+ /**
5
+ * The EnhancedImageResultItem interface extends the {@link CapturedResultItem} interface and represents a enhanced image.
6
+ * @see {@link EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE}
7
+ * @see {@link ProcessedDocumentResult.enhancedImageResultItems}
8
+ * */
9
+ export interface EnhancedImageResultItem extends CapturedResultItem{
10
+ /**
11
+ * The transformation matrix from the original image coordinate system to the local coordinate system.
12
+ * */
13
+ originalToLocalMatrix: Array<number>;
14
+
15
+ /**
16
+ * An ImageData object as the enhanced image.
17
+ @see {@link ImageData}
18
+ * */
19
+ imageData: ImageData;
20
+ }
@@ -0,0 +1,27 @@
1
+ import type {CapturedResultBase} from "../core";
2
+ import type {DeskewedImageResultItem} from "./DeskewedImageResultItem";
3
+ import type {CapturedResultReceiver} from "../cvr";
4
+ import type {DetectedQuadResultItem} from "../ddn";
5
+ import type {EnhancedImageResultItem} from "./EnhancedImageResultItem";
6
+
7
+ /**
8
+ * The ProcessedDocumentResult interface holds information on processed document result,
9
+ * of type {@link DetectedQuadResultItem}, within an image.
10
+ * @see {@link CapturedResultReceiver.onProcessedDocumentResultReceived}
11
+ * */
12
+ export interface ProcessedDocumentResult extends CapturedResultBase {
13
+ /**
14
+ * Gets the deskew images with an array of {@link DeskewedImageResultItem}
15
+ * */
16
+ deskewedImageResultItems?: Array<DeskewedImageResultItem>;
17
+
18
+ /**
19
+ * Gets the detected boundaries with an array of {@link DetectedQuadResultItem}.
20
+ * */
21
+ detectedQuadResultItems?: Array<DetectedQuadResultItem>;
22
+
23
+ /**
24
+ * Gets the enhanced images with an array of {@link EnhancedImageResultItem}.
25
+ * */
26
+ enhancedImageResultItems?: Array<EnhancedImageResultItem>;
27
+ }
@@ -8,14 +8,14 @@ import type {SimplifiedCaptureVisionSettings} from "../cvr";
8
8
  * */
9
9
  export interface SimplifiedDocumentNormalizerSettings {
10
10
  /**
11
- * Set the grayscale transformation modes with an array of enumeration GrayscaleTransformationMode.
11
+ * Sets the grayscale transformation modes with an array of enumeration GrayscaleTransformationMode.
12
12
  * View the reference page of GrayscaleTransformationModes for more detail about grayscale transformation modes.
13
13
  * @see {@link EnumGrayscaleTransformationMode}
14
14
  * */
15
15
  grayscaleTransformationModes?: Int32Array | Array<EnumGrayscaleTransformationMode>
16
16
 
17
17
  /**
18
- * Set the grayscale enhancement modes with an array of enumeration GrayscaleEnhancementMode.
18
+ * Sets the grayscale enhancement modes with an array of enumeration GrayscaleEnhancementMode.
19
19
  * View the reference page of GrayscaleEnhancementModes for more detail about grayscale enhancement modes.
20
20
  * @see {@link EnumGrayscaleEnhancementMode}
21
21
  * */
@@ -39,12 +39,27 @@ export interface SimplifiedDocumentNormalizerSettings {
39
39
  * Sets the contrast of the normalized image. The value range is [-100,100].
40
40
  * */
41
41
  contrast?: number
42
+
43
+ /**
44
+ * Sets the maximum number of threads in one task.
45
+ * */
42
46
  maxThreadsInOneTask?: number
43
47
 
44
48
  /**
45
- * Set the threshold for scaling down the input image during document detection.
49
+ * Sets the threshold for scaling down the input image during document detection.
46
50
  * If the shorter edge size of the image is larger than this threshold,the original may be scaled down to reduce processing time.
47
51
  * The default value is 2300.
48
52
  * */
49
53
  scaleDownThreshold?: number
54
+
55
+
56
+ /**
57
+ * Sets the minimum ratio between the target document area and the total image area. Only those exceeding this value will be output (measured in percentages).
58
+ * */
59
+ minQuadrilateralAreaRatio?: number
60
+
61
+ /**
62
+ * Sets the number of documents expected to be detected.
63
+ * */
64
+ expectedDocumentsCount?: number
50
65
  }
package/src/ddn/index.tsx CHANGED
@@ -1,11 +1,11 @@
1
1
  export * from "./DetectedQuadResultItem"
2
- export * from "./DetectedQuadsResult"
2
+ export * from "./DeskewedImageResultItem"
3
+ export * from "./EnhancedImageResultItem"
3
4
 
4
5
  export * from "./DocumentNormalizerModule"
5
6
 
6
7
  export * from "./EnumImageColourMode"
7
8
 
8
- export * from "./NormalizedImageResultItem"
9
- export * from "./NormalizedImagesResult"
9
+ export * from "./ProcessedDocumentResult"
10
10
 
11
11
  export * from "./SimplifiedDocumentNormalizerSettings"
@@ -1,5 +1,6 @@
1
1
  import type {TextLineResultItem} from "./TextLineResultItem";
2
2
  import {type CapturedResultReceiver, IntermediateResultManager} from "../cvr";
3
+ import type {CapturedResultBase} from "../core";
3
4
 
4
5
  /**{@link IntermediateResultManager}*/
5
6
  /**
@@ -9,25 +10,10 @@ import {type CapturedResultReceiver, IntermediateResultManager} from "../cvr";
9
10
  *
10
11
  * @see {@link CapturedResultReceiver.onRecognizedTextLinesReceived}
11
12
  * */
12
- export interface RecognizedTextLinesResult {
13
- /**
14
- * The hash ID of the original image.
15
- * @see {@link IntermediateResultManager.getOriginalImage}
16
- * */
17
- originalImageHashId: string;
18
-
13
+ export interface RecognizedTextLinesResult extends CapturedResultBase{
19
14
  /**
20
15
  * All the recognized text line result items.
21
16
  * @see {@link TextLineResultItem}
22
17
  * */
23
18
  items?: Array<TextLineResultItem>;
24
-
25
- /**The error code of the barcode reading result, if an error occurred.*/
26
- errorCode: number;
27
-
28
- /**The error message of the barcode reading result, if an error occurred.*/
29
- errorMessage?: string;
30
-
31
- /**the rotation transformation matrix of the original image relative to the rotated image.*/
32
- rotationTransformMatrix: Array<number>;
33
19
  }
package/src/index.tsx CHANGED
@@ -10,5 +10,4 @@ export * from "./dip/index"
10
10
  export * from "./dlr/index"
11
11
  export * from "./license/index"
12
12
  export * from "./utility/index"
13
- export * from "./rtu/index"
14
13
 
@@ -5,20 +5,23 @@ import type {ImageData, Quadrilateral} from "../core";
5
5
  const isTurboModuleEnabled = global.__turboModuleProxy != null;
6
6
 
7
7
  const DynamsoftImageManagerModule = isTurboModuleEnabled ?
8
- require("./NativeDynamsoftImageManagerModule").default :
9
- NativeModules.DynamsoftImageManagerModule;
8
+ require("./NativeDynamsoftImageManagerModule").default :
9
+ NativeModules.DynamsoftImageManagerModule;
10
10
 
11
11
  declare global {
12
- function imageManager_saveToFile(imageData: ImageData, path: string, overWrite: boolean): void;
13
- function imageManager_drawOnImage(imageData: ImageData, quads: Quadrilateral[], colour:number, thickness:number): ImageData;
12
+ function imageManager_saveToFile(imageData: ImageData, path: string, overWrite: boolean): void;
13
+
14
+ function imageManager_drawOnImage(imageData: ImageData, quads: Quadrilateral[], colour: number, thickness: number): ImageData;
15
+
16
+ function imageManager_cropImage(imageData: ImageData, quads: Quadrilateral): ImageData | undefined;
14
17
  }
15
18
 
16
19
  let isInstalled = false
17
20
  const installMethods = () => {
18
- if(!isInstalled) {
19
- DynamsoftImageManagerModule.install()
20
- isInstalled = true
21
- }
21
+ if (!isInstalled) {
22
+ DynamsoftImageManagerModule.install()
23
+ isInstalled = true
24
+ }
22
25
  }
23
26
 
24
27
  /**
@@ -26,45 +29,63 @@ const installMethods = () => {
26
29
  * It provides functionality for saving images to files and drawing various shapes on images.
27
30
  * */
28
31
  export class ImageManager {
29
- /**
30
- * Saves an image to the specified path and format.
31
- * The desired file format is inferred from the file extension provided in the path parameter.
32
- *
33
- * @param imageData - The image to be saved, of type {@link ImageData}.
34
- * @param path - The absolute file path, name and extension name, as a string, under which the image will be saved.
35
- * @param overWrite - A flag indicating whether to overwrite the file if it already exists. Defaults to true.
36
- * */
37
- saveToFile(imageData: ImageData | null | undefined, path: string | null | undefined, overWrite: boolean): void {
38
- installMethods();
39
- if(imageData && path){
40
- if(path.length > 0) {
41
- global.imageManager_saveToFile(imageData, path, overWrite);
42
- }
43
- }
32
+ /**
33
+ * Saves an image to the specified path and format.
34
+ * The desired file format is inferred from the file extension provided in the path parameter.
35
+ *
36
+ * @param imageData - The image to be saved, of type {@link ImageData}.
37
+ * @param path - The absolute file path, name and extension name, as a string, under which the image will be saved.
38
+ * @param overWrite - A flag indicating whether to overwrite the file if it already exists. Defaults to true.
39
+ * */
40
+ saveToFile(imageData: ImageData | null | undefined, path: string | null | undefined, overWrite: boolean): void {
41
+ installMethods();
42
+ if (imageData && path) {
43
+ if (path.length > 0) {
44
+ global.imageManager_saveToFile(imageData, path, overWrite);
45
+ }
44
46
  }
47
+ }
45
48
 
46
- /**
47
- * Add quadrilaterals on the image.
48
- *
49
- * @param imageData - The {@link ImageData} to modify.
50
- * @param quads - An array of {@link Quadrilateral} objects to be added on the image.
51
- * @param colour - An ColorValue as an ARGB colour.
52
- * @param thickness - The width of the border.
53
- *
54
- * @return {ImageData|null|undefined} - The modified ImageData.
55
- * */
56
- drawOnImage(imageData: ImageData | null | undefined, quads: Quadrilateral[] | null | undefined, colour:number | ColorValue, thickness:number): ImageData | null | undefined {
57
- installMethods();
58
- if(imageData && quads){
59
- const colorNumber = processColor(colour) as number;
60
- if(colorNumber) {
61
- const alpha = (colorNumber >> 24) & 0xff;
62
- if(quads.length == 0 || thickness <= 0 || alpha == 0) {
63
- return imageData;
64
- }
65
- return global.imageManager_drawOnImage(imageData, quads, colorNumber, thickness);
66
- }
49
+ /**
50
+ * Add quadrilaterals on the image.
51
+ *
52
+ * @param imageData - The {@link ImageData} to modify.
53
+ * @param quads - An array of {@link Quadrilateral} objects to be added on the image.
54
+ * @param colour - An ColorValue as an ARGB colour.
55
+ * @param thickness - The width of the border.
56
+ *
57
+ * @return {ImageData|null|undefined} - The modified ImageData.
58
+ * */
59
+ drawOnImage(imageData: ImageData | null | undefined, quads: Quadrilateral[] | null | undefined, colour: number | ColorValue, thickness: number): ImageData | null | undefined {
60
+ installMethods();
61
+ if (imageData && quads) {
62
+ const colorNumber = processColor(colour) as number;
63
+ if (colorNumber) {
64
+ const alpha = (colorNumber >> 24) & 0xff;
65
+ if (quads.length == 0 || thickness <= 0 || alpha == 0) {
66
+ return imageData;
67
67
  }
68
- return imageData;
68
+ return global.imageManager_drawOnImage(imageData, quads, colorNumber, thickness);
69
+ }
69
70
  }
71
+ return imageData;
72
+ }
73
+
74
+
75
+ /**
76
+ * Crops an image using a quadrilateral.
77
+ * @param {ImageData} imageData - The image data to crop.
78
+ * @param {Quadrilateral} quad - The quadrilateral to use for cropping.
79
+ *
80
+ * @returns {ImageData|null|undefined} - The cropped image data.
81
+ * */
82
+ cropImage(imageData: ImageData | null | undefined, quad: Quadrilateral | null | undefined): ImageData | undefined | null {
83
+ installMethods();
84
+ if (!quad || !imageData) {
85
+ return imageData;
86
+ }
87
+ return global.imageManager_cropImage(imageData, quad);
88
+ }
89
+
90
+
70
91
  }
@@ -1,80 +0,0 @@
1
- package com.dynamsoft.reactnativelib.rtu
2
-
3
- import android.app.Activity
4
- import android.content.Intent
5
- import com.dynamsoft.dbr.EnumBarcodeFormat
6
- import com.dynamsoft.dbrbundle.ui.BarcodeScanResult
7
- import com.dynamsoft.dbrbundle.ui.BarcodeScannerActivity
8
- import com.dynamsoft.dbrbundle.ui.BarcodeScannerConfig
9
- import com.dynamsoft.reactnative.basicutils.toWritableArray
10
- import com.dynamsoft.reactnativelib.utils.toScanRegion
11
- import com.facebook.react.bridge.Arguments
12
- import com.facebook.react.bridge.Promise
13
- import com.facebook.react.bridge.ReactApplicationContext
14
- import com.facebook.react.bridge.ReadableMap
15
- import com.facebook.react.bridge.WritableMap
16
-
17
-
18
- class BarcodeScannerModuleImpl(private val reactContext: ReactApplicationContext): ScannerModule(reactContext) {
19
- companion object {
20
- const val NAME = "DynamsoftBarcodeScannerModule"
21
- }
22
-
23
- fun startBarcodeScanner(config: ReadableMap, promise: Promise) {
24
- super.startScanner(config, promise)
25
- }
26
-
27
- fun closeBarcodeScanner(promise: Promise) {
28
- super.closeScanner(promise)
29
- }
30
- override fun createIntent(config: ReadableMap) =
31
- BarcodeScannerActivity.ResultContract().createIntent(reactContext, config.toBarcodeScannerConfig())
32
-
33
- override fun getPromiseResolve(intent: Intent) = BarcodeScanResult(Activity.RESULT_OK, intent).toWritableMap()
34
-
35
- private fun ReadableMap.toBarcodeScannerConfig() = BarcodeScannerConfig().also {
36
- it.license = getString("license")
37
- it.barcodeFormats = (getString("_barcodeFormatNumberString") ?: EnumBarcodeFormat.BF_DEFAULT.toString()).toULong().toLong()
38
- // it.templateFilePath = getString("templateFilePath")
39
- if(hasKey("scanRegion")) {
40
- it.scanRegion = getMap("scanRegion")?.toScanRegion()
41
- }
42
- if (hasKey("isTorchButtonVisible")) {
43
- it.isTorchButtonVisible = getBoolean("isTorchButtonVisible")
44
- }
45
- if (hasKey("isBeepEnabled")) {
46
- it.isBeepEnabled = getBoolean("isBeepEnabled")
47
- }
48
- if (hasKey("isAutoZoomEnabled")) {
49
- it.isAutoZoomEnabled = getBoolean("isAutoZoomEnabled")
50
- }
51
- if (hasKey("isCloseButtonVisible")) {
52
- it.isCloseButtonVisible = getBoolean("isCloseButtonVisible")
53
- }
54
- if (hasKey("isScanLaserVisible")) {
55
- it.isScanLaserVisible = getBoolean("isScanLaserVisible")
56
- }
57
- if(hasKey("maxConsecutiveStableFramesToExit")) {
58
- it.maxConsecutiveStableFramesToExit = getInt("maxConsecutiveStableFramesToExit")
59
- }
60
- if(hasKey("scanningMode")) {
61
- it.scanningMode = getInt("scanningMode")
62
- }
63
- if(hasKey("expectedBarcodesCount")) {
64
- it.expectedBarcodesCount = getInt("expectedBarcodesCount")
65
- }
66
- if(hasKey("templateFile")) {
67
- it.templateFile = getString("templateFile")
68
- }
69
- if(hasKey("isCameraToggleButtonVisible")) {
70
- it.isCameraToggleButtonVisible = getBoolean("isCameraToggleButtonVisible")
71
- }
72
- }
73
-
74
- private fun BarcodeScanResult.toWritableMap(): WritableMap = Arguments.createMap().apply {
75
- putInt("resultStatus", resultStatus)
76
- putInt("errorCode", errorCode)
77
- putString("errorString", errorString)
78
- putArray("barcodes", barcodes?.toWritableArray())
79
- }
80
- }