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

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 (112) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +7 -9
  3. package/android/build.gradle +29 -42
  4. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
  5. package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
  6. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
  7. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +23 -25
  8. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +2 -2
  9. package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
  10. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
  11. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
  12. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
  13. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
  14. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
  15. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
  16. package/android/src/main/jniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  17. package/android/src/main/jniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  18. package/android/src/main/jniLibs/debug/x86/librn_dys.so +0 -0
  19. package/android/src/main/jniLibs/debug/x86_64/librn_dys.so +0 -0
  20. package/android/src/main/jniLibs/release/arm64-v8a/librn_dys.so +0 -0
  21. package/android/src/main/jniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  22. package/android/src/main/jniLibs/release/x86/librn_dys.so +0 -0
  23. package/android/src/main/jniLibs/release/x86_64/librn_dys.so +0 -0
  24. package/dynamsoft-capture-vision-react-native.podspec +9 -7
  25. package/ios/CPP/DSImageData+HostObject.h +1 -1
  26. package/ios/CPP/RNDynamsoft+JSI.h +2 -2
  27. package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
  28. package/ios/CPP/RNDynamsoft+Json.h +2 -13
  29. package/ios/CPP/RNDynamsoft+Json.m +48 -39
  30. package/ios/CPP/YeetJSIUtils.h +3 -1
  31. package/ios/CPP/YeetJSIUtils.mm +5 -0
  32. package/ios/RNDynamsoftCameraView.m +1 -1
  33. package/ios/RNDynamsoftCameraViewManager.m +18 -6
  34. package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
  35. package/ios/RNDynamsoftImageEditorView.m +1 -1
  36. package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
  37. package/ios/RNDynamsoftImageManager.mm +33 -4
  38. package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
  39. package/ios/RNDynamsoftLicense.m +1 -1
  40. package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
  41. package/ios/RNDynamsoftVersions.m +1 -13
  42. package/package.json +3 -11
  43. package/src/core/CapturedResultBase.tsx +18 -0
  44. package/src/core/EnumCaptureResultItemType.tsx +12 -6
  45. package/src/core/EnumCrossVerificationStatus.tsx +6 -6
  46. package/src/core/ImageData.tsx +1 -1
  47. package/src/core/index.tsx +1 -0
  48. package/src/cvr/CaptureVisionRouter.tsx +47 -51
  49. package/src/cvr/CapturedResult.tsx +24 -46
  50. package/src/cvr/CapturedResultReceiver.tsx +12 -19
  51. package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
  52. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
  53. package/src/dbr/DecodedBarcodesResult.tsx +3 -17
  54. package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
  55. package/src/dcp/ParsedResult.tsx +3 -14
  56. package/src/ddn/DeskewedImageResultItem.tsx +40 -0
  57. package/src/ddn/DetectedQuadResultItem.tsx +3 -1
  58. package/src/ddn/EnhancedImageResultItem.tsx +20 -0
  59. package/src/ddn/ProcessedDocumentResult.tsx +27 -0
  60. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
  61. package/src/ddn/index.tsx +3 -3
  62. package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
  63. package/src/index.tsx +0 -1
  64. package/src/utility/ImageManager.tsx +66 -45
  65. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
  66. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
  67. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
  68. package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
  69. package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
  70. package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
  71. package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
  72. package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
  73. package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
  74. package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
  75. package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
  76. package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
  77. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
  78. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
  79. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
  80. package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
  81. package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
  82. package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
  83. package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
  84. package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
  85. package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
  86. package/ios/RNDynamsoftBarcodeScanner.h +0 -14
  87. package/ios/RNDynamsoftBarcodeScanner.m +0 -169
  88. package/ios/RNDynamsoftMRZScanner.h +0 -14
  89. package/ios/RNDynamsoftMRZScanner.m +0 -140
  90. package/src/ddn/DetectedQuadsResult.tsx +0 -31
  91. package/src/ddn/NormalizedImageResultItem.tsx +0 -32
  92. package/src/ddn/NormalizedImagesResult.tsx +0 -27
  93. package/src/rtu/BarcodeScanConfig.tsx +0 -104
  94. package/src/rtu/BarcodeScanResult.tsx +0 -31
  95. package/src/rtu/BarcodeScanner.tsx +0 -112
  96. package/src/rtu/EnumResultState.tsx +0 -21
  97. package/src/rtu/MRZScanConfig.tsx +0 -67
  98. package/src/rtu/MRZScanResult.tsx +0 -84
  99. package/src/rtu/MRZScanner.tsx +0 -90
  100. package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
  101. package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
  102. package/src/rtu/index.tsx +0 -7
  103. /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
  104. /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
  105. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
  106. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +0 -0
  107. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
  108. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
  109. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
  110. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
  111. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
  112. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
@@ -1,4 +1,5 @@
1
1
  // main index.tsx
2
+ export * from "./CapturedResultBase"
2
3
  export * from "./CapturedResultItem"
3
4
  export * from "./CoreModule"
4
5
  export * from "./DSRect"
@@ -3,7 +3,7 @@ import {EnumCapturedResultItemType, type ImageData, ImageSourceAdapter} from "..
3
3
  import type {CapturedResultReceiver} from "./CapturedResultReceiver";
4
4
  import {type CapturedResult, _populateResults} from "./CapturedResult";
5
5
  import type {BarcodeResultItem, DecodedBarcodesResult} from "../dbr";
6
- import type {DetectedQuadsResult, NormalizedImagesResult} from "../ddn";
6
+ import type {ProcessedDocumentResult} from "../ddn";
7
7
  import type {RecognizedTextLinesResult} from "../dlr";
8
8
  import type {ParsedResult} from "../dcp";
9
9
  import type {CapturedResultFilter} from "./CapturedResultFilter";
@@ -76,7 +76,7 @@ export class CaptureVisionRouter {
76
76
  * @throws Error - If the capturing process fails to start, the promise will be rejected with an error.
77
77
  * The error may occur due to invalid template names, or a capturing process is already in progress, etc.
78
78
  *
79
- * @Important - Always make sure there is no capturing in process or just call `await CaptureVisionRouter.stopCapturing()` to stop any ongoing capturing process
79
+ * @remarks - Always make sure there is no capturing in process or just call `await CaptureVisionRouter.stopCapturing()` to stop any ongoing capturing process
80
80
  * before calling `startCapturing`.
81
81
  *
82
82
  * @see {@link EnumPresetTemplate}
@@ -121,9 +121,8 @@ export class CaptureVisionRouter {
121
121
 
122
122
  private receiverMap = new Map<string, CapturedResultReceiver>();
123
123
  private onCapturedResultReceived?: EmitterSubscription;
124
- private onDetectedQuadsReceived?: EmitterSubscription;
124
+ private onProcessedDocumentResultReceived?: EmitterSubscription;
125
125
  private onDecodedBarcodesReceived?: EmitterSubscription;
126
- private onNormalizedImagesReceived?: EmitterSubscription;
127
126
  private onRecognizedTextLinesReceived?: EmitterSubscription;
128
127
  private onParsedResultsReceived?: EmitterSubscription;
129
128
 
@@ -157,11 +156,19 @@ export class CaptureVisionRouter {
157
156
  this.onCapturedResultReceived = CVREventEmitter.addListener('onCapturedResultReceived',
158
157
  async (result: CapturedResult) => {
159
158
  _populateResults(result)
160
- if (result.normalizedImagesResult && result.normalizedImagesResult.items?.length) {
159
+ let processingDocumentResult = result.processingDocumentResult;
160
+ if (processingDocumentResult && processingDocumentResult.deskewedImageResultItems && processingDocumentResult.deskewedImageResultItems.length > 0) {
161
161
  installMethods();
162
- let imageArr: ImageData[] = global.getCurrentNormalizedImages();
163
- for (let i = 0; i < result.normalizedImagesResult.items.length; i++) {
164
- result.normalizedImagesResult.items[i]!!.imageData = imageArr[i]!!;
162
+ let imageArr: ImageData[] = global.getCurrentDeskewedImages();
163
+ for (let i = 0; i < processingDocumentResult.deskewedImageResultItems.length; i++) {
164
+ processingDocumentResult.deskewedImageResultItems[i]!!.imageData = imageArr[i]!!;
165
+ }
166
+ }
167
+ if(processingDocumentResult && processingDocumentResult.enhancedImageResultItems && processingDocumentResult.enhancedImageResultItems.length > 0) {
168
+ installMethods();
169
+ let imageArr: ImageData[] = global.getCurrentEnhancedImages();
170
+ for (let i = 0; i < processingDocumentResult.enhancedImageResultItems.length; i++) {
171
+ processingDocumentResult.enhancedImageResultItems[i]!!.imageData = imageArr[i]!!;
165
172
  }
166
173
  }
167
174
  for (let _receiver of this.receiverMap.values()) {
@@ -203,34 +210,28 @@ export class CaptureVisionRouter {
203
210
  )
204
211
  }
205
212
 
206
- if (!this.onDetectedQuadsReceived && receiver.onDetectedQuadsReceived) {
213
+ if (!this.onProcessedDocumentResultReceived && receiver.onProcessedDocumentResultReceived) {
207
214
  if (Platform.OS == 'ios') {
208
- CvrModule.addResultReceiver('onDetectedQuadsReceived')
215
+ CvrModule.addResultReceiver('onProcessedDocumentResultReceived')
209
216
  }
210
- this.onDetectedQuadsReceived = CVREventEmitter.addListener('onDetectedQuadsReceived',
211
- async (result: DetectedQuadsResult) => {
212
- for (let _receiver of this.receiverMap.values()) {
213
- await _receiver.onDetectedQuadsReceived?.(result);
217
+ this.onProcessedDocumentResultReceived = CVREventEmitter.addListener('onProcessedDocumentResultReceived',
218
+ async (result: ProcessedDocumentResult) => {
219
+ if (result && result.deskewedImageResultItems && result.deskewedImageResultItems.length > 0) {
220
+ installMethods();
221
+ let imageArr: ImageData[] = global.getCurrentDeskewedImages();
222
+ for (let i = 0; i < result.deskewedImageResultItems.length; i++) {
223
+ result.deskewedImageResultItems[i]!!.imageData = imageArr[i]!!;
224
+ }
214
225
  }
215
- CvrModule.continueCRR()
216
- }
217
- )
218
- }
219
- if (!this.onNormalizedImagesReceived && receiver.onNormalizedImagesReceived) {
220
- if (Platform.OS == 'ios') {
221
- CvrModule.addResultReceiver('onNormalizedImagesReceived')
222
- }
223
- this.onNormalizedImagesReceived = CVREventEmitter.addListener('onNormalizedImagesReceived',
224
- async (result: NormalizedImagesResult) => {
225
- if (result && result.items && result.items.length > 0) {
226
+ if (result && result.enhancedImageResultItems && result.enhancedImageResultItems.length > 0) {
226
227
  installMethods();
227
- let imageArr: ImageData[] = global.getCurrentNormalizedImages();
228
- for (let i = 0; i < result.items.length; i++) {
229
- result.items[i]!!.imageData = imageArr[i]!!;
228
+ let imageArr: ImageData[] = global.getCurrentEnhancedImages();
229
+ for (let i = 0; i < result.enhancedImageResultItems.length; i++) {
230
+ result.enhancedImageResultItems[i]!!.imageData = imageArr[i]!!;
230
231
  }
231
232
  }
232
233
  for (let _receiver of this.receiverMap.values()) {
233
- await _receiver.onNormalizedImagesReceived?.(result);
234
+ await _receiver.onProcessedDocumentResultReceived?.(result);
234
235
  }
235
236
  CvrModule.continueCRR()
236
237
  }
@@ -279,8 +280,7 @@ export class CaptureVisionRouter {
279
280
  if (_receiver.onCapturedResultReceived) needToKeep_onCapturedResultReceived = true;
280
281
  needToKeepTypes |= _receiver.onDecodedBarcodesReceived ? EnumCapturedResultItemType.CRIT_BARCODE : 0;
281
282
  needToKeepTypes |= _receiver.onRecognizedTextLinesReceived ? EnumCapturedResultItemType.CRIT_TEXT_LINE : 0;
282
- needToKeepTypes |= _receiver.onDetectedQuadsReceived ? EnumCapturedResultItemType.CRIT_DETECTED_QUAD : 0;
283
- needToKeepTypes |= _receiver.onNormalizedImagesReceived ? EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE : 0;
283
+ needToKeepTypes |= _receiver.onProcessedDocumentResultReceived ? (EnumCapturedResultItemType.CRIT_DETECTED_QUAD | EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE | EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE) : 0;
284
284
  needToKeepTypes |= _receiver.onParsedResultsReceived ? EnumCapturedResultItemType.CRIT_PARSED_RESULT : 0;
285
285
  }
286
286
  if (!needToKeep_onCapturedResultReceived) {
@@ -298,15 +298,10 @@ export class CaptureVisionRouter {
298
298
  CvrModule.removeResultReceiver('onRecognizedTextLinesReceived')
299
299
  CVREventEmitter.removeAllListeners('onRecognizedTextLinesReceived')
300
300
  }
301
- if ((needToKeepTypes & EnumCapturedResultItemType.CRIT_DETECTED_QUAD) == 0) {
302
- this.onDetectedQuadsReceived = this.onDetectedQuadsReceived?.remove() || undefined
303
- CvrModule.removeResultReceiver('onDetectedQuadsReceived')
304
- CVREventEmitter.removeAllListeners('onDetectedQuadsReceived')
305
- }
306
- if ((needToKeepTypes & EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE) == 0) {
307
- this.onNormalizedImagesReceived = this.onNormalizedImagesReceived?.remove() || undefined
308
- CvrModule.removeResultReceiver('onNormalizedImagesReceived')
309
- CVREventEmitter.removeAllListeners('onNormalizedImagesReceived')
301
+ if ((needToKeepTypes & (EnumCapturedResultItemType.CRIT_DETECTED_QUAD | EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE | EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE)) == 0) {
302
+ this.onProcessedDocumentResultReceived = this.onProcessedDocumentResultReceived?.remove() || undefined
303
+ CvrModule.removeResultReceiver('onProcessedDocumentResultReceived')
304
+ CVREventEmitter.removeAllListeners('onProcessedDocumentResultReceived')
310
305
  }
311
306
  if ((needToKeepTypes & EnumCapturedResultItemType.CRIT_PARSED_RESULT) == 0) {
312
307
  this.onParsedResultsReceived = this.onParsedResultsReceived?.remove() || undefined
@@ -323,8 +318,7 @@ export class CaptureVisionRouter {
323
318
  this.receiverMap.clear()
324
319
  this.onCapturedResultReceived?.remove()
325
320
  this.onDecodedBarcodesReceived?.remove()
326
- this.onDetectedQuadsReceived?.remove()
327
- this.onNormalizedImagesReceived?.remove()
321
+ this.onProcessedDocumentResultReceived?.remove()
328
322
  this.onRecognizedTextLinesReceived?.remove()
329
323
  this.onParsedResultsReceived?.remove()
330
324
  }
@@ -336,7 +330,7 @@ export class CaptureVisionRouter {
336
330
  * Code snippet:
337
331
  * ```
338
332
  * let router = await CaptureVisionRouter.getInstance();
339
- * let receiver = router.addFilter(new MultiFrameResultCrossFilter());
333
+ * let filter = router.addFilter(new MultiFrameResultCrossFilter());
340
334
  * //...
341
335
  * router.removeFilter(filter);
342
336
  * ```
@@ -403,7 +397,7 @@ export class CaptureVisionRouter {
403
397
  * maxParallelTasks: 1,
404
398
  * barcodeSettings: {
405
399
  * expectedBarcodesCount: 999,
406
- * barcodeFormatIds: EnumBarcodeFormats.BF_ONED | EnumBarcodeFormats.BF_QR_CODE,
400
+ * barcodeFormatIds: EnumBarcodeFormat.BF_ONED | EnumBarcodeFormat.BF_QR_CODE,
407
401
  * }
408
402
  * };
409
403
  * //Only timeout, maxParallelTasks, expectedBarcodesCount and barcodeFormatIds will be updated.
@@ -463,20 +457,22 @@ export class CaptureVisionRouter {
463
457
  * Get a JSON string that contains settings for the specified templateName.
464
458
  *
465
459
  * @param templateName - The name of the template that you want to output.
460
+ * @param includeDefaultValues - Whether to include default values in the output.
466
461
  * @return {Promise<string>} - A promise that resolves a JSON string that contains settings for the specified templateName.
467
462
  * */
468
- outputSettings(templateName: string): Promise<string> {
469
- return CvrModule.outputSettings(templateName)
463
+ outputSettings(templateName: string, includeDefaultValues:boolean): Promise<string> {
464
+ return CvrModule.outputSettings(templateName, includeDefaultValues)
470
465
  }
471
466
 
472
467
  /**
473
468
  * Generates a JSON file download containing the settings for the specified templateName and saved to specified file path.
474
469
  * @param templateName - The name of the template that you want to output.
475
470
  * @param file - The absolute file path that you want to save the template.
471
+ * @param includeDefaultValues - Whether to include default values in the output.
476
472
  * @return {Promise<void>} - A promise that resolves or rejected with an error when the operation has completed.
477
473
  * */
478
- outputSettingsToFile(templateName: string, file: string): Promise<void> {
479
- return CvrModule.outputSettingsToFile(templateName, file)
474
+ outputSettingsToFile(templateName: string, file: string, includeDefaultValues:boolean): Promise<void> {
475
+ return CvrModule.outputSettingsToFile(templateName, file, includeDefaultValues)
480
476
  }
481
477
 
482
478
  /**
@@ -612,8 +608,7 @@ export class IntermediateResultManager {
612
608
  * ```
613
609
  *
614
610
  * @param imageHashId - The image hash ID. Get from {@link CapturedResult.originalImageHashId}, {@link DecodedBarcodesResult.originalImageHashId},
615
- * {@link DetectedQuadsResult.originalImageHashId}, {@link NormalizedImagesResult.originalImageHashId},
616
- * {@link RecognizedTextLinesResult.originalImageHashId}.
611
+ * {@link ProcessedDocumentResult.originalImageHashId}, {@link RecognizedTextLinesResult.originalImageHashId}.
617
612
  *
618
613
  * @remarks `Do not call this method outside the CapturedResultReceiver callback where you get the hashId, otherwise you will not get any valid ImageData.`
619
614
  * @see {@link CaptureVisionRouter.addResultReceiver}
@@ -629,6 +624,7 @@ declare var global: {
629
624
  captureImageData: (imageData: ImageData, template: string) => CapturedResult | undefined | null;
630
625
  captureFile: (file: string, template: string) => CapturedResult | undefined | null;
631
626
  captureFileBytes: (fileBytes: ArrayBuffer, template: string) => CapturedResult | undefined | null;
632
- getCurrentNormalizedImages: () => ImageData[];
627
+ getCurrentDeskewedImages: () => ImageData[];
628
+ getCurrentEnhancedImages: () => ImageData[];
633
629
  cvr_getOriginalImage: (imageHashId: string) => ImageData;
634
630
  }
@@ -4,10 +4,11 @@ import type {ParsedResult, ParsedResultItem} from "../dcp";
4
4
  import type {RecognizedTextLinesResult, TextLineResultItem} from "../dlr";
5
5
  import type {
6
6
  DetectedQuadResultItem,
7
- DetectedQuadsResult,
8
- NormalizedImageResultItem,
9
- NormalizedImagesResult
7
+ DeskewedImageResultItem,
8
+ EnhancedImageResultItem,
9
+ ProcessedDocumentResult
10
10
  } from "../ddn";
11
+ import type {CapturedResultBase} from "../core/CapturedResultBase";
11
12
 
12
13
  /**
13
14
  * The CapturedResult interface describes the basic structure of a result object returned by Dynamsoft Capture Vision Router({@link CaptureVisionRouter}).
@@ -15,43 +16,26 @@ import type {
15
16
  * @remarks Depending on the functional module that generated the result item, the interface may vary:
16
17
  * - dynamsoft-barcode-reader: {@link DecodedBarcodesResult}
17
18
  * - dynamsoft-label-recognizer: {@link RecognizedTextLinesResult}
18
- * - dynamsoft-document-normalizer: {@link DetectedQuadsResult} or {@link NormalizedImagesResult}
19
+ * - dynamsoft-document-normalizer: {@link ProcessedDocumentResult}
19
20
  * - dynamsoft-code-parser: {@link ParsedResult}
20
21
  *
21
22
  * @see {@link CapturedResultReceiver.onCapturedResultReceived}
23
+ * @see {@link CapturedResultBase}
22
24
  * */
23
- export interface CapturedResult {
24
- /**
25
- * The hash ID of the original image.
26
- * @see {@link IntermediateResultManager.getOriginalImage}
27
- * */
28
- originalImageHashId: string;
29
-
25
+ export interface CapturedResult extends CapturedResultBase{
30
26
  /**
31
27
  * An array of CapturedResultItem objects representing the captured result items.
32
28
  * */
33
29
  items?: Array<CapturedResultItem>;
34
30
 
35
- /**Error code associated with the capture result.*/
36
- errorCode: number;
37
-
38
- /**Error string providing details about the error.*/
39
- errorMessage: string;
40
-
41
- /**the rotation transformation matrix of the original image relative to the rotated image.*/
42
- rotationTransformMatrix: Array<number>;
43
-
44
31
  /**Get a {@link DecodedBarcodesResult} object that contains all the {@link BarcodeResultItem} in this CapturedResult.*/
45
32
  decodedBarcodesResult?: DecodedBarcodesResult;
46
33
 
47
34
  /**Get a {@link RecognizedTextLinesResult} object that contains all the {@link TextLineResultItem} in this CapturedResult.*/
48
35
  recognizedTextLinesResult?: RecognizedTextLinesResult;
49
36
 
50
- /**Get a {@link DetectedQuadsResult} object that contains all the {@link DetectedQuadResultItem} in this CapturedResult.*/
51
- detectedQuadsResult?: DetectedQuadsResult;
52
-
53
- /**Get a {@link NormalizedImagesResult} object that contains all the {@link NormalizedImageResultItem} in this CapturedResult.*/
54
- normalizedImagesResult?: NormalizedImagesResult;
37
+ /**Get a {@link ProcessedDocumentResult} object that contains all the {@link EnhancedImageResultItem} ,{@link DeskewedImageResultItem} and {@link DetectedQuadResultItem} in this CapturedResult.*/
38
+ processingDocumentResult?: ProcessedDocumentResult;
55
39
 
56
40
  /**Get a {@link ParsedResult} object that contains all the {@link ParsedResultItem} in this CapturedResult.*/
57
41
  parsedResult?: ParsedResult;
@@ -62,8 +46,7 @@ export function _populateResults(result: CapturedResult | null | undefined) {
62
46
  if (result) {
63
47
  result.decodedBarcodesResult = getDecodedBarcodesResult(result)
64
48
  result.recognizedTextLinesResult = getRecognizedTextLinesResult(result)
65
- result.detectedQuadsResult = getDetectedQuadsResult(result)
66
- result.normalizedImagesResult = getNormalizedImagesResult(result)
49
+ result.processingDocumentResult = getProcessingDocumentResult(result)
67
50
  result.parsedResult = getParsedResult(result)
68
51
  }
69
52
  }
@@ -90,7 +73,7 @@ function getRecognizedTextLinesResult(result: CapturedResult): RecognizedTextLin
90
73
  return {
91
74
  originalImageHashId: result.originalImageHashId,
92
75
  errorCode: result.errorCode,
93
- errorString: result.errorMessage,
76
+ errorMessage: result.errorMessage,
94
77
  rotationTransformMatrix: result.rotationTransformMatrix,
95
78
  items: result.items?.filter(item => {
96
79
  return item.type == EnumCapturedResultItemType.CRIT_TEXT_LINE
@@ -101,33 +84,28 @@ function getRecognizedTextLinesResult(result: CapturedResult): RecognizedTextLin
101
84
  }
102
85
 
103
86
  /**@internal*/
104
- function getDetectedQuadsResult(result: CapturedResult): DetectedQuadsResult {
87
+ function getProcessingDocumentResult(result: CapturedResult): ProcessedDocumentResult {
105
88
  return {
106
89
  originalImageHashId: result.originalImageHashId,
107
90
  errorCode: result.errorCode,
108
- errorString: result.errorMessage,
91
+ errorMessage: result.errorMessage,
109
92
  rotationTransformMatrix: result.rotationTransformMatrix,
110
- items: result.items?.filter(item => {
93
+ deskewedImageResultItems: result.items?.filter(item => {
94
+ return item.type == EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE
95
+ }).map(item => {
96
+ return item as DeskewedImageResultItem
97
+ }),
98
+ detectedQuadResultItems: result.items?.filter(item => {
111
99
  return item.type == EnumCapturedResultItemType.CRIT_DETECTED_QUAD
112
100
  }).map(item => {
113
101
  return item as DetectedQuadResultItem
114
- })
115
- } as DetectedQuadsResult;
116
- }
117
-
118
- /**@internal*/
119
- function getNormalizedImagesResult(result: CapturedResult): NormalizedImagesResult {
120
- return {
121
- originalImageHashId: result.originalImageHashId,
122
- errorCode: result.errorCode,
123
- errorString: result.errorMessage,
124
- rotationTransformMatrix: result.rotationTransformMatrix,
125
- items: result.items?.filter(item => {
126
- return item.type == EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE
102
+ }),
103
+ enhancedImageResultItems: result.items?.filter(item => {
104
+ return item.type == EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE
127
105
  }).map(item => {
128
- return item as NormalizedImageResultItem
106
+ return item as EnhancedImageResultItem
129
107
  })
130
- } as NormalizedImagesResult;
108
+ } as ProcessedDocumentResult;
131
109
  }
132
110
 
133
111
  /**@internal*/
@@ -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
  }
@@ -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
  *
@@ -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
  }