Skip to content

Custom Document Detector with a Quality Function

You can create a custom document detector with a quality function if you don't want to use the default DefaultDocumentDetector and prefer to use it with DocumentIadCameraController.

Creating a Custom Document Detector

import net.idrnd.doc.iad.capture.DocumentDetector

val documentDetector = object : DocumentDetector {
    override fun detect(document: Document): DocumentDetectionResult {
        // Process the document
    }

    override fun getInputDocumentFormat(): DocumentFormat {
        // Specify the document format supported by this detector.
        // Currently, DocumentIadCameraController supports custom detectors
        // only with the ImageFormat.RGB_888 input document format.
    }
}

cameraController = DocumentIadCameraController(
    documentDetector = documentDetector,
    previewView = findViewById(R.id.previewView),
    lifecycleOwner = this
)