capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
134 lines (133 loc) • 4.5 kB
TypeScript
import type { DocumentDetectionStatus } from '../core/document_scanner/DocumentScannerTypes';
import type { PageImageSource } from '../core/document_scanner/PageImageSource';
import type { ParametricFilter } from '../core/image_processing/ParametricFilters';
/**
* Standard size object
*/
export interface Size {
/**
* Width parameter
*/
width: number;
/**
* Height parameter
*/
height: number;
}
/**
* Barcode scanner engine mode
*/
export type BarcodeOverlayTextFormat =
/** Show only barcode overlay frame. */
'NONE'
/** Show barcode value with extention. */
| 'CODE'
/** Show barcode value with barcode format. */
| 'CODE_AND_TYPE';
/**
* Defines a range for zooming
*/
export interface ZoomRange {
/**
* The minimum zoom scale. Defaults to 1.0.
*/
minZoom: number;
/**
* The maximum zoom scale. Defaults to 12.0.
*/
maxZoom: number;
}
/**
* The image filter types.
*/
export type ImageFilterType =
/** Passthrough filter. Does not alter the image. */
'NONE'
/** Optimizes colors, contrast and brightness. Usecase: photos. */
| 'COLOR'
/** Standard grayscale filter. Creates a grayscaled 8-bit image and optimizes contrast and dynamic range. */
| 'GRAYSCALE'
/** Standard binarization filter with contrast optimization. Creates a grayscaled 8-bit image with mostly black or white pixels. Usecase: Preparation for optical character recognition. */
| 'BINARIZED'
/** Fixes white-balance and cleans up the background. Usecase: images of paper documents. */
| 'COLOR_DOCUMENT'
/** A filter for binarizing an image. Creates an 8-bit image with pixel values set to eiter 0 or 255. Usecase: Preparation for optical character recognition. */
| 'PURE_BINARIZED'
/** Cleans up the background and tries to preserve photos within the image. Usecase: magazine pages, flyers. */
| 'BACKGROUND_CLEAN'
/** Black and white filter with background cleaning. Creates a grayscaled 8-bit image with mostly black or white pixels. Usecase: Textual documents or documents with black and white illustrations. */
| 'BLACK_AND_WHITE'
/** A filter for black and white conversion using OTSU binarization. */
| 'OTSU_BINARIZATION'
/** A filter for black and white conversion primary used for low-contrast documents. */
| 'DEEP_BINARIZATION'
/** A filter that enhances edges in low-contrast documents. */
| 'EDGE_HIGHLIGHT'
/** Binarization filter primary inteded to use on low-contrast documents with heavy shadows. */
| 'LOW_LIGHT_BINARIZATION'
/** Binarization filter primary intended to use on low-contrast documents with heavy shadows. */
| 'LOW_LIGHT_BINARIZATION_2'
/** Standard grayscale filter. Creates a grayscaled 8-bit image. */
| 'PURE_GRAY';
/**
* SDK Page
*/
export interface Page {
/**
* A string identifying the page in the internal page file storage
*/
pageId: string;
/**
* The page's cropping polygon as calculated by a document detection operation or as set by the cropping UI. Modifying the polygon will change the polygon as shown in the cropping UI but will not automatically re-crop the original image
*/
polygon: PolygonPoint[];
/**
* The document detection result status for the operation that produced the page
*/
detectionResult: DocumentDetectionStatus;
/**
* The image source
*/
pageImageSource: PageImageSource;
/**
* The Image Filter that was applied on the page image. @deprecated Use **parametricFilters** instead.
*/
filter: ImageFilterType;
/**
* The Image Filters that are applied on the page image
*/
parametricFilters?: ParametricFilter[];
/**
* The value that was set for `documentImageSizeLimit`, which limits the maximum size of the document image.
*/
documentImageSizeLimit?: Size;
/**
* File URI of the original image
*/
originalImageFileUri: string;
/**
* File URI of the cropped document image (if document detection was successful)
*/
documentImageFileUri?: string;
/**
* File URI of a screen-sized preview of the original image
*/
originalPreviewImageFileUri: string;
/**
* File URI of a screen-sized preview of the document image (if document detection was successful)
*/
documentPreviewImageFileUri?: string;
}
/**
* Polygon Point
*/
export interface PolygonPoint {
/**
* Polygon point X
*/
x: number;
/**
* Polygon point Y
*/
y: number;
}