API for document detection and scanning.

Required licence feature(s): DocumentScanner.

Methods

  • Clears the accumulated results. Should be called after a document has been detected to the customers satisfaction to prevent a poisoned cache.

    Returns Promise<void>

  • Frees up any resources associated with this object. No other methods may be called on this object after destroy has been called.

    Returns Promise<void>

  • Detect the document contour in the given image.

    Parameters

    • image: Image

      The image to detect the document contour in.

    • Optional consumeImage: Config.ConsumeType

      Controls if the image can still be used after calling this method, or if it will be consumed by the method. See ConsumeType for more details.

    Returns Promise<DocumentScannerRunResponse>

    The detection result.

  • Detect the document contour in the given image and crop it.

    Parameters

    • image: Image

      The image to detect the document contour in.

    • Optional consumeImage: Config.ConsumeType

      Controls if the image can still be used after calling this method, or if it will be consumed by the method. See ConsumeType for more details.

    Returns Promise<DocumentScannerScanResponse>

    The scanning result.

  • Parameters

    • workerBridge: WorkerBridge
    • Optional configuration: {
          engineMode?: DocumentScannerEngineMode;
          parameters?: { acceptedAngleScore?: number; acceptedSizeScore?: number; acceptedBrightnessThreshold?: number; acceptedAspectRatioScore?: number; aspectRatios?: { readonly width?: number; readonly height?: number; }[]; ignoreOrientationMismatch?: boolean; };
          partiallyVisibleDocumentConfiguration?: { allowPartiallyVisibleDocuments?: boolean; accumulationDuration?: number; retentionTime?: number; minimumBrightness?: number; };
          processingMode?: ProcessingMode;
      }
      • Optional engineMode?: DocumentScannerEngineMode

        The engine to use for document scanning.

        Default Value

        "ML";
        
      • Optional parameters?: { acceptedAngleScore?: number; acceptedSizeScore?: number; acceptedBrightnessThreshold?: number; acceptedAspectRatioScore?: number; aspectRatios?: { readonly width?: number; readonly height?: number; }[]; ignoreOrientationMismatch?: boolean; }

        Initial parameters for the document scanner.

        Default Value

        new DocumentScannerParameters({});
        
      • Optional partiallyVisibleDocumentConfiguration?: { allowPartiallyVisibleDocuments?: boolean; accumulationDuration?: number; retentionTime?: number; minimumBrightness?: number; }

        Configuration for handling partially visible documents.

        Default Value

        new PartiallyVisibleDocumentConfiguration({});
        
      • Optional processingMode?: ProcessingMode

        In live mode, the document scanner will return only the best document contour. In single-shot mode it will return additional document contours, suitable for use in the cropping screen.

        Default Value

        "AUTO";
        

    Returns Promise<DocumentScanner>

Generated using TypeDoc