DOT Android Document library



DOT Android Document provides components for document capture and related functionalities which are easy to integrate into an Android application.


DOT Android Document has the following requirements:

  • Android API level 21


Maven Repository

DOT Android Document is distributed as an Android library (.aar package) stored in the Innovatrics maven repository.

In order to integrate DOT Android Document into your project, the first step is to include the Innovatrics maven repository and Google repository to your top level build.gradle file.

allprojects {
    repositories {
        maven {
            url ''

Then specify the dependency on DOT Android Document library in the module’s build.gradle file. Dependencies of this library will be downloaded alongside the library.

dependencies {
    implementation "$dotDocumentVersion"

Supported Architectures

DOT Android Document provides binaries for these architectures:

  • armeabi-v7a

  • arm64-v8a

  • x86

  • x86_64

If your target application format is APK and not Android App Bundle, and the APK splits are not specified, the generated APK file will contain binaries for all available architectures. Therefore we recommend using APK splits. For example, to generate arm64-v8a APK, add the following section into your module build.gradle:

splits {
    abi {
        enable true
        include 'arm64-v8a'
        universalApk false

If you do not specify this section, the resulting application can become too large in size.


DOT Android Document declares the following permission in AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

Basic Setup


Although logging is disabled by default, it can be enabled explicitly by using the following method from the class.


The appropriate place for this call is within the onCreate() method of your subclass of Each TAG of a log message starts with the prefix dot-document:.

This setting enables logging for all DOT Android libraries.
Keep in mind that logging should only be used for debug purposes, as it might produce a lot of log messages.



DOT Android Document provides both non-UI and UI components. Non-UI components are aimed at developers who want to build their own UI using the DOT Android Document functionality. UI components are built on top of non-UI components. These are available as abstract fragments, and can be extended and then embedded into the application’s existing activity to provide more control.

List of Non-UI Components


A component for performing document detection on an image.


A component for computing image parameters such as sharpness, brightness or hotspots score.


A component for perspective warping an image according detected document card corners.


A component for capturing good quality photos suitable for optical character recognition.


A component for reading Machine Readable Zone (MRZ).

List of UI Components


A visual component for capturing good quality photos suitable for optical character recognition.

Non-UI Components

Document Detector

The DocumentDetector interface provides a document detection functionality.

Create a DocumentDetector:

DocumentDetector documentDetector = DocumentDetectorFactory.create();

To perform detection, call the following method on the background thread:

DocumentDetector.Result result = documentDetector.detect(bgraRawImage);

Image Parameters Analyzer

The ImageParametersAnalyzer interface provides an image parameters analysis functionality.

Create ImageParametersAnalyzer:

ImageParametersAnalyzer imageParametersAnalyzer = ImageParametersAnalyzerFactory.create();

To perform analysis, call the following method on the background thread:

ImageParameters imageParameters = imageParametersAnalyzer.analyze(bgraRawImage);

Image Perspective Warper

The ImagePerspectiveWarper interface provides perspective warping functionality.

Create ImagePerspectiveWarper:

ImagePerspectiveWarper imagePerspectiveWarper = ImagePerspectiveWarperFactory.create();

To perform perspective warping, call the following method on the background thread:

BgraRawImage warpedBgraRawImage = imagePerspectiveWarper.warp(bgraRawImage, corners, targetImageSize);

Document Auto Capture Controller

The DocumentAutoCaptureController interface provides a stateful document auto capture functionality.

Create DocumentAutoCaptureController:

DocumentAutoCaptureControllerConfiguration configuration = new DocumentAutoCaptureControllerConfiguration.Builder(context, validators)
DocumentAutoCaptureController documentAutoCaptureController = DocumentAutoCaptureControllerFactory.create(configuration);
DocumentAutoCaptureControllerConfiguration.Builder arguments
  • (Required) [-] Context context - Android context.

  • (Required) [-] List<DocumentAutoCaptureDetectionValidator> validators - List of validators. Validations are applied in the same order in which they are stored in the list.

  • (Optional) [2] int minValidFramesInRowToStartCandidateSelection - Minimum number of valid frames in a row to start candidate selection.

  • (Optional) [1000] int candidateSelectionDurationMillis - Duration of candidate selection in milliseconds.

  • (Optional) [-] RectangleDouble detectionNormalizedRectangle - Crop an input image to normalized detection rectangle and use that for document detection.

  • (Optional) [-] RectangleDouble imageParametersNormalizedRectangle - Crop an input image to normalized image parameters rectangle and use that to analyze image parameters.

  • (Optional) [false] boolean mrzReadingEnabled - If Machine Readable Zone reading is enabled.

  • (Optional) [-] DocumentAutoCaptureController.OnDetectionListener onDetectionListener - Listener to be called on each document detection periodically.

  • (Optional) [-] DocumentAutoCaptureController.OnCandidateSelectionStartListener onCandidateSelectionStartListener - Listener to be called when candidate selection is started. This event happens once in an auto capture process.

  • (Optional) [-] DocumentAutoCaptureController.OnCaptureListener onCaptureListener - Listener to be called on auto capture process is done.

In order to get callbacks from the controller, implement these listeners from the DocumentAutoCaptureController interface: OnDetectionListener, OnCandidateSelectionStartListener and OnCaptureListener.

You can use detectionNormalizedRectangle to specify the region in the input image which will be used for document detection. For example, if you want to ignore the top 30% and bottom 30% of the input image, you can do so as follows:

RectangleDouble detectionNormalizedRectangle = RectangleDouble.of(0.0d, 0.3d, 1.0d, 0.7d);

If detectionNormalizedRectangle is not specified, the full input image is used for document detection.

You can use imageParametersNormalizedRectangle to specify the region in the input image which will be used to analyze image parameters. For example, if you want to ignore the top 35%, left 5%, right 5% and bottom 35% of the input image, you can do so as follows:

RectangleDouble imageParametersNormalizedRectangle = RectangleDouble.of(0.05d, 0.35d, 0.95d, 0.65d);

If imageParametersNormalizedRectangle is not specified, the full input image is used to analyze image parameters.

To capture a good quality document image, repeatedly call the process() method using the camera frames:


The controller evaluates the document image requirements for each frame. Once there are minValidFramesInRowToStartCandidateSelection valid frames in a row, candidate selection starts with a duration of candidateSelectionDurationMillis milliseconds. After the candidate selection is finished, the best document image candidate is returned by the OnCaptureListener, and the document auto capture process is over.

In the case you want to force the capture event, call the requestCapture() method. After you call the next process() method, the input image will be returned as a result by the OnCaptureListener and the document auto capture process will be finished.


In the case you want to restart the document auto capture process, call the restart() method.


Machine Readable Zone Reader

The MrzReader interface provides a Machine Readable Zone (MRZ) reading functionality.

Create MrzReader:

MrzReaderConfiguration configuration = new MrzReaderConfiguration.Builder(context).build();
MrzReader mrzReader = MrzReaderFactory.create(configuration);

To read a MRZ, call the following method on the background thread:

MrzReader.Result result =, documentDetectorResult);

Or, alternatively if you know the travel document type call this method to order to increase the precision of reading:

MrzReader.Result result =, documentDetectorResult, travelDocumentType);

Argument documentDetectorResult is a product of either Document Detector component, Document Auto Capture Controller component or Document Auto Capture UI component.

The result of a successful MRZ reading contains the travel document type and machine readable zone. If the MRZ reading was not successful, the result will contain an exception and travelDocumentType and/or machineReadableZone may be null.

UI Components

Orientation Change

In order to handle the orientation change in the multi-window mode correctly, configure the activity in your AndroidManifest.xml file as follows:

    android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" />

Document Auto Capture

The fragment with a document placeholder on the screen. The component is embedded into the application as a fragment from the Android Support Library. The fragment is abstract, so it must be subclassed. In order to configure the behavior of the DocumentAutoCaptureFragment, use DocumentAutoCaptureConfiguration:

DocumentAutoCaptureConfiguration documentAutoCaptureConfiguration = new DocumentAutoCaptureConfiguration.Builder().build();

Bundle arguments = new Bundle();
arguments.putSerializable(DocumentAutoCaptureFragment.CONFIGURATION, documentAutoCaptureConfiguration);

Fragment fragment = new DemoDocumentAutoCaptureFragment();

    .replace(, fragment)

The following arguments are wrapped in DocumentAutoCaptureConfiguration:

  • (Optional) [CameraFacing.BACK] CameraFacing cameraFacing - Camera facing.

    • CameraFacing.FRONT

    • CameraFacing.BACK

  • (Optional) [CameraPreviewScaleType.FIT] CameraPreviewScaleType cameraPreviewScaleType - The camera preview scale type.

    • CameraPreviewScaleType.FIT

    • CameraPreviewScaleType.FILL

  • (Optional) [ValidationMode.STANDARD] ValidationMode validationMode - Validation mode.

    • ValidationMode.STANDARD

    • ValidationMode.STRICT

  • (Optional) [0.900d] double confidenceLowThreshold - Low detection confidence threshold.

  • (Optional) [0.430d] double sizeSmallThreshold - Small size threshold.

  • (Optional) [0.650d] double sharpnessLowThreshold - Low sharpness threshold.

  • (Optional) [0.250d] double brightnessLowThreshold - Low brightness threshold.

  • (Optional) [0.900d] double brightnessHighThreshold - High brightness threshold.

  • (Optional) [0.008d] double hotspotsScoreHighThreshold - High hotspots score threshold.

  • (Optional) [false] boolean detectionLayerVisible - If detection UI layer (tracking rectangle) is visible.

  • (Optional) [false] boolean mrzReadingEnabled - If Machine Readable Zone reading is enabled.

As soon as the fragment is created, the camera preview starts. To start the auto capture process call the start() method. You can start the process any time.

In the case you want to handle detection data, implement onDetected() callback. This callback is called with each processed camera frame. There is also onCandidateSelectionStarted() callback, which is called only once for the whole process, when candidate selection is started.

In the case you want to force the capture event, call the requestCapture() method. Document image candidate will be returned via the onCaptured() callback asynchronously.

In the case you want to restart the auto capture process (e.g. you want to capture both sides of the document, one after another), call the restart() method. The whole process will start from the beginning.

Customization of UI components


You can override the string resources in your application and provide alternative strings for supported languages using the standard Android localization mechanism.

<!-- Document Auto Capture -->
<string name="dot_document_auto_capture_instruction_brightness_too_high">Less light needed</string>
<string name="dot_document_auto_capture_instruction_brightness_too_low">More light needed</string>
<string name="dot_document_auto_capture_instruction_candidate_selection">Hold still…</string>
<string name="dot_document_auto_capture_instruction_document_centering">Center document</string>
<string name="dot_document_auto_capture_instruction_document_not_present">Scan document</string>
<string name="dot_document_auto_capture_instruction_document_too_far">Move closer</string>
<string name="dot_document_auto_capture_instruction_hotspots_present">Avoid reflections</string>
<string name="dot_document_auto_capture_instruction_mrz_not_valid">Scan valid machine readable document</string>
<string name="dot_document_auto_capture_instruction_sharpness_too_low">More light needed</string>

You can customize the colors used by DOT Android Document in your application. To use custom colors, override the specific color.

<!-- Document Auto Capture -->
<color name="dot_document_auto_capture_detection_layer">#ffffffff</color>
<color name="dot_document_auto_capture_instruction_background">#fff8fbfb</color>
<color name="dot_document_auto_capture_instruction_candidate_selection_background">#ff00bfb2</color>
<color name="dot_document_auto_capture_instruction_text">#ff131313</color>
<color name="dot_document_auto_capture_overlay">#0c131313</color>
<color name="dot_document_auto_capture_placeholder">#ffffffff</color>
<color name="dot_document_auto_capture_placeholder_candidate_selection">#ff00bfb2</color>
<color name="dot_document_auto_capture_window_background">#ff000000</color>

Text views and buttons can be styled by overriding the parent style in the application.

<style name="TextAppearance.Dot.Medium" parent="TextAppearance.AppCompat.Medium" />

<style name="TextAppearance.Dot.Medium.DocumentAutoCaptureInstruction">

Common Classes


DTO which represents a size of an image. To create an instance:

ImageSize imageSize = ImageSize.of(width, height);


DTO which represents and an image. To create an instance:

BgraRawImage bgraRawImage = BgraRawImage.of(size, bytes);

To create an instance from Bitmap:

BgraRawImage bgraRawImage = BgraRawImageFactory.create(bitmap);


DTO which represents a document card corners. To create an instance:

Corners corners = Corners.of(topLeft, topRight, bottomRight, bottomLeft);



3.3.0 - 2022-01-11

  • Method DocumentAutoCaptureConfiguration.Builder.validationMode().

  • Method DocumentAutoCaptureConfiguration.Builder.sizeSmallThreshold().

  • Method DocumentAutoCaptureConfiguration.Builder.detectionLayerVisible().

  • Enum ValidationMode.

  • Class DocumentOutOfBoundsValidator.

  • Color resource dot_document_auto_capture_detection_layer.

  • Color resource dot_document_auto_capture_instruction_candidate_selection_background.

  • Color resource dot_document_auto_capture_instruction_text.

  • Color resource dot_document_auto_capture_overlay.

  • Document detection accuracy improved.

  • Validator threshold SharpnessLowValidator.DEFAULT_THRESHOLD to 0.65.

  • Validator threshold DocumentNotDetectedValidator.DEFAULT_THRESHOLD_CONFIDENCE to 0.9.

  • Validator threshold DocumentDoesNotFitPlaceholderValidator.DEFAULT_THRESHOLD_PENALTY to 0.035.

  • Class DocumentSmallValidator to SizeSmallValidator.

  • Improved UX of instruction changing in Document Auto Capture.

  • DocumentAutoCaptureConfiguration.Builder: Method confidenceThreshold() renamed to confidenceLowThreshold().

  • Redesign of the UI of Document Auto Capture component.

  • Rename color resource dot_document_auto_capture_placeholder_capturing to dot_document_auto_capture_placeholder_candidate_selection.

  • Class DocumentLargeValidator.

  • String resource dot_document_auto_capture_instruction_document_too_close.

  • Dimension resource dot_document_auto_capture_placeholder_dash_path_effect_interval.

  • Dimension resource dot_document_auto_capture_placeholder_stroke_width.

3.2.0 - 2021-11-29

  • Target Android API level to 31.

  • Improve DocumentDoesNotFitPlaceholderValidator.

  • Validator threshold DocumentDoesNotFitPlaceholderValidator.DEFAULT_THRESHOLD_DETECTED_TO_PLACEHOLDER_CORNERS_DISTANCE to DocumentDoesNotFitPlaceholderValidator.DEFAULT_THRESHOLD_PENALTY.

3.1.0 - 2021-11-05

  • Callback DocumentAutoCaptureFragment.onDetected().

  • Callback DocumentAutoCaptureFragment.onCandidateSelectionStarted().

  • Validator threshold DocumentNotDetectedValidator.DEFAULT_THRESHOLD_CONFIDENCE to 0.6.

3.0.2 - 2021-10-08

  • Restarting the Document Auto Capture UI component.

3.0.1 - 2021-10-06

  • Image conversion in BgraRawImageFactory.create(Bitmap).

3.0.0 - 2021-09-27

  • Machine Readable Zone Reader component (MrzReader, MrzReaderConfiguration and MrzReaderFactory).

  • Image Perspective Warper component (ImagePerspectiveWarper and ImagePerspectiveWarperFactory).

  • Class DocumentDetectorFactory.

  • Class ImageParametersAnalyzerFactory.

  • Class DocumentAutoCaptureControllerConfiguration.

  • Class DocumentAutoCaptureControllerFactory.

  • Class DocumentAutoCaptureDetection.

  • Class Corners.

  • Class BgraRawImageFactory.

  • Class BitmapFactory.

  • groupId to

  • Minimum Android API level to 21.

  • Class DocumentAutoCaptureArguments to DocumentAutoCaptureConfiguration.

  • Method DocumentAutoCaptureController.detect() to DocumentAutoCaptureController.process().

  • Class DocumentAutoCaptureController.OnStayStillPhaseEnterListener to DocumentAutoCaptureController.OnCandidateSelectionStartListener().

  • Class DetectionResult to DocumentDetector.Result.

  • Class Point to PointDouble.

  • Method DocumentAutoCaptureController.onPhotoCaptured() to DocumentAutoCaptureController.onCaptured().

  • Method DocumentAutoCaptureController.postCaptureRequest() to DocumentAutoCaptureController.requestCapture().

  • Class DetectedDocument to DocumentAutoCaptureResult.

  • Performance of document detection is significantly improved.

  • Interface DocumentAutoCaptureFrameParametersEvaluator.

  • Class DefaultDocumentAutoCaptureFrameParametersEvaluator.

  • Method DocumentAutoCaptureFragment.onCameraAccessFailed().

  • Method DocumentAutoCaptureFragment.onCameraInitFailed().

  • Class PlaceholderEvaluatorFactory.

  • Method DocumentAutoCaptureController.onAutoCaptureReady().

  • Enum DocumentAutoCaptureHint.

2.3.1 - 2021-06-17

  • Requesting camera permission if already denied.

2.3.0 - 2021-05-14

  • DocumentAutoCaptureArguments.Builder: Method confidenceThreshold().

  • DocumentAutoCaptureArguments.Builder: Method sharpnessLowThreshold().

  • DocumentAutoCaptureArguments.Builder: Method brightnessLowThreshold().

  • DocumentAutoCaptureArguments.Builder: Method brightnessHighThreshold().

  • DocumentAutoCaptureArguments.Builder: Method hotspotsScoreHighThreshold().

  • BrightnessHighValidator.Builder: Method threshold().

  • BrightnessLowValidator.Builder: Method threshold().

  • DocumentDoesNotFitPlaceholderValidator.Builder: Method detectedToPlaceholderCornersDistanceThreshold().

  • DocumentLargeValidator.Builder: Method documentWidthToImageWidthRatioThreshold().

  • DocumentNotDetectedValidator.Builder: Method confidenceThreshold().

  • DocumentSmallValidator.Builder: Method documentWidthToImageWidthRatioThreshold().

  • HotspotsScoreHighValidator.Builder: Method threshold().

  • SharpnessLowValidator.Builder: Method threshold().

  • All DocumentAutoCaptureFrameParametersValidator implementations: Instance creation via a Builder.

  • PlaceholderEvaluatorFactory: Instance creation via a Builder.

2.2.1 - 2021-03-29

  • Support for x86 and x86_64 architectures.

2.2.0 - 2021-03-17

  • Update documentation.

  • Configuration change issue in Document Auto Capture UI component.

2.1.0 - 2021-01-25

  • Callback DocumentAutoCaptureFragment.onAutoCaptureReady().

  • Method DocumentAutoCaptureFragment.start().

  • DocumentAutoCaptureFragment: Auto Capture process is not started implicitly. Client needs to call method DocumentAutoCaptureFragment.start() to start the process.

  • DocumentAutoCaptureFragment: As soon as the photo is captured, all views are reset.

2.0.1 - 2021-01-21

  • Issue in method DocumentAutoCaptureFragment.restart().

2.0.0 - 2021-01-11

  • Option to restart the Document Auto Capture Controller component (method DocumentAutoCaptureController.restart()).

  • Option to restart the Document Auto Capture UI component (method DocumentAutoCaptureFragment.restart()).

  • New non-UI component: Image Parameters Analyzer.

  • DefaultDocumentAutoCaptureController.Builder: Method detectionFrame().

  • DefaultDocumentAutoCaptureController.Builder: Method imageParametersFrame().

  • HotspotsScoreHighValidator for validating hotspots presence.

  • Update target Android SDK version to 30 (Android 11).

  • DetectionResult DTO does not contain sharpness and brightness anymore (these are present in ImageParameters DTO).

  • DefaultDocumentAutoCaptureController.Builder: Method detectionResultEvaluator() renamed to documentAutoCaptureFrameParametersEvaluator().

  • DetectionResultEvaluator renamed to DocumentAutoCaptureFrameParametersEvaluator.

  • DefaultDetectionResultEvaluator renamed to DefaultDocumentAutoCaptureFrameParametersEvaluator.

  • DetectionAttributeValidator renamed to DocumentAutoCaptureFrameParametersValidator.

  • DetectionHint renamed to DocumentAutoCaptureHint.

  • Update documentation.

  • DocumentDetector: Method DetectionResult detectDocument(Nv21Image nv21Image).

  • DefaultDocumentAutoCaptureController.Builder: Method croppingFrame().

1.1.0 - 2020-11-25

  • Option to force capture in Document Auto Capture Controller component (method DocumentAutoCaptureController.requestCapture()).

  • Option to force capture in Document Auto Capture UI component (method DocumentAutoCaptureFragment.postCaptureRequest()).

  • Update documentation.

  • Proguard rules.

1.0.0 - 2020-07-31

  • Preview image is cropped before document detection (placeholder area and margin).

  • Document Auto Capture design.

  • Update documentation.

  • Fix camera preview freezing.

  • Placeholder position calculation for cameraPreviewScaleType: ScaleType.CENTER_CROP.

0.3.0 - 2020-07-13

  • Minor changes.

0.2.0 - 2020-07-11

  • Update documentation.