dynamsoft-capture-vision-react-native 3.2.5002 → 3.4.1000

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 (61) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/cpp/JsiCore.cpp +19 -7
  3. package/android/src/main/cpp/JsiCvr.cpp +19 -14
  4. package/android/src/main/cpp/JsiDbr.cpp +62 -2
  5. package/android/src/main/dysJniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  6. package/android/src/main/dysJniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  7. package/android/src/main/dysJniLibs/debug/x86/librn_dys.so +0 -0
  8. package/android/src/main/dysJniLibs/debug/x86_64/librn_dys.so +0 -0
  9. package/android/src/main/dysJniLibs/release/arm64-v8a/librn_dys.so +0 -0
  10. package/android/src/main/dysJniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  11. package/android/src/main/dysJniLibs/release/x86/librn_dys.so +0 -0
  12. package/android/src/main/dysJniLibs/release/x86_64/librn_dys.so +0 -0
  13. package/android/src/main/dysJniLibsFor81/debug/arm64-v8a/librn_dys.so +0 -0
  14. package/android/src/main/dysJniLibsFor81/debug/armeabi-v7a/librn_dys.so +0 -0
  15. package/android/src/main/dysJniLibsFor81/debug/x86/librn_dys.so +0 -0
  16. package/android/src/main/dysJniLibsFor81/debug/x86_64/librn_dys.so +0 -0
  17. package/android/src/main/dysJniLibsFor81/release/arm64-v8a/librn_dys.so +0 -0
  18. package/android/src/main/dysJniLibsFor81/release/armeabi-v7a/librn_dys.so +0 -0
  19. package/android/src/main/dysJniLibsFor81/release/x86/librn_dys.so +0 -0
  20. package/android/src/main/dysJniLibsFor81/release/x86_64/librn_dys.so +0 -0
  21. package/android/src/main/dysJniLibsFor82/debug/arm64-v8a/librn_dys.so +0 -0
  22. package/android/src/main/dysJniLibsFor82/debug/armeabi-v7a/librn_dys.so +0 -0
  23. package/android/src/main/dysJniLibsFor82/debug/x86/librn_dys.so +0 -0
  24. package/android/src/main/dysJniLibsFor82/debug/x86_64/librn_dys.so +0 -0
  25. package/android/src/main/dysJniLibsFor82/release/arm64-v8a/librn_dys.so +0 -0
  26. package/android/src/main/dysJniLibsFor82/release/armeabi-v7a/librn_dys.so +0 -0
  27. package/android/src/main/dysJniLibsFor82/release/x86/librn_dys.so +0 -0
  28. package/android/src/main/dysJniLibsFor82/release/x86_64/librn_dys.so +0 -0
  29. package/android/src/main/java/com/dynamsoft/reactnativelib/CVRModule.kt +10 -2
  30. package/android/src/main/java/com/dynamsoft/reactnativelib/DCEModule.kt +5 -2
  31. package/android/src/main/java/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +11 -0
  32. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDBR.kt +15 -0
  33. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +37 -23
  34. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +42 -24
  35. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/MultiCrossFilterModuleImpl.kt +28 -2
  36. package/dynamsoft-capture-vision-react-native.podspec +1 -1
  37. package/ios/CPP/ImageDataHostObject.cpp +1 -1
  38. package/ios/CPP/RNDynamsoft+JSI.mm +34 -1
  39. package/ios/CPP/RNDynamsoft+Json.m +25 -0
  40. package/ios/RNDynamsoftCameraViewManager.m +8 -1
  41. package/ios/RNDynamsoftCaptureVisionRouter.mm +21 -6
  42. package/ios/RNDynamsoftImageEditorViewManager.mm +11 -5
  43. package/ios/RNDynamsoftImageManager.h +2 -1
  44. package/ios/RNDynamsoftImageManager.mm +11 -5
  45. package/ios/RNDynamsoftImageSourceAdapter.h +2 -1
  46. package/ios/RNDynamsoftImageSourceAdapter.mm +12 -6
  47. package/ios/RNDynamsoftMultiCrossFilter.m +39 -0
  48. package/package.json +1 -16
  49. package/src/core/ImageData.tsx +4 -1
  50. package/src/core/ImageSourceAdapter.tsx +6 -0
  51. package/src/cvr/CaptureVisionRouter.tsx +37 -12
  52. package/src/dbr/BarcodeResultItem.tsx +9 -0
  53. package/src/dbr/ECISegment.tsx +24 -0
  54. package/src/dbr/index.tsx +1 -0
  55. package/src/dce/CameraEnhancer.tsx +10 -0
  56. package/src/dce/EnumResolution.tsx +1 -0
  57. package/src/dce/ImageEditorView.tsx +3 -0
  58. package/src/utility/CrossVerificationCriteria.tsx +12 -0
  59. package/src/utility/ImageManager.tsx +39 -0
  60. package/src/utility/MultiFrameResultCrossFilter.tsx +23 -0
  61. package/src/utility/index.tsx +1 -0
@@ -106,17 +106,23 @@ RCT_EXPORT_METHOD(getSelectedQuad:(nonnull NSNumber *)tag
106
106
  // --- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) ---
107
107
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
108
108
  {
109
- RCTBridge* bridge = [RCTBridge currentBridge];
110
- RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
111
- if (cxxBridge == nil) {
109
+ RCTBridge *bridge = self.bridge;
110
+
111
+ if ([bridge respondsToSelector:NSSelectorFromString(@"parentBridge")]) {
112
+ bridge = [bridge valueForKey:@"parentBridge"];
113
+ }
114
+
115
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
116
+ if (cxxBridge == nil || cxxBridge.runtime == nil) {
112
117
  return @false;
113
118
  }
119
+
114
120
  auto jsiRuntime = (jsi::Runtime*) cxxBridge.runtime;
115
121
  if (jsiRuntime == nil) {
116
122
  return @false;
117
123
  }
118
124
 
119
- install(*(facebook::jsi::Runtime *)jsiRuntime, self);
125
+ install(*(facebook::jsi::Runtime *)cxxBridge.runtime, self);
120
126
  return @true;
121
127
  }
122
128
 
@@ -124,7 +130,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
124
130
  static void installHostFunction(
125
131
  jsi::Runtime &jsiRuntime,
126
132
  const char* name,
127
- size_t argCount,
133
+ unsigned int argCount,
128
134
  HostFunctionType hostFunction) {
129
135
 
130
136
  auto func = Function::createFromHostFunction(
@@ -3,10 +3,11 @@
3
3
  */
4
4
 
5
5
  #import <React/RCTBridgeModule.h>
6
+ #import <React/RCTEventEmitter.h>
6
7
 
7
8
  NS_ASSUME_NONNULL_BEGIN
8
9
 
9
- @interface RNDynamsoftImageManager : NSObject <RCTBridgeModule>
10
+ @interface RNDynamsoftImageManager : RCTEventEmitter <RCTBridgeModule>
10
11
 
11
12
  @end
12
13
 
@@ -44,17 +44,23 @@ RCT_EXPORT_MODULE(DynamsoftImageManagerModule)
44
44
  // --- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) ---
45
45
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
46
46
  {
47
- RCTBridge* bridge = [RCTBridge currentBridge];
48
- RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
49
- if (cxxBridge == nil) {
47
+ RCTBridge *bridge = self.bridge;
48
+
49
+ if ([bridge respondsToSelector:NSSelectorFromString(@"parentBridge")]) {
50
+ bridge = [bridge valueForKey:@"parentBridge"];
51
+ }
52
+
53
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
54
+ if (cxxBridge == nil || cxxBridge.runtime == nil) {
50
55
  return @false;
51
56
  }
57
+
52
58
  auto jsiRuntime = (jsi::Runtime*) cxxBridge.runtime;
53
59
  if (jsiRuntime == nil) {
54
60
  return @false;
55
61
  }
56
62
 
57
- install(*(facebook::jsi::Runtime *)jsiRuntime, self);
63
+ install(*(facebook::jsi::Runtime *)cxxBridge.runtime, self);
58
64
  return @true;
59
65
  }
60
66
 
@@ -62,7 +68,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
62
68
  static void installHostFunction(
63
69
  jsi::Runtime &jsiRuntime,
64
70
  const char* name,
65
- size_t argCount,
71
+ unsigned int argCount,
66
72
  HostFunctionType hostFunction) {
67
73
 
68
74
  auto func = Function::createFromHostFunction(
@@ -4,12 +4,13 @@
4
4
 
5
5
  #import <Foundation/Foundation.h>
6
6
  #import <React/RCTBridgeModule.h>
7
+ #import <React/RCTEventEmitter.h>
7
8
 
8
9
  NS_ASSUME_NONNULL_BEGIN
9
10
 
10
11
  @class DSImageSourceAdapter;
11
12
 
12
- @interface RNDynamsoftImageSourceAdapter : NSObject <RCTBridgeModule>
13
+ @interface RNDynamsoftImageSourceAdapter : RCTEventEmitter <RCTBridgeModule>
13
14
 
14
15
  @property (nonatomic, strong) NSMutableDictionary<NSString *, DSImageSourceAdapter *> *isaDictionary;
15
16
 
@@ -134,17 +134,23 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(hasImage:(NSString *)key imageId:(NSInteg
134
134
  // --- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) ---
135
135
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
136
136
  {
137
- RCTBridge* bridge = [RCTBridge currentBridge];
138
- RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
139
- if (cxxBridge == nil) {
137
+ RCTBridge *bridge = self.bridge;
138
+
139
+ if ([bridge respondsToSelector:NSSelectorFromString(@"parentBridge")]) {
140
+ bridge = [bridge valueForKey:@"parentBridge"];
141
+ }
142
+
143
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
144
+ if (cxxBridge == nil || cxxBridge.runtime == nil) {
140
145
  return @false;
141
146
  }
147
+
142
148
  auto jsiRuntime = (jsi::Runtime*) cxxBridge.runtime;
143
149
  if (jsiRuntime == nil) {
144
150
  return @false;
145
151
  }
146
152
 
147
- install(*(facebook::jsi::Runtime *)jsiRuntime, self);
153
+ install(*(facebook::jsi::Runtime *)cxxBridge.runtime, self);
148
154
  return @true;
149
155
  }
150
156
 
@@ -152,7 +158,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
152
158
  static void installHostFunction(
153
159
  jsi::Runtime &jsiRuntime,
154
160
  const char* name,
155
- size_t argCount,
161
+ unsigned int argCount,
156
162
  HostFunctionType hostFunction) {
157
163
 
158
164
  auto func = Function::createFromHostFunction(
@@ -235,7 +241,7 @@ static void install(jsi::Runtime &jsiRuntime, RNDynamsoftImageSourceAdapter *rnA
235
241
  if (!error && image) {
236
242
  // Compression quality set to 1.0 (highest quality)
237
243
  NSData *data = UIImageJPEGRepresentation(image, 1.0);
238
- NSString *base64String = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
244
+ NSString *base64String = [data base64EncodedStringWithOptions:0];
239
245
 
240
246
  // convertNSStringToJSIString is assumed to be defined elsewhere
241
247
  return convertNSStringToJSIString(runtime, base64String);
@@ -6,6 +6,27 @@
6
6
  #import <DynamsoftCaptureVisionBundle/DynamsoftCaptureVisionBundle.h>
7
7
  #import "RNDynamsoftCaptureVisionRouter.h"
8
8
 
9
+ @implementation DSCrossVerificationCriteria (filter)
10
+
11
+ + (instancetype)createFromJson:(NSDictionary *)dic {
12
+ DSCrossVerificationCriteria *criteria = [[DSCrossVerificationCriteria alloc] init];
13
+ NSNumber *frameWindow = dic[@"frameWindow"];
14
+ NSNumber *minConsistentFrames = dic[@"minConsistentFrames"];
15
+ if (frameWindow) {
16
+ criteria.frameWindow = frameWindow.integerValue;
17
+ }
18
+ if (minConsistentFrames) {
19
+ criteria.minConsistentFrames = minConsistentFrames.integerValue;
20
+ }
21
+ return criteria;
22
+ }
23
+
24
+ - (NSDictionary *)toJson {
25
+ return @{ @"frameWindow" : @(self.frameWindow), @"minConsistentFrames" : @(self.minConsistentFrames) };
26
+ }
27
+
28
+ @end
29
+
9
30
  @implementation RNDynamsoftMultiCrossFilter
10
31
 
11
32
  RCT_EXPORT_MODULE(DynamsoftMultiCrossFilterModule)
@@ -103,4 +124,22 @@ RCT_EXPORT_METHOD(getMaxOverlappingFrames:(NSString *)key
103
124
  resolve(@([filter getMaxOverlappingFrames:type]));
104
125
  }
105
126
 
127
+ RCT_EXPORT_METHOD(setResultCrossVerificationCriteria:(NSString *)key type:(NSInteger)type criteria:(NSDictionary *)criteria) {
128
+ RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
129
+ DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
130
+ DSCrossVerificationCriteria *c = [DSCrossVerificationCriteria createFromJson:criteria];
131
+ [filter setResultCrossVerificationCriteria:c resultItemTypes:type];
132
+ }
133
+
134
+ RCT_EXPORT_METHOD(getResultCrossVerificationCriteria:(NSString *)key
135
+ type:(NSInteger)type
136
+ resolver:(RCTPromiseResolveBlock)resolve
137
+ rejecter:(RCTPromiseRejectBlock)reject)
138
+ {
139
+ RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
140
+ DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
141
+ DSCrossVerificationCriteria *criteria = [filter getResultCrossVerificationCriteria:type];
142
+ resolve([criteria toJson]);
143
+ }
144
+
106
145
  @end
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dynamsoft-capture-vision-react-native",
3
3
  "title": "Dynamsoft Capture Vision React Native",
4
- "version": "3.2.5002",
4
+ "version": "3.4.1000",
5
5
  "description": "The Dynamsoft Capture Vision React Native SDK provides a wrapper for building barcode scanning, document scanning and MRZ scanning applications with React Native.",
6
6
  "homepage": "https://github.com/Dynamsoft/capture-vision-react-native-samples",
7
7
  "main": "src/index.tsx",
@@ -44,20 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.1",
46
46
  "react-native": ">=0.71.0-rc.0 <1.0.x"
47
- },
48
- "devDependencies": {
49
- "@babel/preset-env": "^7.1.6",
50
- "@react-native-community/cli": "13.6.4",
51
- "@react-native/typescript-config": "0.75.2",
52
- "@tsconfig/react-native": "3.0.0",
53
- "@types/jest": "29.5.5",
54
- "@types/react": "18.2.20",
55
- "@types/react-native": "0.72.4",
56
- "jest": "^29.7.0",
57
- "prettier": "3.0.3",
58
- "react": "18.3.1",
59
- "react-native": "0.75.2",
60
- "typedoc": "^0.27.7",
61
- "typescript": "5.2.2"
62
47
  }
63
48
  }
@@ -78,7 +78,10 @@ const installMethods = () => {
78
78
  * @returns {string} - The Base64-encoded string representation of the image data.
79
79
  * @see {@link IntermediateResultManager.getOriginalImage}
80
80
  */
81
- export function imageDataToBase64(imageData: ImageData): string {
81
+ export function imageDataToBase64(imageData: ImageData): string | undefined | null {
82
82
  installMethods();
83
+ if (typeof global.imageDataToBase64 !== 'function') {
84
+ return null;
85
+ }
83
86
  return global.imageDataToBase64(imageData);
84
87
  }
@@ -65,6 +65,9 @@ export abstract class ImageSourceAdapter {
65
65
  * */
66
66
  public addImageToBuffer(imageData: ImageData): void {
67
67
  installMethods()
68
+ if (typeof global.isaAddImageToBuffer !== 'function') {
69
+ return;
70
+ }
68
71
  global.isaAddImageToBuffer(this.isaId, imageData)
69
72
  }
70
73
 
@@ -75,6 +78,9 @@ export abstract class ImageSourceAdapter {
75
78
  * */
76
79
  public getImageData(): ImageData | null | undefined {
77
80
  installMethods()
81
+ if (typeof global.isaGetImageData !== 'function') {
82
+ return null;
83
+ }
78
84
  return global.isaGetImageData(this.isaId)
79
85
  }
80
86
 
@@ -30,7 +30,7 @@ const installMethods = () => {
30
30
  /**
31
31
  * The singleton instance of CaptureVisionRouter.
32
32
  * */
33
- let cvr: CaptureVisionRouter
33
+ let cvr: CaptureVisionRouter | null = null;
34
34
 
35
35
  /**
36
36
  * The CaptureVisionRouter class defines how a user interacts with image-processing and semantic-processing products in their applications.
@@ -40,9 +40,9 @@ let cvr: CaptureVisionRouter
40
40
  * */
41
41
  export class CaptureVisionRouter {
42
42
  private constructor() {
43
+ CvrModule.createInstance();
43
44
  }
44
45
 
45
-
46
46
  /**
47
47
  * Get the singleton instance of CaptureVisionRouter.
48
48
  * <p>
@@ -59,6 +59,15 @@ export class CaptureVisionRouter {
59
59
  return cvr = new CaptureVisionRouter();
60
60
  }
61
61
 
62
+ /**
63
+ * Destroys the CaptureVisionRouter instance and releases all associated resources.
64
+ * After calling this method, the instance will be set to null and cannot be used anymore.
65
+ * Only call this method when you want to completely dispose the CaptureVisionRouter instance, otherwise just call {@link CaptureVisionRouter.stopCapturing} to stop the capturing process.
66
+ */
67
+ dispose() {
68
+ CvrModule.destroyInstance();
69
+ cvr = null;
70
+ }
62
71
 
63
72
  /**
64
73
  * Sets the global number of threads used internally for model execution.
@@ -187,16 +196,20 @@ export class CaptureVisionRouter {
187
196
  let processingDocumentResult = result.processingDocumentResult;
188
197
  if (processingDocumentResult && processingDocumentResult.deskewedImageResultItems && processingDocumentResult.deskewedImageResultItems.length > 0) {
189
198
  installMethods();
190
- let imageArr: ImageData[] = global.getCurrentDeskewedImages();
191
- for (let i = 0; i < processingDocumentResult.deskewedImageResultItems.length; i++) {
192
- processingDocumentResult.deskewedImageResultItems[i]!!.imageData = imageArr[i]!!;
199
+ let imageArr: ImageData[] | undefined | null = global.getCurrentDeskewedImages();
200
+ if (imageArr) {
201
+ for (let i = 0; i < processingDocumentResult.deskewedImageResultItems.length; i++) {
202
+ processingDocumentResult.deskewedImageResultItems[i]!!.imageData = imageArr[i]!!;
203
+ }
193
204
  }
194
205
  }
195
206
  if (processingDocumentResult && processingDocumentResult.enhancedImageResultItems && processingDocumentResult.enhancedImageResultItems.length > 0) {
196
207
  installMethods();
197
- let imageArr: ImageData[] = global.getCurrentEnhancedImages();
198
- for (let i = 0; i < processingDocumentResult.enhancedImageResultItems.length; i++) {
199
- processingDocumentResult.enhancedImageResultItems[i]!!.imageData = imageArr[i]!!;
208
+ let imageArr: ImageData[] | undefined | null = global.getCurrentEnhancedImages();
209
+ if (imageArr) {
210
+ for (let i = 0; i < processingDocumentResult.enhancedImageResultItems.length; i++) {
211
+ processingDocumentResult.enhancedImageResultItems[i]!!.imageData = imageArr[i]!!;
212
+ }
200
213
  }
201
214
  }
202
215
  for (let _receiver of this.receiverMap.values()) {
@@ -532,6 +545,9 @@ export class CaptureVisionRouter {
532
545
  capture(imageData: ImageData, template: string = ""): CapturedResult | undefined | null {
533
546
  installMethods();
534
547
  if (imageData) {
548
+ if (typeof global.captureImageData !== 'function') {
549
+ return null;
550
+ }
535
551
  let result = global.captureImageData(imageData, template);
536
552
  _populateResults(result)
537
553
  return result;
@@ -569,6 +585,9 @@ export class CaptureVisionRouter {
569
585
  captureFile(filePath: string, template: string = ""): CapturedResult | undefined | null {
570
586
  installMethods();
571
587
  if (filePath) {
588
+ if (typeof global.captureFile !== 'function') {
589
+ return null;
590
+ }
572
591
  let result = global.captureFile(filePath, template);
573
592
  _populateResults(result)
574
593
  return result;
@@ -595,6 +614,9 @@ export class CaptureVisionRouter {
595
614
  captureFileBytes(fileBytes: ArrayBuffer, template: string = ""): CapturedResult | undefined | null {
596
615
  installMethods();
597
616
  if (fileBytes) {
617
+ if (typeof global.captureFileBytes !== 'function') {
618
+ return null;
619
+ }
598
620
  let result = global.captureFileBytes(fileBytes, template);
599
621
  _populateResults(result)
600
622
  return result;
@@ -642,8 +664,11 @@ export class IntermediateResultManager {
642
664
  * @see {@link CaptureVisionRouter.addResultReceiver}
643
665
  * @see {@link CapturedResultReceiver}
644
666
  * */
645
- getOriginalImage(imageHashId: string): ImageData {
667
+ getOriginalImage(imageHashId: string): ImageData | undefined | null {
646
668
  installMethods();
669
+ if (typeof global.cvr_getOriginalImage !== 'function') {
670
+ return null;
671
+ }
647
672
  return global.cvr_getOriginalImage(imageHashId);
648
673
  }
649
674
  }
@@ -652,7 +677,7 @@ declare var global: {
652
677
  captureImageData: (imageData: ImageData, template: string) => CapturedResult | undefined | null;
653
678
  captureFile: (file: string, template: string) => CapturedResult | undefined | null;
654
679
  captureFileBytes: (fileBytes: ArrayBuffer, template: string) => CapturedResult | undefined | null;
655
- getCurrentDeskewedImages: () => ImageData[];
656
- getCurrentEnhancedImages: () => ImageData[];
657
- cvr_getOriginalImage: (imageHashId: string) => ImageData;
680
+ getCurrentDeskewedImages: () => ImageData[] | undefined | null;
681
+ getCurrentEnhancedImages: () => ImageData[] | undefined | null;
682
+ cvr_getOriginalImage: (imageHashId: string) => ImageData | undefined | null;
658
683
  }
@@ -1,6 +1,7 @@
1
1
  import type {CapturedResultItem, Quadrilateral, EnumCapturedResultItemType} from "../core";
2
2
  import type {EnumBarcodeFormat} from "./EnumBarcodeFormat";
3
3
  import type {AztecDetails, DataMatrixDetails, OneDCodeDetails, PDF417Details, QRCodeDetails} from "./BarcodeDetails";
4
+ import type { ECISegment } from "./ECISegment";
4
5
 
5
6
  /**
6
7
  * Interface BarcodeResultItem extends {@link CapturedResultItem}, represents a barcode result item decoded by barcode reader engine.
@@ -22,6 +23,11 @@ export interface BarcodeResultItem extends CapturedResultItem{
22
23
 
23
24
  /**The textual data decoded from the barcode. It represents the content of the barcode.*/
24
25
  text: string;
26
+
27
+ /**
28
+ * base64-encoded string representing the raw byte data of the barcode. It is a way to encode binary data as a string, making it easier to transmit or store.
29
+ */
30
+ bytes: string;
25
31
  /**
26
32
  * The location of the barcode in the form of a {@link Quadrilateral} (a set of coordinates defining the four corners of the detected barcode).
27
33
  * It describes where the barcode was found within an image.
@@ -53,4 +59,7 @@ export interface BarcodeResultItem extends CapturedResultItem{
53
59
  pdf417Details?: PDF417Details;
54
60
 
55
61
  aztecDetails?: AztecDetails;
62
+
63
+ /**Extended Channel Interpretation (ECI) segments within the barcode. It provides information about the character encoding used for different parts of the barcode data.*/
64
+ eciSegments?: ECISegment[];
56
65
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents the Extended Channel Interpretation (ECI) information within a barcode.
3
+ *
4
+ * Each ECI segment specifies the character encoding used for a portion of the decoded bytes.
5
+ * The charset names follow the IANA character set registry (e.g. "UTF-8", "ISO-8859-1").
6
+ */
7
+ export interface ECISegment {
8
+ /**
9
+ * ECI assignment number as defined by ISO/IEC 15424.
10
+ */
11
+ eciValue: number;
12
+ /**
13
+ * Charset encoding name defined by IANA (e.g. "UTF-8", "ISO-8859-1").
14
+ */
15
+ charsetEncoding: string;
16
+ /**
17
+ * Start index of this ECI segment in the decoded barcode bytes.
18
+ */
19
+ startIndex: number;
20
+ /**
21
+ * Length (in bytes) of this segment within the decoded barcode bytes.
22
+ */
23
+ length: number;
24
+ }
package/src/dbr/index.tsx CHANGED
@@ -7,3 +7,4 @@ export * from "./EnumLocalizationMode"
7
7
  export * from "./BarcodeDetails"
8
8
  export * from "./EnumQRCodeErrorCorrectionLevel"
9
9
  export type {SimplifiedBarcodeReaderSettings} from "./SimplifiedBarcodeReaderSettings"
10
+ export * from "./ECISegment"
@@ -57,6 +57,16 @@ export class CameraEnhancer extends ImageSourceAdapter {
57
57
  return dce = new CameraEnhancer();
58
58
  }
59
59
 
60
+ /**
61
+ * Destroys the CameraEnhancer instance and releases all associated resources.
62
+ * After calling this method, the instance will be set to null and cannot be used anymore.
63
+ * Only call this method when you want to completely dispose the CameraEnhancer instance, otherwise just call {@link CameraEnhancer.close} to stop the camera and release the video stream.
64
+ */
65
+ dispose() {
66
+ DynamsoftCameraEnhancerModule.destroyInstance(this.isaId);
67
+ dce = null;
68
+ }
69
+
60
70
  /**Opens the currently selected camera and starts the video stream.*/
61
71
  open() {
62
72
  DynamsoftCameraEnhancerModule.open();
@@ -4,4 +4,5 @@ export enum EnumResolution {
4
4
  RESOLUTION_720P = 2,
5
5
  Resolution1080P = 3,
6
6
  RESOLUTION_4K = 4,
7
+ RESOLUTION_MAX = 5,
7
8
  }
@@ -66,6 +66,9 @@ export class ImageEditorView extends Component<ImageEditorViewNativeProps, any>
66
66
  */
67
67
  public setOriginalImage(imageData: ImageData) {
68
68
  installMethods();
69
+ if (typeof global.editorView_setOriginalImage !== 'function') {
70
+ return;
71
+ }
69
72
  if (this.nativeCameraViewHandle != null) {
70
73
  global.editorView_setOriginalImage(this.nativeCameraViewHandle!, imageData);
71
74
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Interface CrossVerificationCriteria represents the criteria for cross-verification in a barcode scanning process.
3
+ * It includes parameters such as frameWindow, which defines the number of frames to consider for verification,
4
+ * and minConsistentFrames, which specifies the minimum number of consistent frames required for a successful verification.
5
+ */
6
+ export interface CrossVerificationCriteria {
7
+ /**The number of frames to consider for cross-verification. It defines the window of frames that will be analyzed to determine if the barcode detection is consistent across multiple frames. A larger frame window may provide more reliable verification but may also increase the time required for processing. */
8
+ frameWindow: number;
9
+
10
+ /**The minimum number of consistent frames required for a successful cross-verification. This parameter specifies how many frames within the defined frame window must consistently detect the same barcode for it to be considered a valid detection. A higher value may reduce false positives but may also require more frames to confirm a detection. */
11
+ minConsistentFrames: number;
12
+ }
@@ -93,6 +93,9 @@ export class ImageIO {
93
93
  * */
94
94
  readFromFile(path: string | null | undefined): ImageData | null | undefined {
95
95
  installMethods();
96
+ if (typeof global.imageIO_readFromFile !== 'function') {
97
+ return null;
98
+ }
96
99
  if (path && path.length > 0) {
97
100
  return global.imageIO_readFromFile(path);
98
101
  }
@@ -109,6 +112,9 @@ export class ImageIO {
109
112
  * */
110
113
  saveToFile(imageData: ImageData | null | undefined, path: string | null | undefined, overWrite: boolean): void {
111
114
  installMethods();
115
+ if (typeof global.imageIO_saveToFile !== 'function') {
116
+ return;
117
+ }
112
118
  if (imageData && path) {
113
119
  if (path.length > 0) {
114
120
  global.imageIO_saveToFile(imageData, path, overWrite);
@@ -125,6 +131,9 @@ export class ImageIO {
125
131
  * */
126
132
  readFromMemory(data: ArrayBuffer | null | undefined): ImageData | null | undefined {
127
133
  installMethods();
134
+ if (typeof global.imageIO_readFromMemory !== 'function') {
135
+ return null;
136
+ }
128
137
  if (data) {
129
138
  return global.imageIO_readFromMemory(data);
130
139
  }
@@ -140,6 +149,9 @@ export class ImageIO {
140
149
  * */
141
150
  saveToMemory(imageData: ImageData | null | undefined, format: EnumImageFileFormat): ArrayBuffer | null | undefined {
142
151
  installMethods();
152
+ if (typeof global.imageIO_saveToMemory !== 'function') {
153
+ return null;
154
+ }
143
155
  if (imageData) {
144
156
  return global.imageIO_saveToMemory(imageData, format);
145
157
  }
@@ -161,6 +173,9 @@ export class ImageDrawer {
161
173
  * */
162
174
  drawOnImage(imageData: ImageData | null | undefined, quads: Quadrilateral[] | null | undefined, colour: number | ColorValue, thickness: number): ImageData | null | undefined {
163
175
  installMethods();
176
+ if (typeof global.imageDrawer_drawOnImage !== 'function') {
177
+ return imageData;
178
+ }
164
179
  if (imageData && quads) {
165
180
  const colorNumber = processColor(colour) as number;
166
181
  if (colorNumber) {
@@ -191,6 +206,9 @@ export class ImageProcessor {
191
206
  }
192
207
  // convert to boolean
193
208
  rect.measuredInPercentage = !!rect.measuredInPercentage;
209
+ if (typeof global.imageProcessor_cropImage !== 'function') {
210
+ return imageData;
211
+ }
194
212
  return global.imageProcessor_cropImage(imageData, rect);
195
213
  }
196
214
 
@@ -210,6 +228,9 @@ export class ImageProcessor {
210
228
  if (!quad || !imageData) {
211
229
  return imageData;
212
230
  }
231
+ if (typeof global.imageProcessor_cropAndDeskewImage !== 'function') {
232
+ return imageData;
233
+ }
213
234
  return global.imageProcessor_cropAndDeskewImage(imageData, quad, dstWidth, dstHeight, padding);
214
235
  }
215
236
 
@@ -226,6 +247,9 @@ export class ImageProcessor {
226
247
  if(!imageData || brightness < -100 || brightness > 100) {
227
248
  return imageData;
228
249
  }
250
+ if (typeof global.imageProcessor_adjustBrightness !== 'function') {
251
+ return imageData;
252
+ }
229
253
  return global.imageProcessor_adjustBrightness(imageData, brightness);
230
254
  }
231
255
 
@@ -242,6 +266,9 @@ export class ImageProcessor {
242
266
  if(!imageData || contrast < -100 || contrast > 100) {
243
267
  return imageData;
244
268
  }
269
+ if (typeof global.imageProcessor_adjustContrast !== 'function') {
270
+ return imageData;
271
+ }
245
272
  return global.imageProcessor_adjustContrast(imageData, contrast);
246
273
  }
247
274
 
@@ -250,6 +277,9 @@ export class ImageProcessor {
250
277
  if(!imageData) {
251
278
  return imageData;
252
279
  }
280
+ if (typeof global.imageProcessor_filterImage !== 'function') {
281
+ return imageData;
282
+ }
253
283
  return global.imageProcessor_filterImage(imageData, filterType);
254
284
  }
255
285
 
@@ -268,6 +298,9 @@ export class ImageProcessor {
268
298
  if(!imageData || r < 0 || r > 1 || g < 0 || g > 1 || b < 0 || b > 1) {
269
299
  return imageData;
270
300
  }
301
+ if (typeof global.imageProcessor_convertToGray !== 'function') {
302
+ return imageData;
303
+ }
271
304
  return global.imageProcessor_convertToGray(imageData, r, g, b);
272
305
  }
273
306
 
@@ -285,6 +318,9 @@ export class ImageProcessor {
285
318
  if(!imageData || threshold < -1 || threshold > 255) {
286
319
  return imageData;
287
320
  }
321
+ if (typeof global.imageProcessor_convertToBinaryGlobal !== 'function') {
322
+ return imageData;
323
+ }
288
324
  return global.imageProcessor_convertToBinaryGlobal(imageData, threshold, invert);
289
325
  }
290
326
 
@@ -304,6 +340,9 @@ export class ImageProcessor {
304
340
  if(!imageData) {
305
341
  return imageData;
306
342
  }
343
+ if (typeof global.imageProcessor_convertToBinaryLocal !== 'function') {
344
+ return imageData;
345
+ }
307
346
  return global.imageProcessor_convertToBinaryLocal(imageData, blockSize, compensation, invert);
308
347
  }
309
348
  }
@@ -1,6 +1,7 @@
1
1
  import {NativeModules} from 'react-native';
2
2
  import type {CapturedResultFilter, CaptureVisionRouter} from '../cvr'
3
3
  import {EnumCapturedResultItemType} from '../core'
4
+ import type { CrossVerificationCriteria } from './CrossVerificationCriteria';
4
5
 
5
6
  // @ts-ignore Check whether __turboModuleProxy exists, it may not
6
7
  const isTurboModuleEnabled = global.__turboModuleProxy != null;
@@ -157,4 +158,26 @@ export class MultiFrameResultCrossFilter implements CapturedResultFilter {
157
158
  getMaxOverlappingFrames(type: EnumCapturedResultItemType | number): Promise<number> {
158
159
  return DynamsoftMultiCrossFilterModule.getMaxOverlappingFrames(this.filterId, type);
159
160
  }
161
+
162
+ /**
163
+ * Set the criteria for cross-verification of one or multiple specific result item types.
164
+ *
165
+ * @param types Specifies one or multiple specific result item types.
166
+ * @param criteria The criteria for cross-verification, including parameters such as frameWindow and minConsistentFrames.
167
+ * @see {@link CrossVerificationCriteria}
168
+ * */
169
+ setResultCrossVerificationCriteria(types: EnumCapturedResultItemType | number, criteria: CrossVerificationCriteria) {
170
+ DynamsoftMultiCrossFilterModule.setResultCrossVerificationCriteria(this.filterId, types, criteria);
171
+ }
172
+
173
+ /**
174
+ * Get the criteria for cross-verification of a given result item type.
175
+ *
176
+ * @param type Specifies a result item type.
177
+ * @return {Promise<CrossVerificationCriteria>} A promise that resolves the criteria for cross-verification, including parameters such as frameWindow and minConsistentFrames.
178
+ * @see {@link CrossVerificationCriteria}
179
+ * */
180
+ getResultCrossVerificationCriteria(type: EnumCapturedResultItemType | number): Promise<CrossVerificationCriteria> {
181
+ return DynamsoftMultiCrossFilterModule.getResultCrossVerificationCriteria(this.filterId, type);
182
+ }
160
183
  }
@@ -2,3 +2,4 @@ export * from "./UtilityModule"
2
2
  export * from "./MultiFrameResultCrossFilter"
3
3
  export * from "./ImageManager"
4
4
  export * from "./EnumFilterType"
5
+ export * from "./CrossVerificationCriteria"