Skip to main content

Document Quality Analyzer | Android Document Scanner

The Document Quality Analyzer component allows you to detect the quality of text in still images or frames from the camera.

The Document Quality Analyzer is available only as a classic component (types of components are explained here).


Take a look at our Example App to see how to integrate the Document Quality Analyzer.

Add Feature as a Dependency

DocumentQualityAnalyzer is available with SDK Package 1. You have to add the following dependencies for it:


Initialize the SDK

The Scanbot SDK must be initialized before use. Add the following code snippet to your Application class:

import io.scanbot.sdk.ScanbotSDKInitializer

class ExampleApplication : Application() {

override fun onCreate() {

// Initialize the Scanbot Scanner SDK:

Classic component

Try our Document Quality Analyzer Demo App or check the following step by step integration instructions.

Add feature depedencies and initialize the SDK

First of all, you have to add the SDK package and feature dependencies as described here.

Initialize the SDK as described here. More information about the SDK license initialization can be found here.

Analyze live preview image

First of all, ScanbotCameraXView needs to be set up. For this refer to the Using ScanbotCameraView chapter.

Next, set up the analyzer, create FrameHandler and attach it to ScanbotCameraXView:

val documentQualityAnalyzer = ScanbotSDK(context).createDocumentQualityAnalyzer()
resultCaption = findViewById<TextView>(


val qualityAnalyzerFrameHandler = object : FrameHandler {

override fun handleFrame(previewFrame: FrameHandler.Frame): Boolean {
val qualityResult: DocumentQualityResult? = documentQualityAnalyzer.analyze(
previewFrame.frame, previewFrame.width, previewFrame.height,

// NOTE: 'handleFrame' method runs in background thread - don't forget to switch to main before touching any Views
runOnUiThread {
resultCaption.text = "Image quality: ${qualityResult?.name ?: "UNKNOWN"}"

return false



Now the live frames will be processed inside FrameHandler, passed to documentQualityAnalyzer and the resulting image quality value will be displayed in a TextView.

Analyzed results are represented by io.scanbot.sdk.process.model.DocumentQualityResult enum, with the following values:

  • DocumentQualityResult.NO_DOCUMENT - No document was found
  • DocumentQualityResult.VERY_POOR - The quality of the document is very poor
  • DocumentQualityResult.POOR - The quality of the document is poor
  • DocumentQualityResult.REASONABLE - The quality of the document is reasonable
  • DocumentQualityResult.GOOD - The quality of the document is good
  • DocumentQualityResult.EXCELLENT - The quality of the document is excellent

Analyze a still image

Alternative to live detection, you can run the analyzer on an image that has just been captured or one that you have retrieved from the gallery:

override fun onPictureTaken(image: ByteArray, captureInfo: CaptureInfo) {
val bitmap = BitmapFactory.decodeByteArray(image, 0, image.size)
val documentQuality: DocumentQualityResult? = documentQualityAnalyzer.analyzeInBitmap(bitmap, imageOrientation)

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?