Development (Face Capture)

This page contains the information of Usage, Configuration, Result of OkayCam for Android, iOS and React-native in Face Capture

Usage

For Android, a selfie camera can be launched by invoking the start method on OkayCamSelfie with context, license key, config and callback method:

  • A License Key is required to start the SDK.

OkayCamSelfie.start(this,license_key, config) {
success, images, exception -> 
    // do something with the result 
}

Configuration

  • The configuration object is optional if is calling from Kotlin.

  • The configuration object can be created and can be customised as following:

val config = OkaySelfieConfig.init(this)
config.topLabel.text = "Top Label"

List of Possible Configurations

This is a complete list of possible configurations that has been provided to the user to make any custom configuration:

-

Property

Description

Default Value

-

width

width to resize the image

null

-

imageQuality

quality of image

1.0f (range from 0 to 1.0)

-

outputPath

desired output image path

null

-

defaultCameraFacing

initial camera facing when the selfie camera is launched

CameraFacing.FRONT

topLabel

text

text of the top label

"Please align your face within the frame"

topLabel

color

color of the top label

#FFFFFF

topLabel

size

text size of the top label

24

-

bottomFrameColor

color of the bottom frame

#EB6709

-

captureBtnColor

color of the capture button

#EB144C

confirmBtnConfig

backgroundColor

background color of the confirm button

#EB144C

confirmBtnConfig

contentColor

content color of the confirm button

#FFFFFF

retakeBtnConfig

backgroundColor

background color of the retake button

#EB144C

retakeBtnConfig

contentColor

content color of the retake button

#FFFFFF

switchBtnConfig

color

color of the switch button

#FFFFFF

switchBtnConfig

show

show or hide the camera switch button

true

If there is no value is set for properties, default values will be implied.

Result Callback

  • After the image is capture or cancelled by the user, the callback method will be called.

  • Result callback has 3 parameters as follow:

Conditions

Results

Success

It will be true if the image is captured successfully, else it will return false.

Images

If it is successful, images will contain the file path the image, else it will return null.

Exception

If it is successful, the exception will be null, else it will contain the exception that occurred during the image capturing.

Base64 Conversion

import com.innov8tif.okaycam.utils.BitmapUtils;

String result = BitmapUtils.INSTANCE.convertToBase64(image);

User Interface Example

The OkayCam (face capture) camera user interface follows the design configurations from the above sections.

Example:

Last updated