Development

This page contains the information of Usage, Configuration, Result of OkayDoc for Android

Usage

For Android, a valid license key is required to start the process. In OkayDoc, there are two types of document verification:

  • Image

  • Video

Use the ImageConfig for the image verification, and VideoConfig for video verification. The example is shown below:

Config videoConfig = new VideoConfig.Builder()
    .setMyKadThreshold(70)
    .setLandmarkThreshold(10)
    .setHologramThreshold(30)
    .setMinHologramDiff(2)
    .setMinHologramCount(1)
    .setMinLandmarkCount(3)
    .setColorDetection(false)
    .setScreenDetection(false)
    .setContentSubDetection(false)
    .setFaceTamperDetection(false)
    .setMicroprintDetection(false)
    .build();
    
Config imageConfig = new ImageConfig.Builder()
    .setMyKadThreshold(70)
    .setLandmarkThreshold(10)
    .setHologramThreshold(30)
    .setColorDetection(false)
    .setScreenDetection(false)
    .setContentSubDetection(false)
    .setFaceTamperDetection(false)
    .setMicroprintDetection(false)
    .build();
    
Config imagePathConfig = new ImagePathConfig.Builder()
    .setPath("path/to/image.jpg")
    .setMyKadThreshold(70)
    .setLandmarkThreshold(10)
    .setHologramThreshold(30)
    .setColorDetection(false)
    .setScreenDetection(false)
    .setContentSubDetection(false)
    .setFaceTamperDetection(false)
    .setMicroprintDetection(false)
    .build();
    
MyKadDetectionActivity.startDetection(this, LICENSE_KEY, 
MyKadDetectionManager.CameraType.IMAGE, imageConfig, (success, errorCode, result) -> { 
    if (success) {
        Log.d("SAMPLE", "result => " + result);
    } else {
        Log.d("SAMPLE", "error => " + errorCode);
    }
});

Configuration

ImageConfig

There are several Config files that require to configure while developing. ImageConfig will be the first listed below:

Config

Possible Input Range

Default

myKadThreshold

between 1 and 100

70

landmarkThreshold

between 1 and 100

10

hologramThreshold

between 1 and 100

30

setColorDetection

set false to disable color detection

true

setScreenDetection

set false to disable screen detection

true

setFaceTamperDetection

set false to disable face tamper detection

true

setContentSubDetection

set false to disable content substitution detection

true

setMicroprintDetection

set false to disable microprint detection

true

ImagePathConfig

As for the ImagePathConfig, it consists of ImageConfig plus image file path below:

Config

Value

SetPath

Full path to the valid image file

VideoConfig

As for the VideoConfig, it consists of ImageConfig plus the following extra configurations below:

Config

Possible Input Range

Default

minHologramDiff

between 1 and 4

2

minHologramCount

between 1 and 4

1

minLandmarkCount

between 1 and 3

3

setColorDetection

set false to disable color detection

true

setScreenDetection

set false to disable screen detection

true

setFaceTamperDetection

set false to disable face tamper detection

true

setContentSubDetection

set false to disable content substitution detection

true

setMicroprintDetection

set false to disable microprint detection

true

The configurations that left it blank will follow the default values

Result

Result is returned in ArrayList type. If video scanning is selected, there will be 2 MyKads returned: MyKad without flash and with flash. Kindly get hologram count from MyKad with flash as the holograms will be more obvious. You may get the rest of the results from MyKad without flash.

Name

Description

isValidMykad()

Return true if Mykad is valid

getHologramCount()

Number of holograms detected

getLandmarkCount()

Number of landmarks detected

isScreen()

Return true if the screen is detected

isColor()

Return true if the image is not black and

white

isFaceTampered()

Return true if the face is tempered

isContentSubstituted()

Return true if the content is substituted

isMicroprint()

Return true if the microprint is detected

Error Code

These are the error code that will be raised after process is completed.

Error Code

Constant Name

-1

MyKad.NO_ERROR

1

MyKad.ERROR_INVALID_LICENSE_KEY

2

MyKad.ERROR_PERMISSION_DENIED

3

MyKad.ERROR_USER_CANCEL_ACTION

4

MyKad.ERROR_INVALID_IMAGE

5

MyKad.ERROR_MYKAD_NOT_IN_VIEW

Last updated