How to enable Mrz Mode
MRZ Scanning extracts critical data from the machine-readable zone of documents, particularly travel-related IDs such as passports and visas. This data includes personal information like name, nationality, passport number, and expiration date. MRZ scanning is essential in applications like border control, immigration, and identity verification.
Java:
barkoderConfig.getDecoderConfig().SetEnabledDecoders(new Barkoder.DecoderType[]{
Barkoder.DecoderType.IDDocument
});
}
barkoderConfig.getDecoderConfig().IDDocument.enabled = true;
Kotlin:
private fun setActiveBarcodeTypes() {
// There is option to set multiple active barcodes at once as array
bkdView.config.decoderConfig.SetEnabledDecoders(
arrayOf(
Barkoder.DecoderType.IDDocument,
)
)
bkdView.config.decoderConfig.IDDocument.enabled = true
}
You can also obtain the images from the MRZ sample using the following code:
Java:
@Override
public void scanningFinished(Barkoder.Result[] results, Bitmap[] thumbnails, Bitmap resultImage) {
if (results.length > 0) {
for (int i = 0; i < results.length; i++) {
// Check if the barcode type is "MRZ"
if ("MRZ".equals(results[i].barcodeTypeName)) {
// Check if there are any images
if (results[i].images != null) {
// Iterate over the images
for (Barkoder.BKImageDescriptor j : results[i].images) {
// Check the name of the image and assign the corresponding bitmap
switch (j.name) {
case "main":
mainBitmap = j.image;
break;
case "document":
documentBitmap = j.image;
break;
case "signature":
signatureBitmap = j.image;
break;
case "picture":
pictureBitmap = j.image;
break;
}
}
}
}
}
}
}
Kotlin:
override fun scanningFinished(results: Array<Barkoder.Result>, thumbnails: Array<Bitmap>, resultImage: Bitmap?) {
for (i in results) {
if (i.images != null) {
for (j in i.images) {
when (j.name) {
"main" -> mainBitmap = j.image
"document" -> documentBitmap = j.image
"signature" -> signatureBitmap = j.image
"picture" -> pictureBitmap = j.image
}
}
}
}
}