High Accuracy OCR, Face Recognition & Liveness
  • Language
    • Overview
    • Android
      • Project Setup
      • Accura OCR
      • Accura Face Match
      • Accura Liveness
    • iOS
      • Project Setup
        • Check Pod Size
      • Accura OCR
        • Setup Accura License and Configurations
        • Set Camera View
      • Accura Face Match
      • Accura liveness
    • Flutter
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods and Adding Permissions.
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode and Bankcard
        • Facematch and Liveness
    • Cordova
      • Project Setup
      • Android Setup
        • Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Title & Error messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • React-Native
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Adding Permissions.
        • Adding License
      • Functions
        • Fetching License Details
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Xamarin
      • Project Setup
      • Android Setup
        • Adding Permission & Packages
        • Adding License
      • iOS Setup
        • Adding Permissions
        • Adding License
      • Functions
        • Fetching License details
        • Setup custom messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Docker
      • MRZ
      • FaceMatch
      • Face Liveness
      • ID Liveness
      • ID Forgery
    • Web API
      • Accura OCR
      • Accura Face Match
      • Accura Face Liveness
      • Accura ID Liveness
  • Solutions
    • MRZ
      • Android
        • SDK Setup
        • Setup Accura MRZ
      • iOS
        • SDK Setup
        • Setup Accura MRZ
      • Flutter
        • SDK Setup
        • Setup Accura MRZ
      • React Native
        • SDK Setup
        • Setup Accura MRZ
      • Cordova
        • SDK Setup
        • Setup Accura MRZ
    • OCR
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • Barcode with PDF417
      • Android
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • iOS
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Flutter
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • React Native
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Cordova
        • SDK Setup
        • Setup Accura Barcode with PDF417
    • Face Match
      • Android
        • Setup SDK
        • Setup Accura Face Match
      • iOS
        • Setup SDK
        • Setup Accura Face Match
      • Flutter
        • Setup SDK
        • Setup Accura Face Match
      • React Native
        • Setup SDK
        • Setup Accura Face Match
      • Cordova
        • Setup SDK
        • Setup Accura Face Match
    • Face Liveness (2D / Silent / Passive)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness (3D / Face Movement)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness with Voice Authentication
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Set up Accura Face Liveness
    • ⁠Document Liveness and ID Forgery
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • NFC scanner
      • Android
        • SDK Setup
        • Setup Accura NFC
      • iOS
        • SDK Setup
        • Setup Accura NFC
      • Flutter
        • SDK Setup
        • Setup Accura NFC
      • React Native
        • SDK Setup
        • Setup Accura NFC
      • Cordova
        • SDK Setup
        • Setup Accura NFC
    • Voice Biometrics
      • Android
        • Setup Voice Verification
      • iOS
        • Setup Voice Verification
      • Flutter
        • Setup Voice Verification
      • React Native
        • Setup Voice Verification
      • Cordova
        • Setup Voice Verification
    • Finger Biometrics
      • Android
        • SDK Setup
        • Setup Accura Finger
      • iOS
        • SDK Setup
        • Setup Accura Finger
      • Flutter
        • SDK Setup
        • Setup Accura Finger
      • React Native
        • SDK Setup
        • Setup Accura Finger
      • Cordova
        • SDK Setup
        • Setup Accura Finger
    • MICR Cheque scanner
      • Android
        • SDK Setup
        • Setup Accura MICR
      • iOS
        • SDK Setup
        • Setup Accura MICR
      • Flutter
        • SDK Setup
        • Setup Accura MICR
      • React Native
        • SDK Setup
        • Setup Accura MICR
      • Cordova
        • SDK Setup
        • Setup Accura MICR
Powered by GitBook
On this page
  • Add following code in Manifest.
  • Open auto capture camera
  • Implement face match code manually to your activity.
  • Optional: Load License File Dynamically
  • Simple Usage to face match in your app.
  1. Solutions
  2. Face Match
  3. Android

Setup Accura Face Match

Require accuraface.license to implement AccuraFaceMatch SDK in to your app

Add following code in Manifest.

<manifest>
    ...
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

Open auto capture camera

FMCameraScreenCustomization cameraScreenCustomization = new FMCameraScreenCustomization();

cameraScreenCustomization.backGroundColor = getResources().getColor(R.color.fm_camera_Background);
cameraScreenCustomization.closeIconColor = getResources().getColor(R.color.fm_camera_CloseIcon);
cameraScreenCustomization.feedbackBackGroundColor = getResources().getColor(R.color.fm_camera_feedbackBg);
cameraScreenCustomization.feedbackTextColor = getResources().getColor(R.color.fm_camera_feedbackText);
cameraScreenCustomization.feedbackTextSize = 18;
cameraScreenCustomization.feedBackframeMessage = "Frame Your Face";
cameraScreenCustomization.feedBackAwayMessage = "Move Phone Away";
cameraScreenCustomization.feedBackOpenEyesMessage = "Keep Your Eyes Open";
cameraScreenCustomization.feedBackCloserMessage = "Move Phone Closer";
cameraScreenCustomization.feedBackCenterMessage = "Move Phone Center";
cameraScreenCustomization.feedBackMultipleFaceMessage = "Multiple Face Detected";
cameraScreenCustomization.feedBackHeadStraightMessage = "Keep Your Head Straight";
cameraScreenCustomization.feedBackBlurFaceMessage = "Blur Detected Over Face";
cameraScreenCustomization.feedBackGlareFaceMessage = "Glare Detected";
cameraScreenCustomization.feedBackLowLightMessage = "Low light detected";
cameraScreenCustomization.feedbackDialogMessage = "Loading...";
cameraScreenCustomization.feedBackProcessingMessage = "Processing...";
cameraScreenCustomization.showlogo = 0; // Set 0 to hide logo from selfie camera screen
cameraScreenCustomization.logoIcon = R.drawable.your_logo; // To set your custom logo
    
// FMCameraScreenCustomization.CAMERA_FACING_FRONT to set selfie camera       
// FMCameraScreenCustomization.CAMERA_FACING_BACK to set rear camera
cameraScreenCustomization.facing = FMCameraScreenCustomization.CAMERA_FACING_FRONT;

    
// 0 for full dark face and 100 for full bright face or set it -1 to remove low light filter
cameraScreenCustomization.setLowLightTolerence(-1/*lowLightTolerence*/);

// 0 for clean face and 100 for Blurry face or set it -1 to remove blur filter
cameraScreenCustomization.setBlurPercentage(80/*blurPercentage*/); // To allow blur on face
                                                
// Set min and max percentage for glare or set it -1 to remove glare filter
cameraScreenCustomization.setGlarePercentage(6/*glareMinPercentage*/, 99/*glareMaxPercentage*/);

Intent intent = SelfieFMCameraActivity.getCustomIntent(this, cameraScreenCustomization);
startActivityForResult(intent, ACCURA_FACEMATCH_CAMERA);

// Handle accura fm camera result.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        if (requestCode == ACCURA_LIVENESS_CAMERA && data != null) {
            AccuraFMCameraModel result = data.getParcelableExtra("Accura.fm");
            if (result == null) {
                return;
            }
            if (result.getStatus().equals("1")) {
                // result bitmap
                Bitmap bitmap = result.getFaceBiometrics();
                Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Failed" + result.getStatus(), Toast.LENGTH_SHORT).show();
            }
        }
    }
}

Implement face match code manually to your activity.

Important Grant Camera and storage Permission.

must have to implements FaceCallback to your activity
ImageView image1,image2;

// Initialized facehelper in onCreate.
FaceHelper helper = new FaceHelper(this);
faceHelper.setFaceMatchCallBack(this);
faceHelper.initEngine();

TextView tvFaceMatch = findViewById(R.id.tvFM);
tvFaceMatch.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        ********** For faceMatch
        
        // To pass two image uri for facematch.
        // @params uri1 is for input image
        // @params uri2 is for match image
        
        helper.getFaceMatchScore(uri1, uri2);


        // also use some other method for face match
        // Make sure to call "helper.setInputImage" first, followed by "helper.setMatchImage".
        // helper.setInputImage(uri1);
        // helper.setMatchImage(uri2);
    
    }
});
// Override methods for FaceCallback

@Override
public void onFaceMatch(float score) {
    // get face match score
    System.out.println("Match Score : " + ss + " %");
}

@Override
public void onSetInputImage(Bitmap src1) {
    // set Input image to your view
    image1.setImageBitmap(src1);
}

@Override
public void onSetMatchImage(Bitmap src2) {
    // set Match image to your view
    image2.setImageBitmap(src2);
}

@Override
public void onInitEngine(int ret) {
}

@Override
public void onLeftDetect(FaceDetectionResult faceResult) {
    if (faceResult != null) {
        // do some code
    }
}

@Override
public void onRightDetect(FaceDetectionResult faceResult) {
    if (faceResult != null) {
        // do some code
    }
}

@Override
public void onExtractInit(int ret) {
}

And take a look ActivityFaceMatch.java for full working example.

Optional: Load License File Dynamically

If you prefer to place the license file dynamically, you can use the following method. This allows you to specify the license file path at runtime. For a demo of dynamic licensing, please refer to the dynamic_license_demo branch.

faceHelper.initEngine(faceLicensePath);

Simple Usage to face match in your app.

// Just add FaceMatchActivity to your manifest:
<activity android:name="com.accurascan.facematch.ui.FaceMatchActivity"/>

// Start Intent to open activity
Intent intent = new Intent(this, FaceMatchActivity.class);
startActivity(intent);

PreviousSetup SDKNextiOS

Last updated 2 months ago