Select images returned by a scan
Configurate image selection
MobbScan allows you to select the images that the scan process returns. To configure this, you will have to create a special configuration like this:
val mobbScanConfiguration = MobbScanConfiguration()
val images: MutableList<MobbScanImageType> = ArrayList()
images.add(MobbScanImageType.FACE_DOCUMENT)
images.add(MobbScanImageType.MRZ)
images.add(MobbScanImageType.SIGNATURE)
mobbScanConfiguration.images = images
MobbScanConfiguration mobbScanConfiguration = new MobbScanConfiguration();
List<MobbScanImageType> images = new ArrayList<>();
images.add(MobbScanImageType.FACE_DOCUMENT);
images.add(MobbScanImageType.MRZ);
images.add(MobbScanImageType.SIGNATURE);
mobbScanConfiguration.setImages(images);
Once you have your MobbScanConfiguration instance with the images you want to obtain from the documents, you have to include this object in the initAPI
method.
If you want to know more about this method you can go to the basic configuration.
MobbScanAPI.getInstance().initAPI("YOUR_LICENSE_HERE", this, object : LicenseStatusListener {
override fun onLicenseStatusChecked(licenseResult: MobbScanLicenseResult?, licenseValidTo: Date?) {
// Your code for the listener here...
}
}, mobbScanConfiguration)
MobbScanAPI.getInstance().initAPI("YOUR_LICENSE_HERE", this, new LicenseStatusListener() {
@Override
public void onLicenseStatusChecked(MobbScanLicenseResult licenseResult, Date licenseValidTo) {
// Your code for the listener here...
}
}, mobbScanConfiguration);
The list of images available to obtain from a document are indicated in the MobbScanImageType enum. Some of the images are only available in those documents that contains them, as it is the case of the Fingerprint
or QRCode
.
The possible values are:
value | description |
---|---|
FRONT | Front document image |
BACK | Back document image |
MRZ | MRZ image from the document |
FACE_DOCUMENT | Face image on the document |
SIGNATURE | Signature on the document |
FINGERPRINT | Fingerprint on the document |
PDF417 | PDF417 image from the document |
FACE_NOW | Only available when performing face matching. Returns the selfie image obtain in the face matching process. |
QRCode | QRCode image from the document. |
Obtaining the images after scan
Once you have configured MobbScan and performed a scan, you will be able to obtain the image at the IDDocumentScanListener of the scan.
var docSide = MobbScanDocumentSide.FRONT
MobbScanAPI.getInstance().scanDocument(docSide, "YOUR_SCAN_ID_HERE", { result, resultData, error ->
// Your code for the detection listener here...
}, { result, resultData, error ->
// Your code for the scan listener here...
if (error == null) {
var faceImage = resultData.getImage(scanId, MobbScanImageType.FACE_DOCUMENT)
var mrzImage = resultData.getImage(scanId, MobbScanImageType.MRZ)
var signatureImage = resultData.getImage(scanId, MobbScanImageType.SIGNATURE)
}
})
obbScanDocumentSide docSide = MobbScanDocumentSide.FRONT;
MobbScanAPI.getInstance().scanDocument(docSide, "YOUR_SCAN_ID_HERE", new IDDocumentDetectionListener() {
@Override
public void onIDDocumentDetected(MobbScanDetectionResult result, MobbScanDetectionResultData resultData, MobbScanAPIError error) {
// Your code for the listener here...
}
}, new IDDocumentScanListener() {
@Override
public void onIDDocumentScanned(MobbScanScanResult result, MobbScanScanResultData resultData, MobbScanAPIError error) {
if (error == null) {
Bitmap faceImage = resultData.getImage(scanId, MobbScanImageType.FACE_DOCUMENT);
Bitmap mrzImage = resultData.getImage(scanId, MobbScanImageType.MRZ);
Bitmap signatureImage = resultData.getImage(scanId, MobbScanImageType.SIGNATURE);
}
}
});