in amplify/backend/function/idvworkflowfn/src/idvfunctions.js [663:695]
detectTextInIdCard: async function (imageDataBase64) {
const rek = new Rekognition();
var response = {
Success: false,
Message: '',
DetectedText: []
};
var buf = Buffer.from(imageDataBase64, 'base64');
var params = {
Image: {
Bytes: buf
}
};
const detectTextResponse = await rek.detectText(params).promise();
if (detectTextResponse &&
detectTextResponse["TextDetections"]) {
var textDetections = detectTextResponse["TextDetections"];
for (var i = 0; i < textDetections.length; i++) {
response.DetectedText.push(textDetections[i].DetectedText);
}
response.Success = true;
} else {
response.Success = false;
response.Message = "Unable to extract text"
}
return response;
}