API for analyzing document quality.

Required licence feature(s): ImageProcessing.

Methods

  • 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>

  • Parameters

    • workerBridge: WorkerBridge
    • Optional configuration: {
          compatibilityMode?: { readonly mode?: "V8"; minimumAcceptableQuality?: DocumentQuality; minimumUncertainQuality?: DocumentQuality; inspectSmallText?: boolean; };
          inputScaleThresholdToProcessEntireImage?: number;
          inputScales?: number[];
          maxImageSize?: number;
          minEstimatedNumberOfSymbolsForDocument?: number;
          minRequiredOrientationConfidence?: number;
          processByTileConfiguration?: { enabled?: boolean; minProcessedFraction?: number; maxProcessedFraction?: number; minNumberOfRequiredSymbols?: number; tileSize?: number; };
          qualityAcceptableUncertainThreshold?: number;
          qualityAnalysisModel?: string;
          qualityLevelIndices?: DocumentQuality[];
          qualityLevelThresholds?: ({ readonly symbolQuality?: number; readonly symbolRatio?: number; })[];
          qualityUnacceptableUncertainThreshold?: number;
          returnQualityHeatmap?: boolean;
      }
      • Optional compatibilityMode?: { readonly mode?: "V8"; minimumAcceptableQuality?: DocumentQuality; minimumUncertainQuality?: DocumentQuality; inspectSmallText?: boolean; }

        Compatibility mode for the Document Quality Analyzer. If set, the analyzer will return results that are identical to older versions of the SDK.

        Default Value

        null;
        
      • Optional inputScaleThresholdToProcessEntireImage?: number

        If inputScale from inputScales is smaller or equal than the threshold minProcessedFraction and maxProcessedFraction will be ignored, and the entire image will be processed.

        Default Value

        0.25;
        
      • Optional inputScales?: number[]

        Runs the Document Quality Analyzer on the listed inputScales. Only the best result will be returned. Typical range of the text height, which model can work with, is 5-40 pixels. 10 pixels height is recommended. Use this option if documents with smaller or bigger texts are expected. For example, if 80 pixels text height is expected, scale should be 1/8. Not compatible with maxImageSize. If not [1] maxImageSize should be less or equal 0.

        Default Value

        [1.0];
        
      • Optional maxImageSize?: number

        Maximum image size in pixels, if image is bigger, it will be resized. If less or equal 0 will be ignored.

        Default Value

        2000;
        
      • Optional minEstimatedNumberOfSymbolsForDocument?: number

        If a document's estimated number of symbols is less than this value, document quality will be reported as UNCERTAIN. In that case, the deprecated result fields documentFound andqualityLevel will be set to false and empty, respectively.

        Default Value

        20;
        
      • Optional minRequiredOrientationConfidence?: number

        If detectOrientation is True, minNumberOfRequiredSymbols is found, and orientationConfidence is bigger than this threshold, the processing stops. If the maxProcessedFraction part of the image is processed and orientationConfidence is lower than the threshold, the returned orientation will be 0.

        Default Value

        0.9;
        
      • Optional processByTileConfiguration?: { enabled?: boolean; minProcessedFraction?: number; maxProcessedFraction?: number; minNumberOfRequiredSymbols?: number; tileSize?: number; }

        Configuration for processing image by tiles.

        Default Value

        new ProcessByTileConfiguration({});
        
      • Optional qualityAcceptableUncertainThreshold?: number

        There are documents for which the quality analysis model is uncertain, meaning that the model is not sure if the document is acceptable or not. E.g., the model may report a document quality to be ACCEPTABLE with 60% confidence. Depending on the value of this threshold, the document in this case will be reported as ACCEPTABLE or UNCERTAIN. The default value of 0.5 will typically lead to a good balance between the number of documents reported as ACCEPTABLE and UNCERTAIN. A lower value will lead to fewer UNCERTAIN documents, but unacceptable documents will more often be reported as ACCEPTABLE (false positives). A higher value will lead to more borderline documents being reported as UNCERTAIN, but unacceptable documents will be reported as ACCEPTABLE less often. If 0, no documents with a predicted quality of ACCEPTABLE will be reported as UNCERTAIN, regardless of the model's confidence, unless the document has very few symbols (see minEstimatedNumberOfSymbolsForDocument). If 1, almost all documents with a predicted quality of ACCEPTABLE will be reported as UNCERTAIN. Must be in the range of [0, 1].

        Default Value

        0.5;
        
      • Optional qualityAnalysisModel?: string

        Document quality analysis model to use. If empty, the built-in model is used which provides reasonable quality estimates for a wide variety of documents. If the built-in model is not a good fit for your use case, consider creating a model based on your own documents and use case.

        To create a fine-tuned quality analysis model, follow the documentation of our DoQA model configurator tool. You can find it here: https://github.com/doo/scanbot-sdk-doqa-configurator.

        Default Value

        "";
        
      • Optional qualityLevelIndices?: DocumentQuality[]

        Deprecated, please use qualityAnalysisModel instead. Quality levels.

        Default Value

        ["VERY_POOR", "POOR", "REASONABLE", "GOOD", "EXCELLENT"];
        
      • Optional qualityLevelThresholds?: ({ readonly symbolQuality?: number; readonly symbolRatio?: number; })[]

        Deprecated, please use qualityAnalysisModel instead. Quality thresholds to separate quality levels.

        Default Value

        [new DocumentQualityThreshold({
        "symbolQuality": 0.5,
        "symbolRatio": 0.5
        }), new DocumentQualityThreshold({
        "symbolQuality": 0.7,
        "symbolRatio": 0.3
        }), new DocumentQualityThreshold({
        "symbolQuality": 0.85,
        "symbolRatio": 0.3
        }), new DocumentQualityThreshold({
        "symbolQuality": 0.9,
        "symbolRatio": 0.1
        })];
      • Optional qualityUnacceptableUncertainThreshold?: number

        Same as qualityAcceptableUncertainThreshold, but for documents that are predicted to be UNACCEPTABLE by the model.

        Default Value

        0.5;
        
      • Optional returnQualityHeatmap?: boolean

        If true, will return the quality heatmap as a part of the result. In this case, the entire image will be processed and the minProcessedFraction will be ignored. Useful for debugging situations where the returned quality doesn't appear to match the perceived quality.

        Default Value

        false;
        

    Returns Promise<DocumentQualityAnalyzer>

  • Parameters

    Returns Promise<boolean>

Generated using TypeDoc