scanbot-web-sdk 4.0.1 → 5.0.0-alpha.1

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 (58) hide show
  1. package/@types/barcode-scanner-view.d.ts +2 -1
  2. package/@types/core/compiled/ParametricFilters.d.ts +181 -0
  3. package/@types/cropping-view.d.ts +9 -5
  4. package/@types/document-scanner-view.d.ts +4 -4
  5. package/@types/index.d.ts +58 -75
  6. package/@types/interfaces/i-scanner-common-handle.d.ts +1 -0
  7. package/@types/model/barcode/barcode-format.d.ts +1 -1
  8. package/@types/model/barcode/barcode-result.d.ts +1 -0
  9. package/@types/model/camera-info.d.ts +2 -1
  10. package/@types/model/configuration/document-quality-analyzer-configuration.d.ts +6 -0
  11. package/@types/model/configuration/document-scanner-configuration.d.ts +3 -4
  12. package/@types/model/configuration/mrz-scanner-configuration.d.ts +8 -0
  13. package/@types/model/configuration/scanner-configuration.d.ts +1 -0
  14. package/@types/model/configuration/text-data-scanner-configuration.d.ts +2 -3
  15. package/@types/model/error/media-error.d.ts +24 -7
  16. package/@types/model/filter-types.d.ts +3 -0
  17. package/@types/model/mrz/mrz-result.d.ts +1 -0
  18. package/@types/mrz-scanner-view.d.ts +2 -1
  19. package/@types/scanbot-sdk.d.ts +12 -2
  20. package/@types/scanner-view.d.ts +1 -0
  21. package/@types/service/image-processor.d.ts +35 -0
  22. package/@types/service/pdf-generator.d.ts +37 -13
  23. package/@types/service/simple-mrz-recognizer.d.ts +5 -4
  24. package/@types/service/tiff-generator.d.ts +8 -5
  25. package/@types/text-data-scanner-view.d.ts +2 -1
  26. package/@types/utils/dto/MagneticLine.d.ts +0 -1
  27. package/@types/utils/dto/Point.d.ts +6 -0
  28. package/@types/utils/math-utils.d.ts +1 -0
  29. package/@types/view/cropping/draggable-base-container.d.ts +28 -2
  30. package/@types/view/cropping/draggable-handles-component.d.ts +20 -4
  31. package/@types/view/cropping/draggable-lines-container.d.ts +6 -7
  32. package/@types/view/cropping/draggable-points-container.d.ts +1 -5
  33. package/@types/view/cropping/magnetic-lines-component.d.ts +23 -5
  34. package/@types/view/cropping/magnifier-view.d.ts +0 -1
  35. package/@types/view/polygon/draggable-document-polygon.d.ts +23 -1
  36. package/@types/view/scanbot-camera-view.d.ts +1 -0
  37. package/@types/view/shutter-button.d.ts +2 -12
  38. package/@types/view/utils/animatable.d.ts +11 -3
  39. package/@types/view/utils/clamp.d.ts +4 -0
  40. package/@types/view/view-finder.d.ts +2 -3
  41. package/bundle/ScanbotSDK.min.js +5 -5
  42. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  43. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm +0 -0
  44. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  45. package/bundle/bin/barcode-scanner/ScanbotSDK.Core-simd.js +1 -1
  46. package/bundle/bin/barcode-scanner/ScanbotSDK.Core.js +1 -1
  47. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm +0 -0
  48. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm-webpack-file-loader +0 -0
  49. package/bundle/bin/complete/ScanbotSDK.Asm.wasm +0 -0
  50. package/bundle/bin/complete/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  51. package/bundle/bin/complete/ScanbotSDK.Core-simd.js +1 -1
  52. package/bundle/bin/complete/ScanbotSDK.Core.js +1 -1
  53. package/bundle/bin/document-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  54. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm +0 -0
  55. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  56. package/bundle/bin/document-scanner/ScanbotSDK.Core-simd.js +1 -1
  57. package/bundle/bin/document-scanner/ScanbotSDK.Core.js +1 -1
  58. package/package.json +4 -3
@@ -11,6 +11,7 @@ import BottomActionBar from "./view/action-bar/bottom-action-bar";
11
11
  import ScannedImageWithOverlay from "./view/barcode-calculation/scanned-image-with-overlay";
12
12
  import { ImageDataWrapper } from "./model/image-data-wrapper";
13
13
  import { Barcode } from "./model/barcode/barcode";
14
+ import { IBarcodeScannerHandle } from "./interfaces/i-barcode-scanner-handle";
14
15
  export declare class BarcodeScannerProps extends ScanbotCameraProps {
15
16
  showFinder?: boolean;
16
17
  }
@@ -21,7 +22,7 @@ export declare class BarcodeScannerState extends ScanbotCameraState {
21
22
  image?: string;
22
23
  bottomHintText?: string;
23
24
  }
24
- export default class BarcodeScannerView extends ScannerView<BarcodeScannerProps, BarcodeScannerState> {
25
+ export default class BarcodeScannerView extends ScannerView<BarcodeScannerProps, BarcodeScannerState> implements IBarcodeScannerHandle {
25
26
  finder?: ViewFinder;
26
27
  shouldComputeSize: boolean;
27
28
  private _configuration;
@@ -0,0 +1,181 @@
1
+ /// Auto-generated. Modification will be overwritten.
2
+
3
+ /** Output mode of binarization filter.*/
4
+ export type OutputMode =
5
+ /** BINARY - Black and white image, suitable for 1-bit compression.*/
6
+ "BINARY" |
7
+
8
+ /** ANTIALIASED - When the source image is a document photo, this mode
9
+ will produce nice, smooth, antialiased text in grayscale, which is typically more readable
10
+ than the text in BINARY mode. Antialiasing requires extra processing,
11
+ which makes this mode slower than BINARY mode.
12
+ */
13
+ "ANTIALIASED";
14
+
15
+
16
+ /** Preset of parameters for custom binarization filter.*/
17
+ export type BinarizationFilterPreset =
18
+ /** Usually performs well if there is no shadow.*/
19
+ "PRESET_1" |
20
+
21
+ /** Usually performs well even if there are shadows.*/
22
+ "PRESET_2" |
23
+
24
+ /** Usually performs well even if there are shadows.*/
25
+ "PRESET_3" |
26
+
27
+ /** Usually performs well even if there are shadows.*/
28
+ "PRESET_4";
29
+
30
+
31
+
32
+ /** Automatic binarization filter. This filter is a good starting point for most use cases.*/
33
+ export class ScanbotBinarizationFilter {
34
+
35
+ /** Output mode of the filter. BINARY will return a black and white image, GRAYSCALE will return an antialiased grayscale image.*/
36
+ outputMode: OutputMode;
37
+
38
+
39
+ /** @internal */
40
+ toWireType(): any;
41
+ }
42
+ /** Automatic binarization filter. This filter is a good starting point for most use cases.*/
43
+ export class CustomBinarizationFilter {
44
+
45
+ /** Preset of binarization filter parameters that are found to perform well on different types of documents.*/
46
+ preset: BinarizationFilterPreset;
47
+
48
+ /** Output mode of the filter. BINARY will return a black and white image, GRAYSCALE will return an antialiased grayscale image.*/
49
+ outputMode: OutputMode;
50
+
51
+ /** Value controlling the amount of noise removal. Value between 0 and 1.
52
+ Too little noise removal may result in a very noisy image, worsening readability.
53
+ Too much noise removal may result in the degradation of text, again, worsening readability.
54
+ */
55
+ denoise: number;
56
+
57
+ /** Filter radius. The bigger the radius, the slower the filter and generally the less noise in the result.
58
+ The radius is used for both shadows removal and the calculation of local statistics in the main body of the filter.
59
+ Higher radius usually allows to cope better with regions of light text on dark background.
60
+ All the values larger than 512 are clamped to 512.
61
+ */
62
+ radius: number;
63
+
64
+
65
+ /** @internal */
66
+ toWireType(): any;
67
+ }
68
+ /** Color document filter. This filter is a good starting point for most use cases.*/
69
+ export class ColorDocumentFilter {
70
+
71
+ /** Strength of contrast enhancement. Typical values are between 1 and 2.*/
72
+ valueStrength: number;
73
+
74
+ /** Strength of color saturation enhancement. Typical values are between 1 and 2.*/
75
+ saturationStrength: number;
76
+
77
+ /** Saturation level separating colors from paper.*/
78
+ saturationOffset: number;
79
+
80
+
81
+ /** @internal */
82
+ toWireType(): any;
83
+ }
84
+ /** Brightness adjustment filter.*/
85
+ export class BrightnessFilter {
86
+
87
+ /** Brightness adjustment value in the range from -1 to 1. Negative values will make the image darker, positive values will make it brighter.*/
88
+ brightness: number;
89
+
90
+
91
+ /** @internal */
92
+ toWireType(): any;
93
+ }
94
+ /** Contrast adjustment filter.*/
95
+ export class ContrastFilter {
96
+
97
+ /** Contrast adjustment value in the range from -1 to 254 (inclusively). Negative values will decrease the contrast, positive values will increase it.*/
98
+ contrast: number;
99
+
100
+
101
+ /** @internal */
102
+ toWireType(): any;
103
+ }
104
+ /** Converts color images to grayscale, optionally applying autocontrast.*/
105
+ export class GrayscaleFilter {
106
+
107
+ /** Enable or disable autocontrast.
108
+ */
109
+ autocontrast: boolean;
110
+
111
+ /** Ignore this fraction of pixels at the edge of the image when calculating statistics.
112
+
113
+ Pixels at the edge of the image typically have poor statistics. Ignoring them
114
+ and using only the inner pixels when calculating certain statistics can
115
+ substantially improve the quality of the result.
116
+
117
+ The value must be less than 0.5 but usually good values are between 0 and 0.15.
118
+ */
119
+ borderWidthFraction: number;
120
+
121
+ /** Clip this fraction of the darkest pixels in operations such as autocontrast.
122
+
123
+ Increasing the range of middle gray levels at the expense of the brightest and darkest levels
124
+ may improve the overall contrast and quality of the result.
125
+
126
+ Sum of blackOutliersFraction and whiteOutliersFraction must be less than 1 but usually
127
+ good values for the parameters do not exceed 0.05;
128
+ */
129
+ blackOutliersFraction: number;
130
+
131
+ /** Clip this fraction of the brightest pixels in operations such as autocontrast.
132
+
133
+ Increasing the range of middle gray levels at the expense of the brightest and darkest levels
134
+ may improve the overall contrast and quality of the result.
135
+
136
+ Sum of blackOutliersFraction and whiteOutliersFraction must be less than 1 but usually
137
+ good values for the parameters do not exceed 0.05;
138
+ */
139
+ whiteOutliersFraction: number;
140
+
141
+
142
+ /** @internal */
143
+ toWireType(): any;
144
+ }
145
+ /** Deprecated image filters.*/
146
+ export class LegacyFilter {
147
+
148
+ /** Id of filter to be applied.*/
149
+ filterType: number;
150
+
151
+
152
+ /** @internal */
153
+ toWireType(): any;
154
+ }
155
+ /** Maps image value channel so that all the pixels darker than the black point are set to 0,
156
+ all the pixels brighter than the white point are set to 255, and the pixels in between
157
+ are linearly scaled.
158
+ */
159
+ export class WhiteBlackPointFilter {
160
+
161
+ /** Fraction of the value channel range that is set to 0. The value should be in the range from 0 to 1.*/
162
+ blackPoint: number;
163
+
164
+ /** Fraction of the value channel range that is not set to 255. The value should be in the range from 0 to 1.*/
165
+ whitePoint: number;
166
+
167
+
168
+ /** @internal */
169
+ toWireType(): any;
170
+ }
171
+
172
+ export type ParametricFilter =
173
+ ScanbotBinarizationFilter |
174
+ CustomBinarizationFilter |
175
+ ColorDocumentFilter |
176
+ BrightnessFilter |
177
+ ContrastFilter |
178
+ GrayscaleFilter |
179
+ LegacyFilter |
180
+ WhiteBlackPointFilter;
181
+
@@ -8,7 +8,7 @@ import { Point } from "./utils/dto/Point";
8
8
  import { MagneticLine } from "./utils/dto/MagneticLine";
9
9
  import { Polygon } from "./utils/dto/Polygon";
10
10
  import MagnifierView, { MagnifierOptions } from "./view/cropping/magnifier-view";
11
- import { ContourDetectionResult } from "./model/document/contour-detection-result";
11
+ import { ICroppingViewHandle } from "./interfaces/i-cropping-view-handle";
12
12
  export interface CroppingViewProps {
13
13
  configuration: CroppingViewConfiguration;
14
14
  container?: HTMLElement;
@@ -40,19 +40,22 @@ export interface CroppingViewState {
40
40
  };
41
41
  imageMargin: Point;
42
42
  }
43
- export default class CroppingView extends React.Component<CroppingViewProps, CroppingViewState> {
43
+ export default class CroppingView extends React.Component<CroppingViewProps, CroppingViewState> implements ICroppingViewHandle {
44
44
  polygon: DraggableDocumentPolygon | null;
45
45
  container: Animatable;
46
46
  htmlImage: HTMLImageElement;
47
47
  private _configuration?;
48
+ private onResizeCallback;
48
49
  constructor(props: any);
49
50
  /**
50
51
  * Public API functions
51
52
  */
52
53
  static create(configuration: CroppingViewConfiguration): Promise<CroppingView>;
53
54
  componentDidMount(): Promise<void>;
55
+ componentWillUnmount(): Promise<void>;
54
56
  onImageLoaded(image: HTMLImageElement): Promise<void>;
55
- loadImageAndPolygon(document?: ContourDetectionResult): void;
57
+ onResize(): void;
58
+ initializeSizes(relativeCoordPolygon?: Polygon, horizontalLines?: MagneticLine[], verticalLines?: MagneticLine[]): void;
56
59
  magnifier?: MagnifierView;
57
60
  render(): JSX.Element;
58
61
  showMagnifier(data: any): void;
@@ -74,7 +77,8 @@ export default class CroppingView extends React.Component<CroppingViewProps, Cro
74
77
  get rotations(): number;
75
78
  get configuration(): CroppingViewConfiguration;
76
79
  BASE_SCALE: number;
77
- calculateScale(existingRotations: number, appliedRotations: number, size?: Size): number;
78
- calculateRatio(size?: Size): number;
80
+ calculateScale(existingRotations: number, appliedRotations: number, calculatedSize: Size): number;
81
+ calculateRatio(calculatedSize: Size): number;
79
82
  calculateMargin(size: Size): Point;
83
+ private detectContour;
80
84
  }
@@ -6,13 +6,14 @@ import { ShutterButton, ShutterButtonAction } from "./view/shutter-button";
6
6
  import { DocumentOutline } from "./view/document-outline";
7
7
  import { PolygonMovementPredicate } from "./utils/predicate/polygon-movement-predicate";
8
8
  import { Polygon } from "./utils/dto/Polygon";
9
- declare class DocumentScannerState extends ScanbotCameraState {
9
+ import { IDocumentScannerHandle } from "./interfaces/i-document-scanner-handle";
10
+ export declare class DocumentScannerState extends ScanbotCameraState {
10
11
  action: ShutterButtonAction;
11
12
  }
12
- declare class DocumentScannerProps extends ScanbotCameraProps {
13
+ export declare class DocumentScannerProps extends ScanbotCameraProps {
13
14
  configuration: DocumentScannerConfiguration;
14
15
  }
15
- export default class DocumentScannerView extends ScannerView<DocumentScannerProps, DocumentScannerState> {
16
+ export default class DocumentScannerView extends ScannerView<DocumentScannerProps, DocumentScannerState> implements IDocumentScannerHandle {
16
17
  static DETECT_AND_CROP_RESOLUTION: number;
17
18
  outline: DocumentOutline | null;
18
19
  button: ShutterButton | null;
@@ -50,4 +51,3 @@ export default class DocumentScannerView extends ScannerView<DocumentScannerProp
50
51
  private runMovementPredicate;
51
52
  private getCameraFrameSize;
52
53
  }
53
- export {};
package/@types/index.d.ts CHANGED
@@ -1,75 +1,58 @@
1
-
2
- import { IDocumentScannerHandle } from "./interfaces/i-document-scanner-handle";
3
- import { DocumentScannerConfiguration } from "./model/configuration/document-scanner-configuration";
4
- import { DocumentDetectionResult } from "./model/document/document-detection-result";
5
- import { ContourDetectionResult } from "./model/document/contour-detection-result";
6
-
7
- import { ICroppingViewHandle } from "./interfaces/i-cropping-view-handle";
8
- import { CroppingViewConfiguration } from "./model/configuration/cropping-view-configuration";
9
- import { CroppingResult } from "./model/response/cropping-result";
10
-
11
- import { IBarcodeScannerHandle } from "./interfaces/i-barcode-scanner-handle";
12
- import { BarcodeScannerConfiguration } from "./model/configuration/barcode-scanner-configuration";
13
- import { BarcodeResult } from "./model/barcode/barcode-result";
14
-
15
- import { IMrzScannerHandle } from "./interfaces/i-mrz-scanner-handle";
16
- import { MrzScannerConfiguration } from "./model/configuration/mrz-scanner-configuration";
17
- import { MrzResult, MrzCheckDigits, MrzField } from "./model/mrz/mrz-result";
18
-
19
- import { TextDataScannerResult } from './model/generic-text-line-recognizer/text-data-scanner-result';
20
- import { TextDataScannerConfiguration } from "./model/configuration/text-data-scanner-configuration";
21
- import { ITextDataScannerHandle } from "./interfaces/i-text-data-scanner-handle";
22
-
23
- import PdfGenerator, { PdfGenerationOptions } from "./service/pdf-generator";
24
- import TiffGenerator, { TiffGenerationOptions } from "./service/tiff-generator";
25
-
26
- import { BinarizationFilter, ColorFilter, ImageFilter } from "./model/filter-types";
27
- import { Polygon } from "./utils/dto/Polygon";
28
- import { Barcode } from "./model/barcode/barcode";
29
-
30
- import { InitializationOptions } from "./model/configuration/initialization-options";
31
- import { LicenseInfo } from "./model/response/license-info";
32
- import { CameraInfo, CameraFacingMode } from "./model/camera-info";
33
-
34
-
35
- export {
36
- IDocumentScannerHandle,
37
- DocumentScannerConfiguration,
38
- DocumentDetectionResult,
39
- ContourDetectionResult,
40
-
41
- IBarcodeScannerHandle,
42
- BarcodeScannerConfiguration,
43
- BarcodeResult,
44
-
45
- IMrzScannerHandle,
46
- MrzScannerConfiguration,
47
- MrzResult,
48
- MrzCheckDigits,
49
- MrzField,
50
-
51
- ITextDataScannerHandle,
52
- TextDataScannerConfiguration,
53
- TextDataScannerResult,
54
-
55
- ICroppingViewHandle,
56
- CroppingViewConfiguration,
57
- CroppingResult,
58
-
59
- BinarizationFilter,
60
- ColorFilter,
61
- ImageFilter,
62
-
63
- PdfGenerator,
64
- PdfGenerationOptions,
65
- TiffGenerator,
66
- TiffGenerationOptions,
67
-
68
- InitializationOptions,
69
- Polygon,
70
- Barcode,
71
- LicenseInfo,
72
-
73
- CameraInfo,
74
- CameraFacingMode
75
- }
1
+ export { IDocumentScannerHandle } from "./interfaces/i-document-scanner-handle";
2
+ export { DocumentScannerConfiguration, StyleConfiguration, TextConfiguration, CaptureButtonStyleConfiguration, OutlineStyleConfiguration, HintTextConfiguration, OutlineLabelStyleConfiguration, CaptureAnimationStyleConfiguration, OutlinePolygonStyleConfiguration } from "./model/configuration/document-scanner-configuration";
3
+ export { DocumentDetectionResult } from "./model/document/document-detection-result";
4
+ export { ContourDetectionResult } from "./model/document/contour-detection-result";
5
+ export * as DetectionStatus from "./model/document/detection-status";
6
+
7
+ export { ICroppingViewHandle } from "./interfaces/i-cropping-view-handle";
8
+ export { CroppingViewConfiguration, CroppingViewStyle, CroppingViewMagneticLineStyle, CroppingViewMagnifierStyle, CroppingViewPolygonStyle, CroppingViewMagnifierBorderStyle, CroppingViewMagnifierCrosshairStyle, CroppingViewPolygonHandleStyle } from "./model/configuration/cropping-view-configuration";
9
+ export { CroppingResult } from "./model/response/cropping-result";
10
+
11
+ export { IBarcodeScannerHandle } from "./interfaces/i-barcode-scanner-handle";
12
+ export { BarcodeScannerConfiguration } from "./model/configuration/barcode-scanner-configuration";
13
+ export { BarcodeResult } from "./model/barcode/barcode-result";
14
+ export { BarcodeFormat } from "./model/barcode/barcode-format";
15
+ export { EngineMode } from "./model/barcode/engine-mode";
16
+ export { BarcodeCountConfiguration, BarcodeCountStyleConfiguration } from "./model/configuration/barcode-count-configuration";
17
+
18
+ export { IMrzScannerHandle } from "./interfaces/i-mrz-scanner-handle";
19
+ export { MrzScannerConfiguration, MrzScannerAccumulatedFrameVerificationConfiguration } from "./model/configuration/mrz-scanner-configuration";
20
+ export { MrzResult, MrzCheckDigits, MrzField, MRZFieldValidationStatus } from "./model/mrz/mrz-result";
21
+ export * as SimpleMrzRecognizer from "./service/simple-mrz-recognizer";
22
+
23
+ export { TextDataScannerResult } from './model/generic-text-line-recognizer/text-data-scanner-result';
24
+ export { TextDataScannerConfiguration, TextDetectionCallback } from "./model/configuration/text-data-scanner-configuration";
25
+ export { ITextDataScannerHandle } from "./interfaces/i-text-data-scanner-handle";
26
+
27
+ export { VINScannerConfiguration } from "./model/configuration/vin-scanner-configuration";
28
+
29
+ export { OcrData, default as OcrEngine, Rect } from "./service/ocr-engine";
30
+ export { Point } from "./utils/dto/Point";
31
+ export { MagneticLine } from "./utils/dto/MagneticLine";
32
+
33
+ export { ImageProcessor, Rotation } from "./service/image-processor";
34
+ export * as ParametricFilters from "./core/compiled/ParametricFilters";
35
+
36
+ export { default as DocumentQualityAnalyzerConfiguration } from "./model/configuration/document-quality-analyzer-configuration";
37
+ export { default as DocumentQualityAnalyzer } from "./service/document-quality-analyzer";
38
+ export { default as DocumentQualityAnalyzerResult, DocumentQuality } from "./model/response/document-quality-analyzer-result";
39
+
40
+ export { default as PublicUtils } from "./service/public-utils";
41
+ export { Size } from "./utils/dto/Size";
42
+ export { VideoSize } from "./utils/dto/VideoSize";
43
+
44
+ export { SelectionOverlayConfiguration, IBarcodePolygonHandle, IBarcodePolygonLabelHandle, BarcodePolygonStyle, SelectionOverlayTextFormat, SelectionOverlayStyleConfiguration, BarcodePolygonLabelStyle } from "./model/configuration/selection-overlay-configuration";
45
+ export { ViewFinderConfiguration } from "./model/configuration/view-finder-configuration";
46
+ export { TextStyleConfiguration } from "./model/configuration/text-style-configuration";
47
+ export { WindowStyleConfiguration } from "./model/configuration/window-style-configuration";
48
+
49
+ export { default as PdfGenerator, PdfGenerationOptions, PageDirection, PageSize, PageFit } from "./service/pdf-generator";
50
+ export { default as TiffGenerator, TiffGenerationOptions } from "./service/tiff-generator";
51
+
52
+ export { BinarizationFilter, ColorFilter, ImageFilter } from "./model/filter-types";
53
+ export { Polygon } from "./utils/dto/Polygon";
54
+ export { Barcode } from "./model/barcode/barcode";
55
+
56
+ export { InitializationOptions } from "./model/configuration/initialization-options";
57
+ export { LicenseInfo } from "./model/response/license-info";
58
+ export { CameraInfo, CameraFacingMode } from "./model/camera-info";
@@ -4,5 +4,6 @@ export interface IScannerCommon {
4
4
  switchCamera(deviceId: string, mirrored?: boolean): void;
5
5
  fetchAvailableCameras(): Promise<CameraInfo[]>;
6
6
  getActiveCameraInfo(): CameraInfo | undefined;
7
+ setTorchState(state: boolean): Promise<void>;
7
8
  dispose(): void;
8
9
  }
@@ -1 +1 @@
1
- export declare type BarcodeFormat = "AZTEC" | "CODABAR" | "CODE_39" | "CODE_93" | "CODE_128" | "DATA_MATRIX" | "EAN_8" | "EAN_13" | "ITF" | "MAXICODE" | "PDF_417" | "QR_CODE" | "RSS_14" | "RSS_EXPANDED" | "UPC_A" | "UPC_E" | "UPC_EAN_EXTENSION" | "MSI_PLESSEY" | "IATA_2_OF_5" | "INDUSTRIAL_2_OF_5" | "CODE_25" | "MICRO_QR_CODE" | "USPS_INTELLIGENT_MAIL" | "ROYAL_MAIL" | "JAPAN_POST" | "ROYAL_TNT_POST" | "AUSTRALIA_POST" | "DATABAR_LIMITED";
1
+ export declare type BarcodeFormat = "ONE_D" | "AZTEC" | "CODABAR" | "CODE_39" | "CODE_93" | "CODE_128" | "DATA_MATRIX" | "EAN_8" | "EAN_13" | "ITF" | "MAXICODE" | "PDF_417" | "QR_CODE" | "UPC_A" | "UPC_E" | "UPC_EAN_EXTENSION" | "MSI_PLESSEY" | "IATA_2_OF_5" | "INDUSTRIAL_2_OF_5" | "CODE_25" | "MICRO_QR_CODE" | "USPS_INTELLIGENT_MAIL" | "ROYAL_MAIL" | "JAPAN_POST" | "ROYAL_TNT_POST" | "AUSTRALIA_POST" | "DATABAR" | "DATABAR_EXPANDED" | "DATABAR_LIMITED" | "GS1_COMPOSITE";
@@ -4,6 +4,7 @@ export declare class BarcodeResult {
4
4
  barcodes: Barcode[];
5
5
  imageData: ImageData;
6
6
  constructor(barcodes: Barcode[], imageData: ImageData);
7
+ /** @internal */
7
8
  static fromWorker(inputs: any[], image: ImageDataWrapper): BarcodeResult;
8
9
  isEmpty(): boolean;
9
10
  }
@@ -1,6 +1,7 @@
1
1
  export declare type CameraFacingMode = 'front' | 'back' | 'unknown';
2
2
  export interface CameraInfo {
3
3
  deviceId: string;
4
- label?: string;
4
+ label: string;
5
5
  facingMode?: CameraFacingMode;
6
+ supportsTorchControl?: boolean;
6
7
  }
@@ -4,4 +4,10 @@ export default class DocumentQualityAnalyzerConfiguration {
4
4
  * Smaller patch sizes use less memory but take longer. Defaults to 512.
5
5
  */
6
6
  patchSize: number;
7
+ /**
8
+ * Images with a side length larger than maxImageSize will be downscaled before analysing.
9
+ * This is useful to reduce memory usage and processing time for large images.
10
+ * Set to -1 to disable downscaling.
11
+ */
12
+ maxImageSize: number;
7
13
  }
@@ -13,7 +13,7 @@ export interface HintTextConfiguration {
13
13
  Error_Brightness?: string;
14
14
  Error_Noise?: string;
15
15
  }
16
- declare class StyleConfiguration {
16
+ export declare class StyleConfiguration {
17
17
  constructor();
18
18
  outline?: OutlineStyleConfiguration;
19
19
  captureButton?: CaptureButtonStyleConfiguration;
@@ -35,7 +35,7 @@ export declare class CaptureAnimationStyleConfiguration {
35
35
  stroke?: string;
36
36
  strokeWidth?: number;
37
37
  }
38
- declare class OutlineLabelStyleConfiguration {
38
+ export declare class OutlineLabelStyleConfiguration {
39
39
  position?: any;
40
40
  top?: any;
41
41
  left?: any;
@@ -48,7 +48,7 @@ declare class OutlineLabelStyleConfiguration {
48
48
  fontFamily?: any;
49
49
  fontSize?: any;
50
50
  }
51
- declare class CaptureButtonStyleConfiguration {
51
+ export declare class CaptureButtonStyleConfiguration {
52
52
  color?: string;
53
53
  }
54
54
  export declare class DocumentScannerConfiguration extends ScannerConfiguration {
@@ -109,4 +109,3 @@ export declare class DocumentScannerConfiguration extends ScannerConfiguration {
109
109
  onDocumentDetected?: (e: any) => void;
110
110
  static fromJson(json: any): DocumentScannerConfiguration;
111
111
  }
112
- export {};
@@ -1,9 +1,17 @@
1
1
  import { MrzResult } from "../mrz/mrz-result";
2
2
  import { ScannerConfiguration } from "./scanner-configuration";
3
3
  import { ViewFinderConfiguration } from "./view-finder-configuration";
4
+ export interface MrzScannerAccumulatedFrameVerificationConfiguration {
5
+ /** Maximum number of accumulated frames to inspect to verify a scan result */
6
+ maximumNumberOfAccumulatedFrames?: number;
7
+ /** Minimum number of accumulated frames that have an equal result,
8
+ * in order for the result to be considered verified */
9
+ minimumNumberOfRequiredFramesWithEqualRecognitionResult?: number;
10
+ }
4
11
  export declare class MrzScannerConfiguration extends ScannerConfiguration {
5
12
  constructor();
6
13
  style?: ViewFinderConfiguration;
14
+ accumulatedFrameVerificationConfiguration?: MrzScannerAccumulatedFrameVerificationConfiguration;
7
15
  onMrzDetected?: (e: MrzResult) => void;
8
16
  _onDetectionFailed?: (e: ImageData) => void;
9
17
  static fromJson(json: any): MrzScannerConfiguration;
@@ -20,6 +20,7 @@ export declare class ScannerConfiguration extends BaseConfiguration {
20
20
  width: number;
21
21
  height: number;
22
22
  });
23
+ /** @internal */
23
24
  static mapVideoConstraints(json: any, configuration: ScannerConfiguration): void;
24
25
  /**
25
26
  * Error callback of the SDK.
@@ -3,7 +3,7 @@ import { ScannerConfiguration } from "./scanner-configuration";
3
3
  import { TextStyleConfiguration } from "./text-style-configuration";
4
4
  import { WindowStyleConfiguration } from "./window-style-configuration";
5
5
  import { ViewFinderConfiguration } from "./view-finder-configuration";
6
- declare class TextDataScannerWindowStyle implements WindowStyleConfiguration {
6
+ export declare class TextDataScannerWindowStyle implements WindowStyleConfiguration {
7
7
  aspectRatio: number;
8
8
  widthProportion: number;
9
9
  borderColor: string;
@@ -11,7 +11,7 @@ declare class TextDataScannerWindowStyle implements WindowStyleConfiguration {
11
11
  top: string;
12
12
  transform: string;
13
13
  }
14
- declare class TextDataScannerTextStyle implements TextStyleConfiguration {
14
+ export declare class TextDataScannerTextStyle implements TextStyleConfiguration {
15
15
  color: string;
16
16
  size: string;
17
17
  weight: number;
@@ -33,4 +33,3 @@ export declare class TextDataScannerConfiguration extends ScannerConfiguration {
33
33
  onTextDetected?: TextDetectionCallback;
34
34
  static fromJson(json: any): TextDataScannerConfiguration;
35
35
  }
36
- export {};
@@ -1,10 +1,27 @@
1
1
  export declare class MediaError extends Error {
2
- name: MediaErrorType;
2
+ static readonly PERMISSION_STATE: {
3
+ GRANTED: string;
4
+ DENIED: string;
5
+ PROMPT: string;
6
+ UNKNOWN: string;
7
+ };
8
+ static readonly MESSAGE: {
9
+ DEVICES_UNDEFINED: string;
10
+ DEVICE_NOT_FOUND: string;
11
+ ENUMERATE_FAILED: string;
12
+ PERMISSION_DENIED: string;
13
+ UNKNOWN: string;
14
+ };
15
+ name: string;
16
+ webApiError?: string;
3
17
  private constructor();
4
- static notAvailable(message?: string): MediaError;
5
- static permissionError(message?: string): MediaError;
6
- static unsupportedMediaDevices(message?: string): MediaError;
7
- static unsupportedOperationError(message?: string): MediaError;
8
- static unknownError(message?: string): MediaError;
18
+ static mediaDevicesUndefined(): MediaError;
19
+ static enumerateDevicesFailed(): MediaError;
20
+ static mediaDeviceNotFound(webApiError?: string): MediaError;
21
+ static permissionDenied(webApiError?: string): MediaError;
22
+ static unknown(webApiError?: string): MediaError;
23
+ private static permissionState;
24
+ static tryCheckPermission(): Promise<void>;
25
+ static hasPermission(): boolean;
26
+ static hasCheckedPermission(): boolean;
9
27
  }
10
- export declare type MediaErrorType = 'MediaNotAvailableError' | 'MediaPermissionError' | 'UnsupportedMediaDevicesError' | 'UnsupportedOperationError' | 'UnknownError';
@@ -1,3 +1,6 @@
1
1
  export declare type BinarizationFilter = 'binarized' | 'otsuBinarization' | 'pureBinarized' | 'lowLightBinarization' | 'lowLightBinarization2' | 'deepBinarization';
2
2
  export declare type ColorFilter = 'color' | 'gray' | 'colorDocument' | 'blackAndWhite' | 'edgeHighlight';
3
+ /**
4
+ * @deprecated Use the new ImageProcessor API instead (see {@link ScanbotSDK.createImageProcessor}).
5
+ */
3
6
  export declare type ImageFilter = BinarizationFilter | ColorFilter;
@@ -36,5 +36,6 @@ export declare class MrzResult {
36
36
  languageCode?: MrzField;
37
37
  versionNumber?: MrzField;
38
38
  checkDigits?: MrzCheckDigits;
39
+ verificationSuccessful?: boolean;
39
40
  static fromWorker(inputs: any): MrzResult;
40
41
  }
@@ -3,13 +3,14 @@ import { ScanbotCameraProps, ScanbotCameraState, ScannerView } from "./scanner-v
3
3
  import { MrzScannerConfiguration } from "./model/configuration/mrz-scanner-configuration";
4
4
  import { ViewFinder } from "./view/view-finder";
5
5
  import SimpleMrzRecognizer from "./service/simple-mrz-recognizer";
6
+ import { IMrzScannerHandle } from "./interfaces/i-mrz-scanner-handle";
6
7
  export declare class MrzScannerProps extends ScanbotCameraProps {
7
8
  mrzRecognizer: SimpleMrzRecognizer;
8
9
  }
9
10
  export declare class MrzScannerState extends ScanbotCameraState {
10
11
  isFinderVisible?: boolean;
11
12
  }
12
- export default class MrzScannerView extends ScannerView<MrzScannerProps, MrzScannerState> {
13
+ export default class MrzScannerView extends ScannerView<MrzScannerProps, MrzScannerState> implements IMrzScannerHandle {
13
14
  static FRAME_RESOLUTION: number;
14
15
  finder?: ViewFinder;
15
16
  shouldComputeSize: boolean;
@@ -25,10 +25,14 @@ import { VINScannerConfiguration } from "./model/configuration/vin-scanner-confi
25
25
  import { ITextDataScannerHandle } from "./interfaces/i-text-data-scanner-handle";
26
26
  import DocumentQualityAnalyzerConfiguration from "./model/configuration/document-quality-analyzer-configuration";
27
27
  import DocumentQualityAnalyzer from "./service/document-quality-analyzer";
28
+ import { ImageProcessor } from "./service/image-processor";
29
+ import * as imageFilters from "./core/compiled/ParametricFilters";
28
30
  export default class ScanbotSDK {
31
+ /** @internal */
29
32
  bridge: WorkerBridge;
30
- initialized: boolean;
31
- static defaultEnginePath: string;
33
+ private initialized;
34
+ private static defaultEnginePath;
35
+ /** @internal */
32
36
  static instance: ScanbotSDK;
33
37
  static initialize(options: InitializationOptions): Promise<ScanbotSDK>;
34
38
  /**
@@ -44,16 +48,21 @@ export default class ScanbotSDK {
44
48
  * Image Operations
45
49
  */
46
50
  toDataUrl(imageBuffer: ArrayBuffer): Promise<string>;
51
+ /**
52
+ * @deprecated Use the new ImageProcessor API instead (see {@link createImageProcessor}).
53
+ */
47
54
  applyFilter(imageBuffer: ArrayBuffer, filterType: ImageFilter): Promise<ArrayBuffer>;
48
55
  rotateImageCcw(imageBuffer: ArrayBuffer, rotations: number): Promise<ArrayBuffer>;
49
56
  cropAndRotateImageCcw(imageBuffer: ArrayBuffer, polygon: Polygon, rotations: number): Promise<any>;
50
57
  detectDocument(imageBuffer: ArrayBuffer, acceptedAngleScore?: number, acceptedSizeScore?: number): Promise<ContourDetectionResult>;
58
+ detectAndCropDocument(imageBuffer: ArrayBuffer): Promise<ContourDetectionResult>;
51
59
  detectBarcodes(base64: string, engineMode?: EngineMode, barcodeFormats?: BarcodeFormat[], returnBarcodeImage?: boolean): Promise<BarcodeResult>;
52
60
  createSimpleMRZRecognizer(): Promise<SimpleMrzRecognizer>;
53
61
  createOcrEngine(options?: {
54
62
  mode: string;
55
63
  }): Promise<OcrEngine>;
56
64
  createDocumentQualityAnalyzer(config?: DocumentQualityAnalyzerConfiguration): Promise<DocumentQualityAnalyzer>;
65
+ createImageProcessor(imageBuffer: ArrayBuffer): Promise<ImageProcessor>;
57
66
  /**
58
67
  * Misc. Features
59
68
  */
@@ -66,4 +75,5 @@ export default class ScanbotSDK {
66
75
  release(object: any, source?: string): Promise<void>;
67
76
  private licenseCheck;
68
77
  private createGenericTextLineScanner;
78
+ static imageFilters: typeof imageFilters;
69
79
  }