dynamsoft-barcode-reader-bundle
Version:
Dynamsoft Barcode Reader JS is a recognition SDK which enables you to embed barcode reading functionality in your web, desktop, and mobile applications. With a few lines of JavaScript code, you can develop a robust application to scan a linear barcode, QR
1,165 lines (1,100 loc) • 240 kB
TypeScript
declare enum EnumBufferOverflowProtectionMode {
/** New images are blocked when the buffer is full.*/
BOPM_BLOCK = 0,
/** New images are appended at the end, and oldest images are pushed out from the beginning if the buffer is full.*/
BOPM_UPDATE = 1
}
declare enum EnumCapturedResultItemType {
CRIT_ORIGINAL_IMAGE = 1,
CRIT_BARCODE = 2,
CRIT_TEXT_LINE = 4,
CRIT_DETECTED_QUAD = 8,
CRIT_DESKEWED_IMAGE = 16,
CRIT_PARSED_RESULT = 32,
CRIT_ENHANCED_IMAGE = 64
}
declare enum EnumCornerType {
CT_NORMAL_INTERSECTED = 0,
CT_T_INTERSECTED = 1,
CT_CROSS_INTERSECTED = 2,
CT_NOT_INTERSECTED = 3
}
/**
* `ErrorCode` enumerates the specific error codes that the SDK may return, providing a systematic way to identify and handle errors encountered during its operation.
*/
declare enum EnumErrorCode {
/** Operation completed successfully. */
EC_OK = 0,
/** An unspecified error occurred. */
EC_UNKNOWN = -10000,
/** The system does not have enough memory to perform the requested operation. */
EC_NO_MEMORY = -10001,
/** A null pointer was encountered where a valid pointer was required. */
EC_NULL_POINTER = -10002,
/** The provided license is not valid. */
EC_LICENSE_INVALID = -10003,
/** The provided license has expired. */
EC_LICENSE_EXPIRED = -10004,
/** The specified file could not be found. */
EC_FILE_NOT_FOUND = -10005,
/** The file type is not supported for processing. */
EC_FILE_TYPE_NOT_SUPPORTED = -10006,
/** The image's bits per pixel (BPP) is not supported. */
EC_BPP_NOT_SUPPORTED = -10007,
/** The specified index is out of the valid range. */
EC_INDEX_INVALID = -10008,
/** The specified custom region value is invalid or out of range. */
EC_CUSTOM_REGION_INVALID = -10010,
/** Failed to read the image due to an error in accessing or interpreting the image data. */
EC_IMAGE_READ_FAILED = -10012,
/** Failed to read a TIFF image, possibly due to corruption or unsupported format. */
EC_TIFF_READ_FAILED = -10013,
/** The provided DIB (Device-Independent Bitmaps) buffer is invalid or corrupted. */
EC_DIB_BUFFER_INVALID = -10018,
/** Failed to read a PDF image, possibly due to corruption or unsupported format. */
EC_PDF_READ_FAILED = -10021,
/** Required PDF processing DLL is missing. */
EC_PDF_DLL_MISSING = -10022,
/** The specified page number is invalid or out of bounds for the document. */
EC_PAGE_NUMBER_INVALID = -10023,
/** The specified custom size is invalid or not supported. */
EC_CUSTOM_SIZE_INVALID = -10024,
/** The operation timed out. */
EC_TIMEOUT = -10026,
/** Failed to parse JSON input. */
EC_JSON_PARSE_FAILED = -10030,
/** The JSON type is invalid for the expected context. */
EC_JSON_TYPE_INVALID = -10031,
/** The JSON key is invalid or unrecognized in the current context. */
EC_JSON_KEY_INVALID = -10032,
/** The JSON value is invalid for the specified key. */
EC_JSON_VALUE_INVALID = -10033,
/** The required "Name" key is missing in the JSON data. */
EC_JSON_NAME_KEY_MISSING = -10034,
/** The value of the "Name" key is duplicated and conflicts with existing data. */
EC_JSON_NAME_VALUE_DUPLICATED = -10035,
/** The template name is invalid or does not match any known template. */
EC_TEMPLATE_NAME_INVALID = -10036,
/** The reference made by the "Name" key is invalid or points to nonexistent data. */
EC_JSON_NAME_REFERENCE_INVALID = -10037,
/** The parameter value provided is invalid or out of the expected range. */
EC_PARAMETER_VALUE_INVALID = -10038,
/** The domain of the current site does not match the domain bound to the current product key. */
EC_DOMAIN_NOT_MATCH = -10039,
/** The license key does not match the license content. */
EC_LICENSE_KEY_NOT_MATCH = -10043,
/** Error setting the mode's argument, indicating invalid or incompatible arguments. */
EC_SET_MODE_ARGUMENT_ERROR = -10051,
/** Failed to retrieve the mode's argument, possibly due to invalid state or configuration. */
EC_GET_MODE_ARGUMENT_ERROR = -10055,
/** The Intermediate Result Types (IRT) license is invalid or not present. */
EC_IRT_LICENSE_INVALID = -10056,
/** Failed to save the file, possibly due to permissions, space, or an invalid path. */
EC_FILE_SAVE_FAILED = -10058,
/** The specified stage type is invalid or not supported in the current context. */
EC_STAGE_TYPE_INVALID = -10059,
/** The specified image orientation is invalid or not supported. */
EC_IMAGE_ORIENTATION_INVALID = -10060,
/** Failed to convert complex template to simplified settings, indicating a configuration or compatibility issue. */
EC_CONVERT_COMPLEX_TEMPLATE_ERROR = -10061,
/** Rejecting function call while capturing is in progress, to prevent conflicts or data corruption. */
EC_CALL_REJECTED_WHEN_CAPTURING = -10062,
/** The specified image source was not found, indicating a missing or inaccessible input source. */
EC_NO_IMAGE_SOURCE = -10063,
/** Failed to read the directory, possibly due to permissions, non-existence, or other access issues. */
EC_READ_DIRECTORY_FAILED = -10064,
/** A required module (e.g., DynamsoftBarcodeReader, DynamsoftLabelRecognizer) was not found. */
EC_MODULE_NOT_FOUND = -10065,
EC_MULTI_PAGES_NOT_SUPPORTED = -10066,
/** Indicates an attempt to write to a file that already exists, with overwriting explicitly disabled. This error suggests the need for either enabling overwriting or ensuring unique file names to avoid conflicts. */
EC_FILE_ALREADY_EXISTS = -10067,
/** The specified file path does not exist and could not be created. This error could be due to insufficient permissions, a read-only filesystem, or other environmental constraints preventing file creation. */
EC_CREATE_FILE_FAILED = -10068,
/** The input ImageData object contains invalid parameters. This could be due to incorrect data types, out-of-range values, or improperly formatted data being passed to a function expecting ImageData. */
EC_IMGAE_DATA_INVALID = -10069,
/** The size of the input image does not meet the requirements. */
EC_IMAGE_SIZE_NOT_MATCH = -10070,
/** The pixel format of the input image does not meet the requirements. */
EC_IMAGE_PIXEL_FORMAT_NOT_MATCH = -10071,
/** The section level result is irreplaceable. */
EC_SECTION_LEVEL_RESULT_IRREPLACEABLE = -10072,
/** Incorrect axis definition. */
EC_AXIS_DEFINITION_INCORRECT = -10073,
/**The result is not replaceable due to type mismatch*/
EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE = -10074,
/**Failed to load the PDF library.*/
EC_PDF_LIBRARY_LOAD_FAILED = -10075,
EC_UNSUPPORTED_JSON_KEY_WARNING = -10077,
/**Model file is not found*/
EC_MODEL_FILE_NOT_FOUND = -10078,
/**[PDF] No license found.*/
EC_PDF_LICENSE_NOT_FOUND = -10079,
/**The rectangle is invalid.*/
EC_RECT_INVALID = -10080,
EC_TEMPLATE_VERSION_INCOMPATIBLE = -10081,
/** Indicates no license is available or the license is not set. */
EC_NO_LICENSE = -20000,
/** Encountered failures while attempting to read or write to the license buffer. */
EC_LICENSE_BUFFER_FAILED = -20002,
/** Synchronization with the license server failed, possibly due to network issues or server unavailability. */
EC_LICENSE_SYNC_FAILED = -20003,
/** The device attempting to use the license does not match the device specified in the license buffer. */
EC_DEVICE_NOT_MATCH = -20004,
/** Binding the device to the license failed, indicating possible issues with the license or device identifier. */
EC_BIND_DEVICE_FAILED = -20005,
/** The number of instances using the license exceeds the limit allowed by the license terms. */
EC_INSTANCE_COUNT_OVER_LIMIT = -20008,
/** Indicates the license in use is a trial version with limited functionality or usage time. */
EC_TRIAL_LICENSE = -20010,
/**The license is not valid for current version*/
EC_LICENSE_VERSION_NOT_MATCH = -20011,
/**Online license validation failed due to network issues.Using cached license information for validation.*/
EC_LICENSE_CACHE_USED = -20012,
EC_LICENSE_AUTH_QUOTA_EXCEEDED = -20013,
/**License restriction: the number of results has exceeded the allowed limit.*/
EC_LICENSE_RESULTS_LIMIT_EXCEEDED = -20014,
/** The specified barcode format is invalid or unsupported. */
EC_BARCODE_FORMAT_INVALID = -30009,
/** The specified custom module size for barcode generation is invalid or outside acceptable limits. */
EC_CUSTOM_MODULESIZE_INVALID = -30025,
/**There is a conflict in the layout of TextLineGroup. */
EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT = -40101,
/**There is a conflict in the regex of TextLineGroup. */
EC_TEXT_LINE_GROUP_REGEX_CONFLICT = -40102,
/** The specified quadrilateral is invalid, potentially due to incorrect points or an unprocessable shape. */
EC_QUADRILATERAL_INVALID = -50057,
/** The license for generating or processing panoramas is invalid or missing. */
EC_PANORAMA_LICENSE_INVALID = -70060,
/** The specified resource path does not exist, indicating a missing directory or incorrect path specification. */
EC_RESOURCE_PATH_NOT_EXIST = -90001,
/** Failed to load the specified resource, which might be due to missing files, access rights, or other issues preventing loading. */
EC_RESOURCE_LOAD_FAILED = -90002,
/** The code specification required for processing was not found, indicating a missing or incorrect specification. */
EC_CODE_SPECIFICATION_NOT_FOUND = -90003,
/** The full code string provided is empty, indicating no data was provided for processing. */
EC_FULL_CODE_EMPTY = -90004,
/** Preprocessing the full code string failed, possibly due to invalid format, corruption, or unsupported features. */
EC_FULL_CODE_PREPROCESS_FAILED = -90005,
/**The license is initialized successfully but detected invalid content in your key.*/
EC_LICENSE_WARNING = -10076,
/** [Barcode Reader] No license found.*/
EC_BARCODE_READER_LICENSE_NOT_FOUND = -30063,
/**[Label Recognizer] No license found.*/
EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND = -40103,
/**[Document Normalizer] No license found.*/
EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND = -50058,
/**[Code Parser] No license found.*/
EC_CODE_PARSER_LICENSE_NOT_FOUND = -90012
}
declare enum EnumGrayscaleEnhancementMode {
/**
* Disables any grayscale image preprocessing. Selecting this mode skips the preprocessing step, passing the image through to subsequent operations without modification.
*/
GEM_SKIP = 0,
/**
* Automatic selection of grayscale enhancement mode. Currently, not supported. Future implementations may automatically choose the most suitable enhancement based on image analysis.
*/
GEM_AUTO = 1,
/**
* Uses the original, unprocessed image for subsequent operations. This mode is selected when no specific grayscale enhancement is required, maintaining the image in its natural state.
*/
GEM_GENERAL = 2,
/**
* Applies a grayscale equalization algorithm to the image, enhancing contrast and detail in gray level.
* Suitable for images with poor contrast. Refer to Image Processing Mode (IPM) documentation for argument settings.
*/
GEM_GRAY_EQUALIZE = 4,
/**
* Implements a grayscale smoothing algorithm to reduce noise and smooth the image.
* This can be beneficial for images with high levels of grain or noise. Check IPM documentation for configuration options.
*/
GEM_GRAY_SMOOTH = 8,
/**
* Enhances the image by applying both sharpening and smoothing algorithms. This mode aims to increase clarity and detail while reducing noise, offering a balanced approach to image preprocessing.
* Refer to the IPM section for available argument settings.
*/
GEM_SHARPEN_SMOOTH = 16,
/**
* Reserved for future use. This setting is part of the grayscale enhancement mode but is currently not defined for public use. It's reserved for internal development or future enhancements.
*/
GEM_REV = -2147483648,
/**
* Placeholder value with no functional meaning.
*/
GEM_END = -1
}
declare enum EnumGrayscaleTransformationMode {
/**
* Bypasses grayscale transformation, leaving the image in its current state without any modification to its grayscale values.
* This mode is selected when no alteration of the grayscale data is desired, passing the image through to subsequent operations without modification.
*/
GTM_SKIP = 0,
/**
* Applies an inversion to the grayscale values of the image, effectively transforming light elements to dark and vice versa.
* This mode is particularly useful for images with light text on dark backgrounds, enhancing visibility for further processing.
*/
GTM_INVERTED = 1,
/**
* Maintains the original grayscale values of the image without any transformation. This mode is suited for images with dark elements on light backgrounds, ensuring the natural contrast and detail are preserved for subsequent analysis.
*/
GTM_ORIGINAL = 2,
/**
* Delegates the choice of grayscale transformation to the library's algorithm, which automatically determines the most suitable transformation based on the image's characteristics. This mode is beneficial when the optimal transformation is not known in advance or varies across different images.
*/
GTM_AUTO = 4,
/**
* Reserved for future expansion or internal use. This placeholder indicates a grayscale transformation mode that is not currently defined for public use but may be utilized for upcoming features or reserved for specific, undocumented adjustments.
*/
GTM_REV = -2147483648,
/**
* Placeholder value with no functional meaning.
*/
GTM_END = -1
}
declare enum EnumImagePixelFormat {
/** Binary format representing images with two colors: 0 for black and 1 for white. */
IPF_BINARY = 0,
/** Inverted binary format with 0 for white and 1 for black. */
IPF_BINARYINVERTED = 1,
/** Grayscale format with 8 bits per pixel, allowing for 256 shades of gray. */
IPF_GRAYSCALED = 2,
/** NV21 format, a YUV planar format used commonly in camera preview and video encoding, with 8-bit Y followed by interleaved V/U values. */
IPF_NV21 = 3,
/** RGB format with 5 bits for red and blue, and 6 bits for green, stored in a 16-bit structure. */
IPF_RGB_565 = 4,
/** Similar to RGB_565 but with 5 bits for each color channel, providing uniform color depth across channels in a 16-bit structure. */
IPF_RGB_555 = 5,
/** Standard 24-bit RGB format with 8 bits per channel. */
IPF_RGB_888 = 6,
/** 32-bit ARGB format with 8 bits per channel, including an alpha channel for transparency. */
IPF_ARGB_8888 = 7,
/** High-depth 48-bit RGB format with 16 bits per channel. */
IPF_RGB_161616 = 8,
/** 64-bit ARGB format with 16 bits per channel, including an alpha channel. */
IPF_ARGB_16161616 = 9,
/** 32-bit ABGR format with 8 bits per channel, storing color information in reverse order of ARGB_8888. */
IPF_ABGR_8888 = 10,
/** 64-bit ABGR format with 16 bits per channel, providing high color depth and transparency in the reverse order of ARGB_16161616. */
IPF_ABGR_16161616 = 11,
/** 24-bit BGR format with 8 bits per channel, where the blue channel is stored first. */
IPF_BGR_888 = 12,
/** Binary format with 8 bits per pixel, enabling more detailed binary images by allowing for antialiasing or other binary representations. */
IPF_BINARY_8 = 13,
/** NV12 format, similar to NV21 but with the U and V color components swapped. */
IPF_NV12 = 14,
/** Inverted binary format with 8 bits per pixel. */
IPF_BINARY_8_INVERTED = 15
}
declare enum EnumImageTagType {
/** Represents an image that has been sourced from a static file. */
ITT_FILE_IMAGE = 0,
/** Indicates that the image is a frame extracted from a video stream. */
ITT_VIDEO_FRAME = 1
}
declare enum EnumPDFReadingMode {
/** Outputs vector data found in the PDFs.*/
PDFRM_VECTOR = 1,
/** The default value.
* Outputs raster data found in the PDFs.
* Depending on the argument Resolution,
* the SDK may rasterize the PDF pages.
* Check the template for available argument settings.*/
PDFRM_RASTER = 2,
PDFRM_REV = -2147483648
}
declare enum EnumRasterDataSource {
/** Specifies the target type for reading a PDF, where the SDK rasterizes the pages of the PDF into images. */
RDS_RASTERIZED_PAGES = 0,
/** Specifies the target type for reading a PDF, where the SDK extracts images from the PDF pages. */
RDS_EXTRACTED_IMAGES = 1
}
declare enum EnumColourChannelUsageType {
/**
* Automatically determines how color channels are used.
* This option allows the SDK to choose the most appropriate channel usage mode dynamically.
*/
CCUT_AUTO = 0,
/**
* Utilizes all available color channels in the image for processing.
* This mode is ideal for scenarios where full color information is necessary for accurate analysis or processing.
*/
CCUT_FULL_CHANNEL = 1,
/**
* Processes images using only the Y (luminance) channel, specifically in NV21 format images.
* This mode is useful for operations that require analyzing the brightness or intensity of the image while ignoring color information.
*/
CCUT_Y_CHANNEL_ONLY = 2,
/**
* Uses only the red color channel for processing in RGB images.
* This mode is useful for tasks that require analysis or manipulation based on the red component of the image.
*/
CCUT_RGB_R_CHANNEL_ONLY = 3,
/**
* Uses only the green color channel for processing in RGB images.
* This mode is useful for tasks where the green component is most relevant.
*/
CCUT_RGB_G_CHANNEL_ONLY = 4,
/**
* Uses only the blue color channel for processing in RGB images.
* This mode is useful for tasks where the blue component is of particular interest.
*/
CCUT_RGB_B_CHANNEL_ONLY = 5
}
declare enum EnumCrossVerificationStatus {
/** The cross verification has not been performed yet. */
CVS_NOT_VERIFIED = 0,
/** The cross verification has been passed successfully. */
CVS_PASSED = 1,
/** The cross verification has failed. */
CVS_FAILED = 2
}
declare const EnumIntermediateResultUnitType: {
/** No intermediate result. */
IRUT_NULL: bigint;
/** A full-color image. */
IRUT_COLOUR_IMAGE: bigint;
/** A color image that has been scaled down for efficiency. */
IRUT_SCALED_COLOUR_IMAGE: bigint;
/** A grayscale image derived from the original input. */
IRUT_GRAYSCALE_IMAGE: bigint;
/** A grayscale image that has undergone transformation. */
IRUT_TRANSOFORMED_GRAYSCALE_IMAGE: bigint;
/** A grayscale image enhanced for further processing. */
IRUT_ENHANCED_GRAYSCALE_IMAGE: bigint;
/** Regions pre-detected as potentially relevant for further analysis. */
IRUT_PREDETECTED_REGIONS: bigint;
/** A binary (black and white) image. */
IRUT_BINARY_IMAGE: bigint;
/** Results from detecting textures within the image. */
IRUT_TEXTURE_DETECTION_RESULT: bigint;
/** A grayscale image with textures removed to enhance subject details like text or barcodes. */
IRUT_TEXTURE_REMOVED_GRAYSCALE_IMAGE: bigint;
/** A binary image with textures removed), useful for clear detection of subjects without background noise. */
IRUT_TEXTURE_REMOVED_BINARY_IMAGE: bigint;
/** Detected contours within the image), which can help in identifying shapes and objects. */
IRUT_CONTOURS: bigint;
/** Detected line segments), useful in structural analysis of the image content. */
IRUT_LINE_SEGMENTS: bigint;
/** Identified text zones), indicating areas with potential textual content. */
IRUT_TEXT_ZONES: bigint;
/** A binary image with text regions removed. */
IRUT_TEXT_REMOVED_BINARY_IMAGE: bigint;
/** Zones identified as potential barcode areas), aiding in focused barcode detection. */
IRUT_CANDIDATE_BARCODE_ZONES: bigint;
/** Barcodes that have been localized but not yet decoded. */
IRUT_LOCALIZED_BARCODES: bigint;
/** Barcode images scaled up for improved readability or decoding accuracy. */
IRUT_SCALED_BARCODE_IMAGE: bigint;
/** Images of barcodes processed to resist deformation and improve decoding success. */
IRUT_DEFORMATION_RESISTED_BARCODE_IMAGE: bigint;
/** Barcode images that have been complemented. */
IRUT_COMPLEMENTED_BARCODE_IMAGE: bigint;
/** Successfully decoded barcodes. */
IRUT_DECODED_BARCODES: bigint;
/** Detected long lines. */
IRUT_LONG_LINES: bigint;
/** Detected corners within the image. */
IRUT_CORNERS: bigint;
/** Candidate edges identified as potential components of quadrilaterals. */
IRUT_CANDIDATE_QUAD_EDGES: bigint;
/** Successfully detected quadrilaterals. */
IRUT_DETECTED_QUADS: bigint;
/** Text lines that have been localized in preparation for recognition. */
IRUT_LOCALIZED_TEXT_LINES: bigint;
/** Successfully recognized text lines. */
IRUT_RECOGNIZED_TEXT_LINES: bigint;
/** Successfully normalized images. */
IRUT_DESKEWED_IMAGE: bigint;
/** Successfully detected short lines. */
IRUT_SHORT_LINES: bigint;
IRUT_RAW_TEXT_LINES: bigint;
/** Detected logic lines. */
IRUT_LOGIC_LINES: bigint;
IRUT_ENHANCED_IMAGE: bigint;
/** A mask to select all types of intermediate results. */
IRUT_ALL: bigint;
};
type EnumIntermediateResultUnitType = bigint;
declare enum EnumRegionObjectElementType {
/** Corresponds to the `PredetectedRegionElement` subclass, representing areas within the image identified as potentially significant for further analysis before detailed processing. */
ROET_PREDETECTED_REGION = 0,
/** Corresponds to the `LocalizedBarcodeElement` subclass, indicating areas where barcodes have been localized within the image.*/
ROET_LOCALIZED_BARCODE = 1,
/** Corresponds to the `DecodedBarcodeElement` subclass, signifying barcodes that have not only been localized but also successfully decoded. */
ROET_DECODED_BARCODE = 2,
/** Corresponds to the `LocalizedTextLineElement` subclass, indicating lines of text that have been localized within the image. */
ROET_LOCALIZED_TEXT_LINE = 3,
/** Corresponds to the `RecognizedTextLineElement` subclass, referring to text lines that have been recognized. */
ROET_RECOGNIZED_TEXT_LINE = 4,
/** Corresponds to the `DetectedQuadElement` subclass, representing quadrilateral shapes detected within the image. */
ROET_DETECTED_QUAD = 5,
/** Corresponds to the `DeskewedImageElement` subclass, referring to images that have been deskewed. */
ROET_DESKEWED_IMAGE = 6,
/** Corresponds to the `SourceImageElement` subclass. */
ROET_SOURCE_IMAGE = 7,
/** Corresponds to the `TargetROIElement` subclass. */
ROET_TARGET_ROI = 8,
/** Corresponds to the `EnhancedImageElement` subclass, indicating images that have undergone enhancement for better clarity or detail, specifically in the context of enhanced image processing. */
ROET_ENHANCED_IMAGE = 9
}
declare enum EnumSectionType {
/** Indicates that no specific section type has been specified. */
ST_NULL = 0,
/** Corresponds to results generated in the "region prediction" section. */
ST_REGION_PREDETECTION = 1,
/** Corresponds to results generated in the "barcode localization" section. */
ST_BARCODE_LOCALIZATION = 2,
/** Corresponds to results generated in the "barcode decoding" section. */
ST_BARCODE_DECODING = 3,
/** Corresponds to results generated in the "text line localization" section. */
ST_TEXT_LINE_LOCALIZATION = 4,
/** Corresponds to results generated in the "text line recognition" section. */
ST_TEXT_LINE_RECOGNITION = 5,
/** Corresponds to results generated in the "document detection" section. */
ST_DOCUMENT_DETECTION = 6,
/** Corresponds to results generated in the "document deskewing" section. */
ST_DOCUMENT_DESKEWING = 7,
/** Corresponds to results generated in the "document enhancement" section. */
ST_IMAGE_ENHANCEMENT = 8
}
declare enum EnumImageFileFormat {
/** JPEG image format. */
IFF_JPEG = 0,
/** PNG image format. */
IFF_PNG = 1,
/** BMP (Bitmap) image format. */
IFF_BMP = 2,
/** PDF (Portable Document Format) format. */
IFF_PDF = 3
}
declare enum EnumImageCaptureDistanceMode {
ICDM_NEAR = 0,
ICDM_FAR = 1
}
declare enum EnumModuleName {
MN_DYNAMSOFT_CAPTURE_VISION_ROUTER = "cvr",
MN_DYNAMSOFT_CORE = "core",
MN_DYNAMSOFT_LICENSE = "license",
MN_DYNAMSOFT_IMAGE_PROCESSING = "dip",
MN_DYNAMSOFT_UTILITY = "utility",
MN_DYNAMSOFT_BARCODE_READER = "dbr",
MN_DYNAMSOFT_DOCUMENT_NORMALIZER = "ddn",
MN_DYNAMSOFT_LABEL_RECOGNIZER = "dlr",
MN_DYNAMSOFT_CAPTURE_VISION_DATA = "dcvData",
MN_DYNAMSOFT_NEURAL_NETWORK = "dnn",
MN_DYNAMSOFT_CODE_PARSER = "dcp",
MN_DYNAMSOFT_CAMERA_ENHANCER = "dce",
MN_DYNAMSOFT_CAPTURE_VISION_STD = "std"
}
declare enum EnumTransformMatrixType {
/**Represents a transformation matrix that converts coordinates from the local image to the original image.*/
TMT_LOCAL_TO_ORIGINAL_IMAGE = 0,
/**Represents a transformation matrix that converts coordinates from the original image to the local image.*/
TMT_ORIGINAL_TO_LOCAL_IMAGE = 1,
/**Represents a transformation matrix that converts coordinates from the local image to the section image.*/
TMT_LOCAL_TO_SECTION_IMAGE = 2,
/**Represents a transformation matrix that converts coordinates from the section image to the local image.*/
TMT_SECTION_TO_LOCAL_IMAGE = 3
}
type WorkerAutoResources = {
[key in EnumModuleName]?: {
js?: boolean;
wasm?: boolean;
deps?: EnumModuleName[];
};
};
interface PostMessageBody {
needLoadCore?: boolean;
bLog?: boolean;
bd?: boolean;
dm?: string;
value?: boolean;
count?: number;
engineResourcePaths?: EngineResourcePaths;
autoResources?: WorkerAutoResources;
names?: string[];
wasmLoadOptions: WasmLoadOptions;
_bundleEnv?: "DCV" | "DBR";
}
type PathInfo = {
version: string;
path: string;
isInternal?: boolean;
};
type DwtInfo = {
resourcesPath?: string;
serviceInstallerLocation?: string;
};
interface EngineResourcePaths {
"rootDirectory"?: string;
"std"?: string | PathInfo;
"dip"?: string | PathInfo;
"dnn"?: string | PathInfo;
"core"?: string | PathInfo;
"license"?: string | PathInfo;
"cvr"?: string | PathInfo;
"utility"?: string | PathInfo;
"dbr"?: string | PathInfo;
"dlr"?: string | PathInfo;
"ddn"?: string | PathInfo;
"dcp"?: string | PathInfo;
"dce"?: string | PathInfo;
"dcvData"?: string | PathInfo;
"ddv"?: string | PathInfo;
"dwt"?: string | DwtInfo;
"dbrBundle"?: string | PathInfo;
"dcvBundle"?: string | PathInfo;
}
interface InnerVersions {
[key: string]: {
worker?: string;
wasm?: string;
};
}
interface WasmVersions {
"DIP"?: string;
"DNN"?: string;
"CORE"?: string;
"LICENSE"?: string;
"CVR"?: string;
"UTILITY"?: string;
"DBR"?: string;
"DLR"?: string;
"DDN"?: string;
"DCP"?: string;
}
interface MapController {
[key: string]: ((body: any, taskID: number, instanceID?: number) => void);
}
type WasmType = "baseline" | "ml" | "ml-simd" | "ml-simd-pthread" | "auto";
interface WasmLoadOptions {
wasmType?: WasmType;
pthreadPoolSize?: number;
}
type MimeType = "image/png" | "image/jpeg";
declare const mapAsyncDependency: {
[key: string]: any;
};
declare const waitAsyncDependency: (depName: string | string[]) => Promise<void>;
declare const doOrWaitAsyncDependency: (depName: string | string[], asyncFunc: () => Promise<void>) => Promise<void>;
declare let worker: Worker;
declare const getNextTaskID: () => number;
declare const mapTaskCallBack: {
[key: string]: Function;
};
declare let onLog: (message: string) => void | undefined;
declare const setOnLog: (value: typeof onLog) => void;
declare let bDebug: boolean;
declare const setBDebug: (value: boolean) => void;
declare const innerVersions: InnerVersions;
declare const mapPackageRegister: {
[key: string]: any;
};
declare const workerAutoResources: WorkerAutoResources;
declare class CoreModule {
static get engineResourcePaths(): EngineResourcePaths;
static set engineResourcePaths(value: EngineResourcePaths);
private static _bSupportDce4Module;
static get bSupportDce4Module(): number;
private static _bSupportIRTModule;
static get bSupportIRTModule(): number;
private static _versions;
static get versions(): any;
static get _onLog(): (message: string) => void;
static set _onLog(value: (message: string) => void);
static get _bDebug(): boolean;
static set _bDebug(value: boolean);
static _bundleEnv: "DCV" | "DBR";
static get _workerName(): string;
private static _wasmLoadOptions;
static get wasmLoadOptions(): WasmLoadOptions;
static set wasmLoadOptions(options: WasmLoadOptions);
static loadedWasmType: Exclude<WasmType, "auto">;
/**
* Initiates the loading process for the .wasm file(s) corresponding to the specified module(s).
* If a module relies on other modules, the other modules will be loaded as well.
*
* @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
*/
static isModuleLoaded(name?: string): boolean;
static loadWasm(): Promise<void>;
/**
* An event that fires during the loading of a WebAssembly module (.wasm).
*
* @param filePath The path of the wasm file.
* @param tag Indicates the ongoing status of the file download ("starting", "in progress", "completed").
* @param progress An object indicating the progress of the download, with `loaded` and `total` bytes.
*/
static onWasmLoadProgressChanged: (filePath: string, tag: "starting" | "in progress" | "completed", progress: {
loaded: number;
total: number;
}) => void;
/**
* Detect environment and get a report.
*/
static detectEnvironment(): Promise<any>;
/**
* modify from https://gist.github.com/2107/5529665
* @ignore
*/
static browserInfo: any;
static getModuleVersion(): Promise<WasmVersions>;
static getVersion(): string;
static enableLogging(): void;
static disableLogging(): void;
static cfd(count: number): Promise<void>;
}
interface ImageTag {
/** The unique identifier of the image. */
imageId: number;
/** The type of the image. */
type: EnumImageTagType;
}
interface DSImageData {
/** The raw bytes of the image as a Uint8Array. */
bytes: Uint8Array;
/** The width of the image in pixels. */
width: number;
/** The height of the image in pixels. */
height: number;
/** The stride (or row width) of the image in bytes. */
stride: number;
/** The pixel format of the image. */
format: EnumImagePixelFormat;
/** An optional tag associated with the image data. */
tag?: ImageTag;
}
interface CapturedResultItem {
/** The type of the captured result item, indicating what kind of data it represents. */
readonly type: EnumCapturedResultItemType;
/** A property of type `CapturedResultItem` that represents a reference to another captured result item. */
readonly referenceItem: CapturedResultItem | null;
/** The name of the target ROI definition which includes a task that generated the result. */
readonly targetROIDefName: string;
/** The name of the task that generated the result. */
readonly taskName: string;
}
interface OriginalImageResultItem extends CapturedResultItem {
/** The image data associated with this result item. */
imageData: DSImageData;
/** Converts the image data into an HTMLCanvasElement for display or further manipulation in web applications. */
toCanvas: () => HTMLCanvasElement;
/** Converts the image data into an HTMLImageElement of a specified MIME type ('image/png' or 'image/jpeg'). */
toImage: (MIMEType: "image/png" | "image/jpeg") => HTMLImageElement;
/** Converts the image data into a Blob object of a specified MIME type ('image/png' or 'image/jpeg'). */
toBlob: (MIMEType: "image/png" | "image/jpeg") => Promise<Blob>;
}
interface Point {
/** The x-coordinate of the point. */
x: number;
/** The y-coordinate of the point. */
y: number;
}
interface Contour {
/** An array of `Point` objects defining the vertices of the contour. */
points: Array<Point>;
}
interface LineSegment {
/** The starting point of the line segment. */
startPoint: Point;
/** The ending point of the line segment. */
endPoint: Point;
}
interface Corner {
/** The type of the corner, represented by the enumeration EnumCornerType. */
type: EnumCornerType;
/** The point of intersection of the two lines forming the corner. */
intersection: Point;
/** The first line segment forming the corner. */
line1: LineSegment;
/** The second line segment forming the corner. */
line2: LineSegment;
}
interface Rect {
/** The x-coordinate of the rectangle's top-left corner. */
x: number;
/** The y-coordinate of the rectangle's top-left corner. */
y: number;
/** The width of the rectangle. */
width: number;
/** The height of the rectangle. */
height: number;
/** [Optional] Indicates if the rectangle's measurements are in percentages. */
isMeasuredInPercentage?: boolean;
}
interface Arc {
/** The x-coordinate of the arc's center. */
x: number;
/** The y-coordinate of the arc's center. */
y: number;
/** The radius of the arc. */
radius: number;
/** The starting angle of the arc, in radians. */
startAngle: number;
/** The ending angle of the arc, in radians. */
endAngle: number;
}
interface Polygon {
/** An array of `Point` objects defining the vertices of the polygon. */
points: Array<Point>;
}
interface DSRect {
/** The left coordinate of the rectangle. */
left: number;
/** The right coordinate of the rectangle. */
right: number;
/** The top coordinate of the rectangle. */
top: number;
/** The bottom coordinate of the rectangle. */
bottom: number;
/** Indicates if the rectangle's measurements are in percentages. */
isMeasuredInPercentage?: boolean;
}
interface Edge {
/** The starting corner of the edge. */
startCorner: Corner;
/** The ending corner of the edge. */
endCorner: Corner;
}
interface FileImageTag extends ImageTag {
filePath: string;
pageNumber: number;
totalPages: number;
}
interface ImageSourceErrorListener {
/**
* Called when an error is received from the image source.
*
* @param errorCode An enumeration value of type "EnumErrorCode" indicating the type of error.
* @param errorMessage A C-style string containing the error message providing
* additional information about the error.
*/
onErrorReceived: (errorCode: EnumErrorCode, errorMessage: string) => void;
}
interface PDFReadingParameter {
mode: EnumPDFReadingMode;
dpi: number;
rasterDataSource: EnumRasterDataSource;
}
interface Quadrilateral {
/** An array of four `Point` objects defining the vertices of the quadrilateral. */
points: [Point, Point, Point, Point];
/** The bounding rectangle of the quadrilateral, represented by a `DSRect` object. */
boundingRect?: DSRect;
/** The area of the quadrilateral. */
area?: number;
}
interface DSFile extends File {
/** Downloads the file in memory to the local drive via the browser. */
download: () => void;
}
interface Warning {
/** A unique identifier for the warning message. */
id: number;
/** The textual description of the warning. */
message: string;
}
interface IntermediateResultUnit {
/** A unique identifier for the intermediate result unit. */
hashId: string;
/** The hash ID of the original image associated with this unit. */
originalImageHashId: string;
/** The tag associated with the original image. */
originalImageTag: ImageTag;
/** The type of the intermediate result unit, defined by the enumeration `EnumIntermediateResultUnitType`. */
unitType: EnumIntermediateResultUnitType;
}
interface BinaryImageUnit extends IntermediateResultUnit {
/** The image data for the binary image. */
imageData: DSImageData;
}
interface ColourImageUnit extends IntermediateResultUnit {
/** The image data for the colour image. */
imageData: DSImageData;
}
interface ContoursUnit extends IntermediateResultUnit {
/** An array of `Contour` objects, each representing a series of points that outline a shape within the image. */
contours: Array<Contour>;
}
interface EnhancedGrayscaleImageUnit extends IntermediateResultUnit {
/** The image data for the enhanced grayscale image. */
imageData: DSImageData;
}
interface GrayscaleImageUnit extends IntermediateResultUnit {
/** The image data for the grayscale image. */
imageData: DSImageData;
}
interface IntermediateResult {
/** An array of `IntermediateResultUnit` objects, each representing a different type of intermediate result. */
intermediateResultUnits: Array<IntermediateResultUnit>;
}
interface IntermediateResultExtraInfo {
/** The property indicates the name of the `TargetROIDef` object that generates the intermediate result. */
targetROIDefName: string;
/** The name of the processing task to which this result belongs. */
taskName: string;
/** Indicates whether the result is at the section level. */
isSectionLevelResult: boolean;
/** The type of section, if applicable, as defined by the enumeration `EnumSectionType`. */
sectionType: EnumSectionType;
}
interface LineSegmentsUnit extends IntermediateResultUnit {
/** An array of `LineSegment` objects, each representing a segment of a line detected within the image. */
lineSegments: Array<LineSegment>;
}
interface RegionObjectElement {
/** The location of the region object, represented as a quadrilateral. */
location: Quadrilateral;
/** A reference to another `RegionObjectElement`. */
referencedElement: RegionObjectElement;
/** The type of the region object element, defined by the enumeration EnumRegionObjectElementType. */
elementType: EnumRegionObjectElementType;
/**The image data for the `RegionObjectElement`. */
imageData: DSImageData;
}
interface PredetectedRegionElement extends RegionObjectElement {
/** The name of the detection mode used to detect this region element. */
modeName: string;
/** The ID of the label associated with this region element. */
labelID: number;
/** The name of the label associated with this region element. */
labelName: string;
}
interface PredetectedRegionsUnit extends IntermediateResultUnit {
/** An array of `PredetectedRegionElement` objects, each representing a pre-detected region detected within the image. */
predetectedRegions: Array<PredetectedRegionElement>;
}
interface ScaledColourImageUnit extends IntermediateResultUnit {
/** The image data for the scaled colour image. */
imageData: DSImageData;
}
interface ShortLinesUnit extends IntermediateResultUnit {
/** An array of `LineSegment` objects, each representing a short line detected within the image. */
shortLines: Array<LineSegment>;
}
interface TextRemovedBinaryImageUnit extends IntermediateResultUnit {
/** The image data for the text-removed binary image. */
imageData: DSImageData;
}
interface TextureDetectionResultUnit extends IntermediateResultUnit {
/** This value represents the detected horizontal distance in pixels between consecutive texture patterns, providing an indication of the texture's density and orientation within the image. */
xSpacing: number;
/**
* The spacing between texture stripes in the y-direction. Similar to `xSpacing`, this value measures the vertical distance between texture patterns.
* It offers insights into the vertical density and alignment of the texture within the image, contributing to the understanding of the texture's characteristics and spatial distribution.
*/
ySpacing: number;
}
interface TextureRemovedBinaryImageUnit extends IntermediateResultUnit {
/** The image data for the texture-removed binary image. */
imageData: DSImageData;
}
interface TextureRemovedGrayscaleImageUnit extends IntermediateResultUnit {
/** The image data for the texture-removed grayscale image. */
imageData: DSImageData;
}
interface TextZone {
/** The location of the text zone. */
location: Quadrilateral;
/** The indices of the character contours. */
charContoursIndices: Array<number>;
}
interface TextZonesUnit extends IntermediateResultUnit {
/** An array of `TextZone` objects, each representing the geometric boundaries of a detected text zone within the image. */
textZones: Array<TextZone>;
}
interface TransformedGrayscaleImageUnit extends IntermediateResultUnit {
/** The image data for the transformed grayscale image. */
imageData: DSImageData;
}
/**
* The `ObservationParameters` interface represents an object used to configure intermediate result observation.
*/
interface ObservationParameters {
/**
* Sets the types of intermediate result units that are observed.
* @param types The types of intermediate result units to observe.
* @returns A promise that resolves when the types have been successfully set. It does not provide any value upon resolution.
*/
setObservedResultUnitTypes: (types: bigint) => void;
/**
* Retrieves the types of intermediate result units that are observed.
* @returns A promise that resolves with a number that represents the types that are observed.
*/
getObservedResultUnitTypes: () => bigint;
/**
* Determines whether the specified result unit type is observed.
* @param type The result unit type to check.
* @returns Boolean indicating whether the result unit type is observed.
*/
isResultUnitTypeObserved: (type: EnumIntermediateResultUnitType) => boolean;
/**
* Adds an observed task by its name.
* @param taskName The name of the task.
*/
addObservedTask: (taskName: string) => void;
/**
* Removes an observed task by its name.
* @param taskName The name of the task.
*/
removeObservedTask: (taskName: string) => void;
/**
* Determines whether the specified task is observed.
* @param taskName The name of the task.
* @returns Boolean indicating whether the task is observed.
*/
isTaskObserved: (taskName: string) => boolean;
}
interface CapturedResultBase {
/** Error code associated with the capture result. */
readonly errorCode: number;
/** Error string providing details about the error. */
readonly errorString: string;
/** The hash ID of the original image. */
readonly originalImageHashId: string;
/** The tag associated with the original image. */
readonly originalImageTag: ImageTag;
}
interface ErrorInfo {
errorCode: EnumErrorCode;
errorString: string;
}
declare abstract class ImageSourceAdapter {
#private;
/**
* @ignore
*/
static _onLog: (message: any) => void;
/**
* @ignore
*/
get _isFetchingStarted(): boolean;
constructor();
abstract hasNextImageToFetch(): boolean;
/**
* @brief Sets the error listener for the image source.
*
* This function allows you to set an error listener object that will receive
* notifications when errors occur during image source operations.
* If an error occurs, the error information will be passed to the listener's
* OnErrorReceived method.
*
* @param listener An instance of ImageSourceErrorListener or its
* derived class, which will handle error notifications.
*/
setErrorListener(listener: ImageSourceErrorListener): void;
/**
* Adds an image to the internal buffer.
*
* @param image An instance of `DSImageData` containing the image to buffer.
*/
addImageToBuffer(image: DSImageData): void;
/**
* Retrieves a buffered image, of type `DSImageData`.
*
* This function retrieves the latest image added to the buffer, and removes it from the buffer in the process.
*
* @returns A `DSImageData` object retrieved from the buffer which contains the image data of the frame and related information.
*/
getImage(): DSImageData;
/**
* Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
*
* @param imageId The ID of the image to prioritize.
* @param keepInBuffer [Optional] Boolean indicating whether to keep the image in the buffer after it has been returned.
*/
setNextImageToReturn(imageId: number, keepInBuffer?: boolean): void;
/**
* @ignore
*/
_resetNextReturnedImage(): void;
/**
* Checks if an image with the specified ID is present in the buffer.
*
* @param imageId The ID of the image to check.
*
* @returns Boolean indicating whether the image is present in the buffer.
*/
hasImage(imageId: number): boolean;
/**
* Starts the process of fetching images.
*/
startFetching(): void;
/**
* Stops the process of fetching images.
* to false, indicating that image fetching has been halted.
*/
stopFetching(): void;
/**
* Sets the maximum number of images that can be buffered at any time. Implementing classes should attempt to keep the buffer within this limit.
*
* @param count The maximum number of images the buffer can hold.
*/
setMaxImageCount(count: number): void;
/**
* Retrieves the maximum number of images that can be buffered.
*
* @returns The maximum image count for the buffer.
*/
getMaxImageCount(): number;
/**
* Retrieves the current number of images in the buffer.
*
* @returns The current image count in the buffer.
*/
getImageCount(): number;
/**
* Clears all images from the buffer, resetting the state for new image fetching.
*/
clearBuffer(): void;
/**
* Determines whether the buffer is currently empty.
*
* @returns Boolean indicating whether the buffer is empty.
*/
isBufferEmpty(): boolean;
/**
* Sets the behavior for handling new incoming images when the buffer is full. Implementations should adhere to the specified mode to manage buffer overflow.
*
* @param mode One of the modes defined in EnumBufferOverflowProtectionMode, specifying how to handle buffer overflow.
*/
setBufferOverflowProtectionMode(mode: EnumBufferOverflowProtectionMode): void;
/**
* Retrieves the current mode for handling buffer overflow.
*
* @returns The current buffer overflow protection mode.
*/
getBufferOverflowProtectionMode(): EnumBufferOverflowProtectionMode;
/**
* Sets the usage type for color channels in images.
*
* @param type One of the types defined in EnumColourChannelUsageType, specifying how color channels should be used.
*/
setColourChannelUsageType(type: EnumColourChannelUsageType): void;
/**
* Retrieves the current mode for handling buffer overflow.
*
* @returns The current buffer overflow protection mode.
*/
getColourChannelUsageType(): EnumColourChannelUsageType;
}
/**
* Judge if the input is an object(exclude array and function). If `null` or `undefined`, return `false`.
* @param value
* @returns
*/
declare const isObject: (value: any) => value is Object;
/**
* Judge is the input is a {@link Arc} object.
* @param value
* @returns
* @ignore
*/
declare const isArc: (value: any) => value is Arc;
/**
* Judge is the input is a {@link Contour} object.
* @param value
* @returns
* @ignore
*/
declare const isCont