Skip to main content

Handling Results

Listen for events in your page / component

const  cardCameraWeb = document.querySelector('idt-card-camera-web');
cardCameraWeb.addEventListener('cardImageComputed', (e) => {
const data = e.detail;
// your code to process
});
const  scanResponse = document.querySelector('idt-card-camera-web');
cardCameraWeb.addEventListener('scanResponse', (e) => {
const data = e.detail;
// your code to process
});

faceImageComputed, cardImageComputed, scanResponse are CustomEvent returning data — in e.response

In your page you can keep images state by declaring variable, and update the state of these variable on the image captured event callbacks. Then you can run matching as below.

function tryMatching() {
if(faceImage && cardImage){
matchFaces(cardImage, faceImage, function(data){
document.getElementById("similarityValue").innerHTML= "<h2>"+data[0].similarity+"</h2>";
});
}
}

Support

This library has been tested on the latest versions of Chrome, Edge, Firefox, and Safari. If any issues are found with some browsers, please notify us.