⛏️faceRecoCompareFaceWithId

Description

Compare existing user's face with a face in the id using the face recognition system.

Parameters

Response

Example Request and Response

Prerequisites

Before making requests with NEST® SDK, you must have it installed.

You can install NEST® SDK using either npm or yarn. Use the following commands to install NEST® SDK:

npm install @nest25/ai-core-sdk
OR
yarn add @nest25/ai-core-sdk

Request

Here is an example of how to make a faceRecoRegisterUser request using the NEST® SDK:

// import the ai-core-sdk
const fs = require('fs');
import {AIServices} from '@nest25/ai-core-sdk';

// reusable arrow function to encode file data to base64 encoded string
const convertBase64 = async (path) => {
    // get the extention of the image
    let words = path.split('.')
    let extention = words.pop();
    // read binary data from file
    const bitmap = fs.readFileSync(path);
    // convert the binary data to base64 encoded string
    let base64String = bitmap.toString('base64');
    return `data:image/${extention};base64,${base64String}`;
};

// relative path to the file
const filePath = 'playground/sample.jpg';

// create a new instance of the sdk
const aiServices = new AIServices();

async function main() {
  // get the result of the test
  let result = await convertBase64(filePath);
  const result = await aiServices.faceRecoCompareFaceWithId('user_id', result);
  console.log(result);
}

main();

Response

{
    "status": 1,
    "message": "User photo matches with the id."
}

Last updated