Scanbot Web Document Scanner SDK

This documentation is for the latest release version of Scanbot Web Document Scanner SDK (scanbot-web-sdk@2.x).

Requirements

Since the Web SDK is based on WebAssembly, older browsers are unfortunately not supported. WebAssembly, as well as Scanbot Web Document Scanner SDK, are supported as of the following versions:

  • Edge 16+
  • Firefox 53+
  • Chrome 57+
  • Safari 11+

Moreover, Scanbot Web Document Scanner SDK is optimized for mobile browsers. The latest versions of the following mobile browsers are supported:

  • On Android: Chrome, Firefox, Edge
  • On iOS 11+: Safari only

More information available here.

Please note that Chrome and Firefox on iOS still use the iOS WebKit rendering engine. getUserMedia is only available in Safari, not other browsers on iOS. This is subject to change, but as of writing this (Aug 2020), on iOS only Safari is supported and no release date for the feature on other browsers has been confirmed.

Example Apps

Check out our Angular, React and plain JS example apps on GitHub:

Adding the Dependency

Scanbot Web Document Scanner SDK is available as an npm package:

npm install scanbot-web-sdk --save

In webpack-based projects you can import the package like so:

import ScanbotSDK from 'scanbot-web-sdk/webpack'

This will ensure that the web worker and WebAssembly components are automatically copied over by webpack into the webpack output folder.

If you want to manually handle those components, import the SDK without the /webpack suffix:

import ScanbotSDK from 'scanbot-web-sdk'

Then, make sure to copy the following files from the package to your web folder:

  • ScanbotSDK.Core.js
  • ScanbotSDK.Asm.wasm

The npm package contains typings under the @types directory, so you can import it in your preferred typescript project, as well as the minified bundle (will even work with vanilla javascript) in the bundle directory.

If you don’t use a bundler (webpack, etc.) in your project, you can put a <script src="ScanbotSDK.min.js"></script> tag in your index.html. The script puts the SDK entry point into a global variable named ScanbotSDK. Copy ScanbotSDK.min.js from the package’s bundle folder to your web folder.

Initializing the SDK

To run the Scanbot SDK plugin functionality within your production app, you have to purchase and use a valid Scanbot SDK license. The SDK will run for one minute in trial mode without a license.

Scanbot SDK must be initialized before use. If you wish to add a custom engine location, e.g. beta version or a specific path to the web worker components, you can also specify the engine location:

const myLicenseKey = "";
scanbotSDK = await ScanbotSDK.initialize({
    licenseKey: myLicenseKey,
    // optional engine path where ScanbotSDK.Core.js and ScanbotSDK.Asm.wasm are served
    engine: "static/js/"
});

Leave the license key empty to enter the trial mode of one minute.

Please contact our sales team to request a free 30-day SDK trial license key.

The initializer also serves as the main entry point of the SDK, meaning that the scanbotSDK object returned upon initialize serves as your entry point to use any other SDK features.

Document Scanner UI

Configuration & Styling

To start the document scanner, we must first create a DocumentScannerConfiguration object, or simply a dictionary in vanilla javascript, as follows.

const config = {
    containerId: containerId,
};

The only required property is the containerId, string, that should match the container where you want the document scanner to pop up.

The configuration object also accepts the following parameters (values displayed are defaults):

acceptedAngleScore: 75,
acceptedSizeScore: 75,
autoCaptureSensitivity: 0.66,
autoCaptureEnabled: true,
ignoreBadAspectRatio: true,

Additionally, you can also use the configuration object for react-like styling. It accepts the following parameters for document outline, hint text label and capture button color (values displayed are defaults):

style: {
    outline: {
        polygon: {
            stroke: "yellow",
            strokeWidth: "2px",
            fill: "none"
        },
        label: {
            position: "absolute",
            top: "90%",
            left: "50%",
            transform: "translate(-50%, -50%)",
            textAlign: "center",
            backgroundColor: "rgba(0, 0, 0, 0.7)",
            color: "white",
            borderRadius: "0.25em",
            padding: "0.5em",
            fontFamily: "sans-serif",
            fontSize: "1em"
        },
        captureButton: {
            color: "white"
        }
    }
};

Note that if you wish to do your styling in css, and not in a reactive design pattern, you are more than welcome to.

The defaults bundled with the SDK, that you are welcome to override, are as follows:

.scanbot-document-outline {
    stroke: yellow;
    stroke-width: 2px;
    fill: none;
}

.scanbot-document-outline-ok {
    stroke: green;
}

.scanbot-document-outline-visible {
    opacity: 1;
    transition: opacity .3s ease-in-out;
}

.scanbot-document-outline-hidden {
    opacity: 0;
    transition: opacity .3s ease-in-out;
}

.scanbot-document-hint-text {
    position: absolute;
    top: 90%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 0.25em;
    padding: 0.5em;
    font-family: sans-serif;
    font-size: 1em;
}

The capture/shutter button can be repositioned by overriding the following css class:

.scanbot-shutter-button {
    /* ... */
}

Moreover, the hint texts can also be configured via the same configuration object (values displayed are defaults):

text: {
    hint: {
        OK: "Don't move. Capturing document...",
        OK_SmallSize: 'Move closer',
        OK_BadAngles: 'Turn your device to<br>have a more rectangular outline',
        OK_BadAspectRatio: 'Wrong aspect ratio - rotate your device',
        OK_OffCenter: 'Move to the center',
        Error_NothingDetected: 'Searching for document...',
        Error_Brightness: 'Poor light<br>Searching for document...',
        Error_Noise: 'Noisy background<br>Searching for document...'
    }
};

The document scanner works at the maximum available camera resolution for the highest quality scans by default. You can further configure the camera video stream by specifying the videoConstraints property of the document scanner configuration. The video constraints are directly given to getUserMedia

The default video constraints are as follows:

videoConstraints: MediaTrackConstraints = {
    facingMode: "environment",
    resizeMode: "none",
    width: { ideal: 3840 },
    height: { ideal: 2160 }
};

Call documentScanner.dispose() to stop the scanner and release all resources.

Callbacks

To receive detection results define onDocumentDetected in the configuration:

onDocumentDetected: result => {
    console.log("Detected Document:", result);
},

The result object contains the following properties:

  • detectionStatus – contains the same keys as the hint texts mentioned earlier
  • success – boolean, whether detection was successful or not
  • original – If success, contains the cropped document ArrayBuffer (UInt8Array)
  • cropped – If success, contains the cropped document ArrayBuffer (UInt8Array)
  • polygon – The page’s cropping polygon as calculated by a document detection operation

Note that this will be called every time a document is detected, until you stop detection or dispose the camera.

Creating the Scanner

After you’re done configuring the scanner, simply refer back to your SDK object and create the scanner object as follows:

documentScanner = await scanbotSDK.createDocumentScanner(config);

An exception is thrown if camera streaming is not supported or the user blocks the camera.

Handling Automatic Capture

If you wish to do image processing between document captures, or find the document scanner a wee bit too trigger-happy, (which is plausible on high-end devices) there is the option to disable automatic capture on the fly.

You can also use these calls to create your own custom auto-capture on/off switch.

Call to disable auto-capture:

documentScanner.disableAutoCapture();

And when processing is complete, or the switch is flicked, re-enable it with the following command:

documentScanner.enableAutoCapture();

To verify whether auto-capture is enabled or not, call:

documentScanner.isAutoCaptureEnabled();

Dispose

Always dispose the document scanner after it is no longer needed

await documentScanner.dispose();

Barcode Scanner UI

Scanbot WebSDK also features the option to scan and detect various barcodes.

The currently accepted formats are:

1D Barcodes

  • Code 39
  • Code 93
  • Code 128
  • Codabar
  • UPC-E
  • ITF
  • EAN-8
  • EAN-13
  • UPC-A

2D Barcodes

  • QR-Code
  • Aztec
  • PDF-417
  • Data Matrix

Configuration

ScanbotSDK Barcode Scanner takes an instance of BarcodeScannerConfiguration as its argument. This is your main object for configuration options, styling and receiving the results.

BarcodeScannerConfiguration and DocumentScannerConfiguration share their base properties:

  • containerId – The id of the containing HTML element where the Barcode Scanner will be initialized. Required
  • videoConstraints – When you wish to manipulate video quality. Optional, defaults to 3840x2160
  • onError – Callback when something went wrong. Optional

Additionally, ScanbotSDK Barcode Scanner has the following configurable options:

  • captureDelay – The delay between receiving detection results. In milliseconds. Optional, defaults to 1000
  • onBarcodesDetected – Your callback for receiving detection results. Required

The result of onBarcodesDetected is a BarcodeResult object that contains the following properties:

barcodes: Barcode[];

The list will always contain at least one element. No empty result is returned.

A barcode item contains the following properties:

  • format: BarcodeFormat – The type of barcode. One of the types listed in the previous paragraph
  • text: string – The data contained in the barcode
  • rawBytes: Uint8Array – The same data contained in the barcode. Can be disregarded in most scenarios, useful when the result is binary data, not a string.

Styling

ScanbotSDK Barcode Scanner has the following style options and their default values:

style?: {
    window: {
        width: string = "260px";
        height: string = "200px";
        borderColor: string = "white";
    },
    text: {
        color: string = "white";
        size: string = "0.9em";
        weight: number = 300;
    },
    backgroundColor: string = "rgba(0, 0, 0, 0.7)";
}

To change a specific style, simply assign it another value, e.g:

configuration.style.window.borderColor: "pink"

The Barcode Scanner Finder overlay also has configurable text properties:

text?: any = {
    hint: "Please align the code in the frame above to scan it"
};

Opening the Scanner

To open the Barcode Scanner, simply call the relevant SDK function with the configuration object:

const scanner = await scanbotSDK.createBarcodeScanner(configuration);

You should store the barcode scanner object in a globally accessible location, as additional barcode scanner actions are functions of that object.

API

To handle barcode results (avoid duplicate scans etc), ScanbotSDK offers the following convenient methods to pause and resume detection while you’re processing the data on your side:

resumeDetection(): void;
pauseDetection(): void;
isDetectionPaused(): boolean;

As with the Document Scanner, the Barcode Scanner should also be properly disposed when you’ve detected and processed the relevant barcodes:

dispose(): void;

Cropping UI

Configuration

ScanbotSDK Cropping View takes a CroppingViewConfiguration parameter. It has the following format:

{
    // Identifier (id-tag of html element) of the Croppign View parent element. Required
    containerId?: string;

    // Determines whether scroll (incl. bounce) should be disabled when the cropping screen is active. Optional. True by default
    disableScroll?: boolean;
    
    // Optional document polygon parameter. 
    // If undefined, detection will be performed and, if a document is then found, a polygon will be applied.
    polygon?: Polygon;
    
    // Image element to be cropped. Required. 
    image: Uint8Array;
    
    // Initial rotations of the original image. Default is 0
    rotations?: number;

    // Optional styling parameter. If left undefined, default styles will be applied
    style?: CroppingViewStyle;
}

Styling

The styling options and default values of the Cropping View are the following:

{
    padding?: number = 10;
    polygon?: {
          color?: string = "#1ec31e";
          width?: number = 4;
          handles?: {                
                color?: string = "white";
                border?: string = "1px solid lightgray";
                size?: number = 14;
          };
    };
    magneticLines?: {
        disabled?: boolean = false;
        color?: string = "transparent";
    };
}

Note that magneticLines style exists only because it is somewhat of an experimental feature, there’s room for improvement and optimization. See if it meets your requirements in its current form

Creating the View

To open the cropping view, simply call the SDK function with the configuration object:

const croppingView = await scanbotSDK.openCroppingView(options);

You should store the cropping view object in a globally accessible location, as additional cropping functions are functions of that object.

API

ScanbotSDK Cropping View classical component contains the following public functions:

rotate(rotations: number): Promise<void>;

The number of clockwise rotations you wish to apply to your image.

detect(): Promise<void>;

If you’re not happy with the detected polygon, you can re-detect and re-apply the polygon from the detected document

apply(): Promise<CroppingResult>;

The contents of the cropping result are as follows:

// The cropped and rotated image
image: Uint8Array;
// The cropped polygon
polygon: Polygon;
// Number of clockwise rotations applied
rotations: number

If you are happy with the polygon and the rotations, apply the changes and receive your new detection result

dispose(): void;

Dispose the Cropping View element if you’re done.

Image Filters

You can also apply filters to images. The scanbotSDK object contains the following function:

async applyFilter(imageBuffer: ArrayBuffer, filterType: ImageFilter): Promise<ArrayBuffer>

So you can simply pass the image object from your DetectionResult to the filter function and return the image with the filter.

ArrayBuffer in this context is equal to the Uint8Array image in your DetectionResult object.

Scanbot WebSDK allows the following filter:

  • Binarization filters:
    • Binarized
    • OtsuBinarization
    • PureBinarized
    • LowLightBinarization
    • LowLightBinarization2
    • DeepBinarization
  • Color filters:
    • Color
    • Gray
    • ColorDocument
    • BlackAndWhite
    • EdgeHighlight
    • Trinarization
    • LightMapNormalization

They are available under BinarizationFilter and ColorFilter types, respectively.

PDF & TIFF Generation

ScanbotSDK also offers functionality for PDF & TIFF generation. Create the appropriate generator as follows:

const options: PdfGenerationOptions = {standardPaperSize: "A4", landscape: true, dpi: 100};
const generator = await scanbotSDK.beginPdf(options);
const options: TiffGenerationOptions = {binarizationFilter: "deepBinarization", dpi: 123};
const generator = await scanbotSDK.beginTiff(options);

Options

  • Paper size calculation:
    • If a standard paper size is given, that paper size is used,
    • Otherwise, if both paperWidthInches and paperHeightInches is set, those values are used
    • Otherwise, the paper size is calculated to fit the input image exactly at the given DPI. If no DPI value is given, a default DPI of 72 is used.
  • DPI calculation:
    • If a DPI is provided, then that value is used.
    • If the value is not given or that value is too small for the entire image to fit on the page, then the smallest possible DPI value is chosen so that the entire image fits on the page.

Adding pages

In order to allow for memory optimization, you can load an image from storage one at a time and add it to the generator:

await generator.addPage(image);

When all images have been added, complete the transaction and receive the resulting byte array:

const bytes = await generator.complete();

As an example, you can force the pdf download of the pages in the browser via:

static saveBytes(data, name) {
    const extension = name.split(".")[1];
    const a = document.createElement("a");
    document.body.appendChild(a);
    a.style = "display: none";
    const blob = new Blob([data], {type: `application/${extension}`});
    const url = window.URL.createObjectURL(blob);
    a.href = url;
    a.download = name;
    a.click();
    window.URL.revokeObjectURL(url);
}

And then call it as such:

saveBytes(bytes, "generated.pdf");

Utilities

In addition to numerous view and image processing functions, ScanbotSDK also features various utility functions.

Please note that utilities are available after initialization, under the instance returned by initialize, therefore, if ScanbotSDK initialization fails, utilities are not available either.

  • isCameraSupported() – Checks whether the browser or device supports camera access. Please note that this functionality is specifically located under utils because ScanbotSDK cannot guarantee the reliability of this functionality. Browsers and their functions are, by design, not backward compatible or future-proof. In niche situations (browsers, devices) it is bound to produce false positives. Other SDK features (import image, apply a filter, etc. are still available even if the camera is not)
  • flash() – Simple flash animation that you can call in the detection callback to add a bit of flare to your application

Release History

Version 2.1.0 (3 Mar 2021)

  • 🎉 New:
    • Barcode Scanner – Scanner view to scan various barcodes
  • 🐞 Bug fixes:
    • Fixed issue where camera component was not properly disposed
  • ⚠️ Breaking Changes:
    • Moved Polygon object to utils/dto/polygon package
    • Moved DetectionStatus to model/document/detection-status package
    • Renamed and moved model/response/detection-result to model/document/document-detection-result

Version 2.0.2 (16 Feb 2021)

  • 🎉 New:
    • TIFF support – The ability to export scanned images as binarized TIFF
  • 🚀 Improvements:
    • All typing imports now available from the @types root package
    • CroppingViewConfiguration now features a rotations property. The rotations property is also contained in CroppingResult after applying the crop
  • 🐞 Bug fixes:
    • Respect existing rotation state when re-applying detection
  • ⚠️ Breaking Changes:
    • Moved PdfGeneration(Options) and TiffGenerator(Options) to the service package

Version 2.0.1 (8 Feb 2021)

  • 🎉 New:
    • Option to disable and enable auto-capture on the fly
  • 🚀 Improvements:
    • Improved ImageFilter @types support for advanced typescript configurations

Version 2.0.0 (3 Feb 2021)

  • 🎉 New:
    • Cropping UI – New components to implement UI for manual cropping of images
    • Image Filters – Scanned documents can now be optimized by applying image filters like binarization, grayscale, etc
    • PDF support – The ability to export scanned images as PDF
  • 🚀 Improvements:
    • Improved @types support for non-react projects
  • ⚠️ Breaking Changes:
    • Detection result images are now Uint8Array. Use scanbotSDK.toDataUrl to convert it to a displayable image
    • The component package no longer available in the Bundle SDK. Replaced by @types
      • Configuration objects moved from model/ to model/configuration/
  • 🚙 Under the hood:
    • Updated OpenCV to version 4.5.0. OpenCV license has been changed from BSD to Apache 2
    • Added further 3rd-party libraries, see Libraries.txt

Version 1.0.2 (03 Nov 2020)

  • 🐞 Bug fixes:
    • Module loading fix for Webpack 5

Version 1.0.1 (20 Oct 2020)

  • 🐞 Bug fixes:
    • Typings entrypoint fix

Version 1.0.0 (25 September 2020)

  • 🎉 Initial release
    • Document Scanner with Auto-cropping
    • UI Components: User-guidance text, Detection polygon and Capture button

Libraries and Licenses


Open Source libraries used in the Scanbot Web Document Scanner SDK

----------------------------------------------------------------------------------------

Classnames
(https://jedwatson.github.io/classnames/)

(The MIT License)

Copyright (c) 2015 Jed Watson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----------------------------------------------------------------------------------------

Preact
(https://github.com/preactjs/preact/)

The MIT License (MIT)

Copyright (c) 2015-present Jason Miller

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

----------------------------------------------------------------------------------------

OpenSSL
(https://github.com/openssl/openssl)

Copyright (c) 1998-2020 The OpenSSL Project.  All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. All advertising materials mentioning features or use of this software must display the following acknowledgment:
"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)"

4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org.

5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project.

6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)"

THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================

This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).
This product includes software written by Tim Hudson (tjh@cryptsoft.com).

Original SSLeay License
-----------------------

Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
All rights reserved.

This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). The implementation was written so as to conform with Netscapes SSL.

This library is free for commercial and non-commercial use as long as the following conditions are aheared to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code.  The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com).

Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution
as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software must display the following acknowledgement:
"This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)"
The word 'cryptographic' can be left out if the rouines from the library being used are not cryptographic related :-).
4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement:
"This product includes software written by Tim Hudson (tjh@cryptsoft.com)"

THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The licence and distribution terms for any publically available version or derivative of this code cannot be changed.  i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.]

ISC license used for completely new code in BoringSSL:

Copyright (c) 2015, Google Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */

Some files from Intel carry the following license

Copyright (c) 2012, Intel Corporation

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

*  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

*  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

*  Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------------

Filesystem.hpp
(https://github.com/bin-build/filesystem)

Copyright (c) 2015-2017, Wenzel Jakob
Copyright (c) 2017, Josh Junon
All rights reserved.
This library is distributed under the terms of a BSD 2-Clause License (https://github.com/bin-build/filesystem/blob/master/LICENSE)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------------

JSON for Modern C++

Version 3.1.0
(https://github.com/nlohmann/json)

Copyright (c) 2013-2018 Niels Lohmann <http://nlohmann.me>.
This library is distributed under the terms of a MIT License (https://github.com/nlohmann/json/blob/develop/LICENSE.MIT)

Permission is hereby  granted, free of charge, to any  person obtaining a copy of this software and associated  documentation files (the "Software"), to deal in the Software  without restriction, including without  limitation the rights to  use, copy,  modify, merge,  publish, distribute,  sublicense, and/or  sell copies  of  the Software,  and  to  permit persons  to  whom  the Software  is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE  IS PROVIDED "AS  IS", WITHOUT WARRANTY  OF ANY KIND,  EXPRESS OR IMPLIED,  INCLUDING BUT  NOT  LIMITED TO  THE  WARRANTIES OF MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND  NONINFRINGEMENT. IN NO EVENT  SHALL THE AUTHORS  OR COPYRIGHT  HOLDERS  BE  LIABLE FOR  ANY  CLAIM,  DAMAGES OR  OTHER LIABILITY, WHETHER IN AN ACTION OF  CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE  OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----------------------------------------------------------------------------------------

OpenCV

Version 4.5.0
(https://github.com/opencv/opencv)

Copyright (C) 2000-2020, Intel Corporation, all rights reserved.
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
Copyright (C) 2015-2020, OpenCV Foundation, all rights reserved.
Copyright (C) 2008-2016, Itseez Inc., all rights reserved.
Copyright (C) 2019-2020, Xperience AI, all rights reserved.
Copyright (C) 2019-2020, Shenzhen Institute of Artificial Intelligence and
                         Robotics for Society, all rights reserved.

Third party copyrights are property of their respective owners.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

----------------------------------------------------------------------------------------

Skia

Version commit 47b4b19af2
(https://github.com/google/skia)

Copyright (c) 2011 Google Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.

  * Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived
    from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------------

LibTIFF

Version 4.1.0, based on included OpenCV version
(https://github.com/opencv/opencv/tree/4.5.0/3rdparty/libtiff)

Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.

Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
all copies of the software and related documentation, and (ii) the names of
Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Sam Leffler and Silicon Graphics.

THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.

----------------------------------------------------------------------------------------

BOOST C++ Libraries

Version 1.68
(https://github.com/boostorg/boost)

This library is distributed under the terms of the following license: https://www.boost.org/LICENSE_1_0.txt

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization obtaining
a copy of the software and accompanying documentation covered by this license
(the "Software") to use, reproduce, display, distribute, execute, and transmit
the Software, and to prepare derivative works of the Software, and to permit third-parties
to whom the Software is furnished to do so, all subject to the following:

The copyright notices in the Software and this entire statement, including the above
license grant, this restriction and the following disclaimer, must be included in
all copies of the Software, in whole or in part, and all derivative works of the
Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by a source
language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----------------------------------------------------------------------------------------

libjpeg-turbo

Version 2.0.5, based on included OpenCV version
(https://github.com/opencv/opencv/tree/4.5.0/3rdparty/libjpeg-turbo)

Copyright (C)2009-2019 D. R. Commander.  All Rights Reserved.
Copyright (C)2015 Viktor Szathmáry.  All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
- Neither the name of the libjpeg-turbo Project nor the names of its
  contributors may be used to endorse or promote products derived from this
  software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------------

TensorFlow

Version commit dc05a7a
(https://github.com/tensorflow/tensorflow)

Copyright 2017 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

----------------------------------------------------------------------------------------

ZXing-C++, C++ port of ZXing

(https://github.com/nu-book/zxing-cpp)

Copyright 2016 Nu-book Inc.
Copyright 2016 ZXing authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

----------------------------------------------------------------------------------------