DOT Android Document 5.0.0
This guide describes how to migrate DOT Android Document version 3.x to version 5.0. Only the most important changes are highlighted in this guide. For more details, see the Android Samples.
Migration Steps (Kotlin)
New SDK versioning
- Replace individual versions of all libraries (DOT Document, DOT Face, DOT Face Lite and DOT NFC) with a single version name. Libraries with the same version name work correctly at build time and at run time.
Before
dotDocumentVersion = '3.7.1'
dotFaceVersion = '4.11.0'
dotNfcVersion = '2.3.4'
//…
implementation "com.innovatrics.dot:dot-document:$dotDocumentVersion"
implementation "com.innovatrics.dot:dot-face-detection-fast:$dotFaceVersion"
implementation "com.innovatrics.dot:dot-nfc:$dotNfcVersion"
After
dotVersion = '5.0.0'
//…
implementation "com.innovatrics.dot:dot-document:$dotVersion"
implementation "com.innovatrics.dot:dot-face-detection-fast:$dotVersion"
implementation "com.innovatrics.dot:dot-nfc:$dotVersion"
DocumentAutoCaptureConfiguration.Builder
- In order to start configuration of quality attribute thresholds call
startQualityAttributeThresholds()to get instance ofQualityAttributeThresholds.BuilderandQualityAttributeThresholds.Builder.end()after all thresholds are configured. - Replace
confidenceLowThreshold()withQualityAttributeThresholds.Builder.minConfidence(). - Replace
sizeSmallThreshold()withQualityAttributeThresholds.Builder.minSize(). - Replace
sharpnessLowThreshold()withQualityAttributeThresholds.Builder.minSharpness(). - Replace
brightnessLowThreshold()withQualityAttributeThresholds.Builder.brightnessInterval(). - Replace
brightnessHighThreshold()withQualityAttributeThresholds.Builder.brightnessInterval(). - Replace
hotspotsScoreHighThreshold()withQualityAttributeThresholds.Builder.maxHotspotsScore().
Before
val configuration = DocumentAutoCaptureConfiguration.Builder()
.confidenceLowThreshold(confidenceLowThreshold)
.sizeSmallThreshold(sizeSmallThreshold)
.sharpnessLowThreshold(sharpnessLowThreshold)
.brightnessLowThreshold(brightnessLowThreshold)
.brightnessHighThreshold(brightnessHighThreshold)
.hotspotsScoreHighThreshold(hotspotsScoreHighThreshold)
.build()
After
val configuration = DocumentAutoCaptureConfiguration.Builder()
.startQualityAttributeThresholds()
.minConfidence(minConfidence)
.minSize(minSize)
.minSharpness(minSharpness)
.brightnessInterval(IntervalDouble(minBrightness, maxBrightness))
.maxHotspotsScore(maxHotspotsScore)
.end()
.build()
Document Auto Capture Controller component (DocumentAutoCaptureController)
- Replace calls of
onDetectionListener,onCandidateSelectionStartListenerandonCaptureListenerlisteners onDocumentAutoCaptureControllerConfiguration.Builderwith handlingDocumentAutoCaptureController.ProcessingResult.eventsproperty.DocumentAutoCaptureController.ProcessingResultis a return type ofprocess()method. - Remove calls of
requestCapture(). Use the next instance ofDocumentAutoCaptureController.ProcessingResultreturned byprocess()method instead.
Before
DocumentAutoCaptureControllerConfiguration configuration = new DocumentAutoCaptureControllerConfiguration.Builder(context, validators)
.detectionNormalizedRectangle(detectionNormalizedRectangle)
.imageParametersNormalizedRectangle(imageParametersNormalizedRectangle)
.mrzReadingEnabled(mrzReadingEnabled)
.onDetectionListener(this::handleDetection)
.onCandidateSelectionStartListener(this::handleCandidateSelectionStart)
.onCaptureListener(this::handleCapture)
.build();
DocumentAutoCaptureController documentAutoCaptureController = DocumentAutoCaptureControllerFactory.create(configuration);
//…
documentAutoCaptureController.process(bgraRawImage);
//…
documentAutoCaptureController.requestCapture();
After
DocumentAutoCaptureControllerConfiguration configuration = new DocumentAutoCaptureControllerConfiguration.Builder(context, validators)
.detectionNormalizedRectangle(detectionNormalizedRectangle)
.imageParametersNormalizedRectangle(imageParametersNormalizedRectangle)
.mrzReadingEnabled(mrzReadingEnabled)
.build();
DocumentAutoCaptureController documentAutoCaptureController = DocumentAutoCaptureControllerFactory.create(configuration);
//…
DocumentAutoCaptureController.ProcessingResult processingResult = documentAutoCaptureController.process(bgraRawImage, timestampMillis);
DocumentAutoCaptureDetection detection = processingResult.getDetection();
if (processingResult.getEvents().contains(DocumentAutoCaptureController.ProcessingResult.Event.CANDIDATE_SELECTION_STARTED)) {
handleCandidateSelectionStart();
}
if (processingResult.getEvents().contains(DocumentAutoCaptureController.ProcessingResult.Event.CAPTURED)) {
handleCapture();
}