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.
- package/LICENSE +2 -2
- package/README.md +7 -9
- package/android/build.gradle +73 -42
- package/android/src/main/cpp/CMakeLists.txt +22 -0
- package/android/src/main/cpp/ImgHO.cpp +95 -0
- package/android/src/main/cpp/ImgHO.h +34 -0
- package/android/src/main/cpp/JsiCore.cpp +284 -0
- package/android/src/main/cpp/JsiCore.h +51 -0
- package/android/src/main/cpp/JsiCvr.cpp +327 -0
- package/android/src/main/cpp/JsiCvr.h +54 -0
- package/android/src/main/cpp/JsiDbr.cpp +38 -0
- package/android/src/main/cpp/JsiDbr.h +26 -0
- package/android/src/main/cpp/JsiDce.cpp +59 -0
- package/android/src/main/cpp/JsiDce.h +17 -0
- package/android/src/main/cpp/JsiDcp.cpp +51 -0
- package/android/src/main/cpp/JsiDcp.h +31 -0
- package/android/src/main/cpp/JsiDdn.cpp +50 -0
- package/android/src/main/cpp/JsiDdn.h +28 -0
- package/android/src/main/cpp/JsiDlr.cpp +51 -0
- package/android/src/main/cpp/JsiDlr.h +26 -0
- package/android/src/main/cpp/JsiUtility.cpp +196 -0
- package/android/src/main/cpp/JsiUtility.h +16 -0
- package/android/src/main/cpp/RawBuffer.cpp +24 -0
- package/android/src/main/cpp/RawBuffer.h +24 -0
- package/android/src/main/cpp/android_log.h +14 -0
- package/android/src/main/dysJniLibs/debug/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/debug/x86/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/debug/x86_64/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/release/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/release/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/release/x86/librn_dys.so +0 -0
- package/android/src/main/dysJniLibs/release/x86_64/librn_dys.so +0 -0
- package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
- package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +10 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
- package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +25 -25
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +23 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
- package/dynamsoft-capture-vision-react-native.podspec +9 -7
- package/ios/CPP/DSImageData+HostObject.h +1 -1
- package/ios/CPP/RNDynamsoft+JSI.h +2 -2
- package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
- package/ios/CPP/RNDynamsoft+Json.h +2 -13
- package/ios/CPP/RNDynamsoft+Json.m +48 -39
- package/ios/CPP/YeetJSIUtils.h +3 -1
- package/ios/CPP/YeetJSIUtils.mm +5 -0
- package/ios/RNDynamsoftCameraView.m +1 -1
- package/ios/RNDynamsoftCameraViewManager.m +23 -8
- package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
- package/ios/RNDynamsoftImageEditorView.m +1 -1
- package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
- package/ios/RNDynamsoftImageManager.mm +33 -4
- package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
- package/ios/RNDynamsoftLicense.m +1 -1
- package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
- package/ios/RNDynamsoftVersions.m +1 -13
- package/package.json +3 -11
- package/src/core/CapturedResultBase.tsx +18 -0
- package/src/core/EnumCaptureResultItemType.tsx +12 -6
- package/src/core/EnumCrossVerificationStatus.tsx +6 -6
- package/src/core/ImageData.tsx +1 -1
- package/src/core/index.tsx +1 -0
- package/src/cvr/CaptureVisionRouter.tsx +47 -51
- package/src/cvr/CapturedResult.tsx +24 -46
- package/src/cvr/CapturedResultReceiver.tsx +12 -19
- package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
- package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
- package/src/dbr/DecodedBarcodesResult.tsx +3 -17
- package/src/dce/CameraEnhancer.tsx +9 -0
- package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
- package/src/dce/EnumResolution.tsx +7 -0
- package/src/dce/NativeDynamsoftCameraViewModule.tsx +4 -0
- package/src/dce/index.tsx +1 -0
- package/src/dcp/ParsedResult.tsx +3 -14
- package/src/ddn/DeskewedImageResultItem.tsx +40 -0
- package/src/ddn/DetectedQuadResultItem.tsx +3 -1
- package/src/ddn/EnhancedImageResultItem.tsx +20 -0
- package/src/ddn/ProcessedDocumentResult.tsx +27 -0
- package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
- package/src/ddn/index.tsx +3 -3
- package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
- package/src/index.tsx +0 -1
- package/src/utility/ImageManager.tsx +66 -45
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
- package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
- package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
- package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
- package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
- package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
- package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
- package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
- package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
- package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
- package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
- package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
- package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
- package/ios/RNDynamsoftBarcodeScanner.h +0 -14
- package/ios/RNDynamsoftBarcodeScanner.m +0 -169
- package/ios/RNDynamsoftMRZScanner.h +0 -14
- package/ios/RNDynamsoftMRZScanner.m +0 -140
- package/src/ddn/DetectedQuadsResult.tsx +0 -31
- package/src/ddn/NormalizedImageResultItem.tsx +0 -32
- package/src/ddn/NormalizedImagesResult.tsx +0 -27
- package/src/rtu/BarcodeScanConfig.tsx +0 -104
- package/src/rtu/BarcodeScanResult.tsx +0 -31
- package/src/rtu/BarcodeScanner.tsx +0 -112
- package/src/rtu/EnumResultState.tsx +0 -21
- package/src/rtu/MRZScanConfig.tsx +0 -67
- package/src/rtu/MRZScanResult.tsx +0 -84
- package/src/rtu/MRZScanner.tsx +0 -90
- package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
- package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
- package/src/rtu/index.tsx +0 -7
- /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
- /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
#import "RNDynamsoftImageManager.h"
|
|
6
|
-
#import <
|
|
6
|
+
#import <DynamsoftCaptureVisionBundle/DynamsoftCaptureVisionBundle.h>
|
|
7
7
|
#import <React/RCTBridge+Private.h>
|
|
8
8
|
#import <React/RCTUtils.h>
|
|
9
9
|
#import <jsi/jsi.h>
|
|
@@ -19,7 +19,9 @@ using namespace std;
|
|
|
19
19
|
|
|
20
20
|
@interface RNDynamsoftImageManager ()
|
|
21
21
|
|
|
22
|
-
@property (nonatomic, strong)
|
|
22
|
+
@property (nonatomic, strong) DSImageIO *manager;
|
|
23
|
+
@property (nonatomic, strong) DSImageDrawer *drawer;
|
|
24
|
+
@property (nonatomic, strong) DSImageProcessor *processor;
|
|
23
25
|
|
|
24
26
|
@end
|
|
25
27
|
|
|
@@ -29,7 +31,9 @@ using namespace std;
|
|
|
29
31
|
{
|
|
30
32
|
self = [super init];
|
|
31
33
|
if (self) {
|
|
32
|
-
_manager = [[
|
|
34
|
+
_manager = [[DSImageIO alloc] init];
|
|
35
|
+
_drawer = [[DSImageDrawer alloc] init];
|
|
36
|
+
_processor = [[DSImageProcessor alloc] init];
|
|
33
37
|
}
|
|
34
38
|
return self;
|
|
35
39
|
}
|
|
@@ -107,7 +111,7 @@ static void install(jsi::Runtime &jsiRuntime, RNDynamsoftImageManager *rnManager
|
|
|
107
111
|
green:((hexColor >> 8) & 0xFF) / 255.0
|
|
108
112
|
blue:(hexColor & 0xFF) / 255.0
|
|
109
113
|
alpha:((hexColor >> 24) & 0xFF) / 255.0];
|
|
110
|
-
DSImageData *imageData = [rnManager.
|
|
114
|
+
DSImageData *imageData = [rnManager.drawer drawOnImage:data quads:[mutableArray copy] colour:color thickness:thickness];
|
|
111
115
|
ImageDataHostObject outImageData = [imageData hostObject];
|
|
112
116
|
Object outObj = Object::createFromHostObject(runtime, std::make_shared<ImageDataHostObject>(outImageData));
|
|
113
117
|
return outObj;
|
|
@@ -115,6 +119,31 @@ static void install(jsi::Runtime &jsiRuntime, RNDynamsoftImageManager *rnManager
|
|
|
115
119
|
return Value(false);
|
|
116
120
|
});
|
|
117
121
|
jsiRuntime.global().setProperty(jsiRuntime, drawOnImageName, std::move(drawOnImageFunc));
|
|
122
|
+
|
|
123
|
+
const char* cropImageName = "imageManager_cropImage";
|
|
124
|
+
auto cropImageFunc = Function::createFromHostFunction(jsiRuntime,
|
|
125
|
+
PropNameID::forAscii(jsiRuntime,
|
|
126
|
+
cropImageName),
|
|
127
|
+
2,
|
|
128
|
+
[rnManager](Runtime &runtime,
|
|
129
|
+
const Value& /*thisValue*/,
|
|
130
|
+
const Value* arguments,
|
|
131
|
+
size_t count) -> Value {
|
|
132
|
+
Object obj = arguments[0].getObject(runtime);
|
|
133
|
+
if (obj.isHostObject<ImageDataHostObject>(runtime)) {
|
|
134
|
+
ImageDataHostObject hostObject = ImageDataHostObject::getHOFromObject(runtime, std::move(obj));
|
|
135
|
+
DSImageData *data = [DSImageData imageDataFromHostObject:hostObject];
|
|
136
|
+
Object obj = arguments[1].getObject(runtime);
|
|
137
|
+
DSQuadrilateral *quad = convertJSIValueToDSQuadrilateral(runtime, obj);
|
|
138
|
+
NSError *error;
|
|
139
|
+
DSImageData *imageData = [rnManager.processor cropAndDeskewImage:data quad:quad error:&error];
|
|
140
|
+
ImageDataHostObject outImageData = [imageData hostObject];
|
|
141
|
+
Object outObj = Object::createFromHostObject(runtime, std::make_shared<ImageDataHostObject>(outImageData));
|
|
142
|
+
return outObj;
|
|
143
|
+
}
|
|
144
|
+
return Value(false);
|
|
145
|
+
});
|
|
146
|
+
jsiRuntime.global().setProperty(jsiRuntime, cropImageName, std::move(cropImageFunc));
|
|
118
147
|
}
|
|
119
148
|
|
|
120
149
|
@end
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#import <jsi/jsi.h>
|
|
9
9
|
#import <sys/utsname.h>
|
|
10
10
|
#import "YeetJSIUtils.h"
|
|
11
|
-
#import <
|
|
11
|
+
#import <DynamsoftCaptureVisionBundle/DynamsoftCaptureVisionBundle.h>
|
|
12
12
|
#import "DSImageData+HostObject.h"
|
|
13
13
|
|
|
14
14
|
using namespace facebook::jsi;
|
package/ios/RNDynamsoftLicense.m
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
#import "RNDynamsoftMultiCrossFilter.h"
|
|
6
|
-
#import <
|
|
6
|
+
#import <DynamsoftCaptureVisionBundle/DynamsoftCaptureVisionBundle.h>
|
|
7
7
|
#import "RNDynamsoftCaptureVisionRouter.h"
|
|
8
8
|
|
|
9
9
|
@implementation RNDynamsoftMultiCrossFilter
|
|
@@ -29,10 +29,10 @@ RCT_EXPORT_METHOD(enableResultCrossVerification:(NSString *)key type:(NSInteger)
|
|
|
29
29
|
[filter enableResultCrossVerification:type isEnabled:isEnabled];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
RCT_EXPORT_METHOD(isResultCrossVerificationEnabled:(NSString *)key
|
|
32
|
+
RCT_EXPORT_METHOD(isResultCrossVerificationEnabled:(NSString *)key
|
|
33
33
|
type:(NSInteger)type
|
|
34
34
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
35
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
35
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
36
36
|
{
|
|
37
37
|
RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
|
|
38
38
|
DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
|
|
@@ -61,10 +61,10 @@ RCT_EXPORT_METHOD(setDuplicateForgetTime:(NSString *)key type:(NSInteger)type ti
|
|
|
61
61
|
[filter setDuplicateForgetTime:type duplicateForgetTime:time];
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
RCT_EXPORT_METHOD(getDuplicateForgetTime:(NSString *)key
|
|
64
|
+
RCT_EXPORT_METHOD(getDuplicateForgetTime:(NSString *)key
|
|
65
65
|
type:(NSInteger)type
|
|
66
66
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
67
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
67
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
68
68
|
{
|
|
69
69
|
RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
|
|
70
70
|
DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
|
|
@@ -77,10 +77,10 @@ RCT_EXPORT_METHOD(enableLatestOverlapping:(NSString *)key type:(NSInteger)type i
|
|
|
77
77
|
[filter enableLatestOverlapping:type isEnabled:isEnabled];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
RCT_EXPORT_METHOD(isLatestOverlappingEnabled:(NSString *)key
|
|
80
|
+
RCT_EXPORT_METHOD(isLatestOverlappingEnabled:(NSString *)key
|
|
81
81
|
type:(NSInteger)type
|
|
82
82
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
83
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
83
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
84
84
|
{
|
|
85
85
|
RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
|
|
86
86
|
DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
|
|
@@ -93,10 +93,10 @@ RCT_EXPORT_METHOD(setMaxOverlappingFrames:(NSString *)key type:(NSInteger)type m
|
|
|
93
93
|
[filter setMaxOverlappingFrames:type maxOverlappingFrames:maxOverlappingFrames];
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
RCT_EXPORT_METHOD(getMaxOverlappingFrames:(NSString *)key
|
|
96
|
+
RCT_EXPORT_METHOD(getMaxOverlappingFrames:(NSString *)key
|
|
97
97
|
type:(NSInteger)type
|
|
98
98
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
99
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
99
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
100
100
|
{
|
|
101
101
|
RNDynamsoftCaptureVisionRouter *router = [self.bridge moduleForClass:[RNDynamsoftCaptureVisionRouter class]];
|
|
102
102
|
DSMultiFrameResultCrossFilter *filter = [router.filterDictionary objectForKey:key];
|
|
@@ -3,19 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
#import "RNDynamsoftVersions.h"
|
|
6
|
-
#import <
|
|
7
|
-
#import <DynamsoftLicense/DynamsoftLicense.h>
|
|
8
|
-
#import <DynamsoftImageProcessing/DynamsoftImageProcessing.h>
|
|
9
|
-
#import <DynamsoftCaptureVisionRouter/DynamsoftCaptureVisionRouter.h>
|
|
10
|
-
#import <DynamsoftBarcodeReader/DynamsoftBarcodeReader.h>
|
|
11
|
-
#import <DynamsoftLabelRecognizer/DynamsoftLabelRecognizer.h>
|
|
12
|
-
#import <DynamsoftDocumentNormalizer/DynamsoftDocumentNormalizer.h>
|
|
13
|
-
#import <DynamsoftCameraEnhancer/DynamsoftCameraEnhancer.h>
|
|
14
|
-
#import <DynamsoftNeuralNetwork/DynamsoftNeuralNetwork.h>
|
|
15
|
-
#import <DynamsoftUtility/DynamsoftUtility.h>
|
|
16
|
-
#import <DynamsoftCodeParser/DynamsoftCodeParser.h>
|
|
17
|
-
#import <DynamsoftCodeParserDedicator/DynamsoftCodeParserDedicator.h>
|
|
18
|
-
#import <DynamsoftImageProcessing/DynamsoftImageProcessing.h>
|
|
6
|
+
#import <DynamsoftCaptureVisionBundle/DynamsoftCaptureVisionBundle.h>
|
|
19
7
|
|
|
20
8
|
@implementation RNDynamsoftVersions
|
|
21
9
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dynamsoft-capture-vision-react-native",
|
|
3
3
|
"title": "Dynamsoft Capture Vision React Native",
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "Dynamsoft Capture Vision React Native SDK
|
|
4
|
+
"version": "3.0.5100",
|
|
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",
|
|
8
8
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://www.dynamsoft.com",
|
|
38
38
|
"email": "support@dynamsoft.com"
|
|
39
39
|
},
|
|
40
|
-
"license": "
|
|
40
|
+
"license": "Apache-2.0",
|
|
41
41
|
"licenseFilename": "LICENSE",
|
|
42
42
|
"readmeFilename": "README.md",
|
|
43
43
|
"peerDependencies": {
|
|
@@ -58,13 +58,5 @@
|
|
|
58
58
|
"react-native": "0.75.2",
|
|
59
59
|
"typedoc": "^0.27.7",
|
|
60
60
|
"typescript": "5.2.2"
|
|
61
|
-
},
|
|
62
|
-
"codegenConfig": {
|
|
63
|
-
"name": "DynamsoftSpecs",
|
|
64
|
-
"type": "all",
|
|
65
|
-
"jsSrcsDir": "src",
|
|
66
|
-
"android": {
|
|
67
|
-
"javaPackageName": "com.dynamsoft.reactnativelib"
|
|
68
|
-
}
|
|
69
61
|
}
|
|
70
62
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {IntermediateResultManager} from "../cvr";
|
|
2
|
+
|
|
3
|
+
export interface CapturedResultBase {
|
|
4
|
+
/**
|
|
5
|
+
* The hash ID of the original image.
|
|
6
|
+
* @see {@link IntermediateResultManager.getOriginalImage}
|
|
7
|
+
* */
|
|
8
|
+
originalImageHashId: string;
|
|
9
|
+
|
|
10
|
+
/**Error code associated with the capture result.*/
|
|
11
|
+
errorCode: number;
|
|
12
|
+
|
|
13
|
+
/**Error string providing details about the error.*/
|
|
14
|
+
errorMessage: string;
|
|
15
|
+
|
|
16
|
+
/**the rotation transformation matrix of the original image relative to the rotated image.*/
|
|
17
|
+
rotationTransformMatrix: Array<number>;
|
|
18
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {BarcodeResultItem} from "../dbr";
|
|
2
2
|
import type {TextLineResultItem} from "../dlr";
|
|
3
|
-
import type {DetectedQuadResultItem,
|
|
3
|
+
import type {DetectedQuadResultItem, EnhancedImageResultItem, DeskewedImageResultItem} from "../ddn";
|
|
4
4
|
import type {ParsedResultItem} from "../dcp";
|
|
5
5
|
|
|
6
|
-
/**{@link BarcodeResultItem} {@link TextLineResultItem} {@link DetectedQuadResultItem} {@link
|
|
6
|
+
/**{@link BarcodeResultItem} {@link TextLineResultItem} {@link DetectedQuadResultItem} {@link DeskewedImageResultItem} {@link ParsedResultItem} {@link EnhancedImageResultItem}* */
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Defines the various categories of items that can be recognized and captured.
|
|
@@ -33,14 +33,20 @@ export enum EnumCapturedResultItemType {
|
|
|
33
33
|
CRIT_DETECTED_QUAD = 0x8,
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* The type of the CapturedResultItem is "
|
|
37
|
-
* @see {@link
|
|
36
|
+
* The type of the CapturedResultItem is "deskewed image".
|
|
37
|
+
* @see {@link DeskewedImageResultItem}
|
|
38
38
|
* */
|
|
39
|
-
|
|
39
|
+
CRIT_DESKEWED_IMAGE = 0x10,
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The type of the CapturedResultItem is "parsed result".
|
|
43
43
|
* @see {@link ParsedResultItem}
|
|
44
44
|
* */
|
|
45
|
-
CRIT_PARSED_RESULT = 0x20
|
|
45
|
+
CRIT_PARSED_RESULT = 0x20,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The type of the CapturedResultItem is "enhanced image".
|
|
49
|
+
* @see {@link EnhancedImageResultItem}
|
|
50
|
+
* */
|
|
51
|
+
CRIT_ENHANCED_IMAGE = 0x40,
|
|
46
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import {type DetectedQuadResultItem, type DeskewedImageResultItem} from "../ddn";
|
|
2
2
|
import {CaptureVisionRouter} from "../cvr";
|
|
3
3
|
import {MultiFrameResultCrossFilter} from "../utility";
|
|
4
4
|
/**
|
|
@@ -12,11 +12,11 @@ import {MultiFrameResultCrossFilter} from "../utility";
|
|
|
12
12
|
* router.addFilter(filter)
|
|
13
13
|
*
|
|
14
14
|
* router.addResultReceiver({
|
|
15
|
-
*
|
|
16
|
-
* if(result.
|
|
15
|
+
* onProcessedDocumentResultReceived: result => {
|
|
16
|
+
* if(result.detectedQuadResultItems && result.detectedQuadResultItems.length > 0) {
|
|
17
17
|
* //Because result cross verification of DETECT_QUAD is enabled,
|
|
18
18
|
* //crossVerificationStatus of item will be CVS_PASSED or CVS_FAILED.
|
|
19
|
-
* let crossVerificationStatus = result.
|
|
19
|
+
* let crossVerificationStatus = result.detectedQuadResultItems[0].crossVerificationStatus
|
|
20
20
|
* }
|
|
21
21
|
* },
|
|
22
22
|
* })
|
|
@@ -28,11 +28,11 @@ import {MultiFrameResultCrossFilter} from "../utility";
|
|
|
28
28
|
* or added {@link MultiFrameResultCrossFilter} doesn't enable verification for the corresponding type,
|
|
29
29
|
* the crossVerificationStatus property of the item for that type will always remain {@link CVS_NOT_VERIFIED}.
|
|
30
30
|
* <p>
|
|
31
|
-
* Currently, only {@link DetectedQuadResultItem} and {@link
|
|
31
|
+
* Currently, only {@link DetectedQuadResultItem} and {@link DeskewedImageResultItem} have the crossVerificationStatus property.
|
|
32
32
|
*
|
|
33
33
|
* @see {@link MultiFrameResultCrossFilter.enableResultCrossVerification}
|
|
34
34
|
* @see {@link DetectedQuadResultItem.crossVerificationStatus}
|
|
35
|
-
* @see {@link
|
|
35
|
+
* @see {@link DeskewedImageResultItem.crossVerificationStatus}
|
|
36
36
|
* */
|
|
37
37
|
export enum EnumCrossVerificationStatus {
|
|
38
38
|
/** The cross verification has not been performed yet. */
|
package/src/core/ImageData.tsx
CHANGED
|
@@ -20,7 +20,7 @@ declare global {
|
|
|
20
20
|
* */
|
|
21
21
|
export interface ImageData {
|
|
22
22
|
/**
|
|
23
|
-
* The raw bytes of the image, of type {@link ArrayBuffer}.
|
|
23
|
+
* The raw bytes of the image, of type {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer}.
|
|
24
24
|
* */
|
|
25
25
|
buffer: ArrayBuffer;
|
|
26
26
|
|
package/src/core/index.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
* @
|
|
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
|
|
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
|
-
|
|
159
|
+
let processingDocumentResult = result.processingDocumentResult;
|
|
160
|
+
if (processingDocumentResult && processingDocumentResult.deskewedImageResultItems && processingDocumentResult.deskewedImageResultItems.length > 0) {
|
|
161
161
|
installMethods();
|
|
162
|
-
let imageArr: ImageData[] = global.
|
|
163
|
-
for (let i = 0; i <
|
|
164
|
-
|
|
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.
|
|
213
|
+
if (!this.onProcessedDocumentResultReceived && receiver.onProcessedDocumentResultReceived) {
|
|
207
214
|
if (Platform.OS == 'ios') {
|
|
208
|
-
CvrModule.addResultReceiver('
|
|
215
|
+
CvrModule.addResultReceiver('onProcessedDocumentResultReceived')
|
|
209
216
|
}
|
|
210
|
-
this.
|
|
211
|
-
async (result:
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
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.
|
|
228
|
-
for (let i = 0; i < result.
|
|
229
|
-
result.
|
|
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.
|
|
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.
|
|
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.
|
|
303
|
-
CvrModule.removeResultReceiver('
|
|
304
|
-
CVREventEmitter.removeAllListeners('
|
|
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.
|
|
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
|
|
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:
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
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
|
|
51
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
|
87
|
+
function getProcessingDocumentResult(result: CapturedResult): ProcessedDocumentResult {
|
|
105
88
|
return {
|
|
106
89
|
originalImageHashId: result.originalImageHashId,
|
|
107
90
|
errorCode: result.errorCode,
|
|
108
|
-
|
|
91
|
+
errorMessage: result.errorMessage,
|
|
109
92
|
rotationTransformMatrix: result.rotationTransformMatrix,
|
|
110
|
-
|
|
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
|
-
|
|
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
|
|
106
|
+
return item as EnhancedImageResultItem
|
|
129
107
|
})
|
|
130
|
-
} as
|
|
108
|
+
} as ProcessedDocumentResult;
|
|
131
109
|
}
|
|
132
110
|
|
|
133
111
|
/**@internal*/
|