-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapture_analyzer_result.dart
85 lines (75 loc) · 3.39 KB
/
capture_analyzer_result.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import 'capture_enums.dart';
/// The result of the capture analysis.
///
/// Contains the information about each document side,
/// completeness status of the capture process and the document group.
class AnalyzerResult {
/// Contains the result of the first side capture.
/// See [SideCaptureResult] for more detailed information.
SideCaptureResult? firstCapture;
/// Contains the result of the second side capture.
/// See [SideCaptureResult] for more detailed information.
SideCaptureResult? secondCapture;
/// Contains the information about the document group classification.
/// See [DocumentGroup] enum for more information
DocumentGroup? documentGroup;
/// Contains the completeness status of the capture process.
/// See [CompletenessStatus] for more information.
CompletenessStatus? completenessStatus;
/// The result of the capture analysis.
///
/// Contains the information about each document side,
/// completeness status of the capture process and the document group.
AnalyzerResult(Map<String, dynamic> nativeAnalyzerResult) {
this.firstCapture = nativeAnalyzerResult['nativeFirstCapture'] != null
? SideCaptureResult(Map<String, dynamic>.from(
nativeAnalyzerResult['nativeFirstCapture']))
: null;
this.secondCapture = nativeAnalyzerResult['nativeSecondCapture'] != null
? SideCaptureResult(Map<String, dynamic>.from(
nativeAnalyzerResult['nativeSecondCapture']))
: null;
this.documentGroup =
DocumentGroup.values[nativeAnalyzerResult['nativeDocumentGroup']];
this.completenessStatus = CompletenessStatus
.values[nativeAnalyzerResult['nativeCompletenessStatus']];
}
}
/// Result of the document side capture.
///
/// Contains the original and transformed image of the captured document side and
/// the information about the document side and DPI.
class SideCaptureResult {
/// Contains the original image of the captured document,
/// untransformed, as it was used in analysis.
String? capturedImage;
/// Contains the image of a cropped and perspective-corrected document.
/// The transformed image is returned in the correct orientation.
String? transformedImage;
/// Contains the document side classification.
/// If side classification was uncertain, `Unknown` is returned.
/// See [DocumentSide] enum for more detailed information.
DocumentSide? side;
/// Indicates whether DPI was adjusted.
/// If the document is captured at a lower dpi than the `minimumDocumentDpi` in [AnalyzerSettings], the property is set to `true`.
bool? dpiAdjusted;
/// Result of the document side capture.
///
/// Contains the original and transformed image of the captured document side and
/// the information about the document side and DPI.
SideCaptureResult(Map<String, dynamic> nativeCaptureResult) {
this.capturedImage = nativeCaptureResult['nativeCapturedImage'] != null
? nativeCaptureResult['nativeCapturedImage']
: null;
this.transformedImage =
nativeCaptureResult['nativeTransformedImage'] != null
? nativeCaptureResult['nativeTransformedImage']
: null;
this.side = nativeCaptureResult['nativeSide'] != null
? DocumentSide.values[nativeCaptureResult['nativeSide']]
: null;
this.dpiAdjusted = nativeCaptureResult['nativeDpiAdjusted'] != null
? nativeCaptureResult['nativeDpiAdjusted']
: null;
}
}