Pose Estimation Selfie
Changing the colors on Android
You must add a resource file on Android for AutoSelfie colors. You can find the keys in the example below.
To create this file, open the project on Android Studio right click on the res
directory and create new Android Resource file. While creating select the "Resource Type" to values.
After that modify the file as shown below. note: auto selfie module has different set of keys that you can add. If you want to use pose estimation while using the auto selfie merge the files.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="pose_estimation_oval_view_start">#000000</color>
<color name="pose_estimation_oval_view_success">#000000</color>
<color name="pose_estimation_oval_view_error">#000000</color>
<color name="pose_estimation_alert_title">#000000</color>
<color name="pose_estimation_alert_description">#000000</color>
<color name="pose_estimation_alert_try_again">#000000</color>
<color name="pose_estimation_alert_background">#000000</color>
<color name="pose_estimation_font">#000000</color>
</resources>
Changing the guide images on Android
Open the android studio and add your images with following names. The SDK will automatically use the new images for guide images.
Secondary guide images shows up at bottom, while the main guide images shows in the center of the oval view.
key | description |
---|---|
pose_estimation_main_guide_left | Main Guide (left) |
pose_estimation_main_guide_right | Main Guide (right) |
pose_estimation_main_guide_up | Main Guide (up) |
pose_estimation_main_guide_down | Main Guide (down) |
pose_estimation_main_guide_straight | Main Guide (straight) |
pose_estimation_secondary_guide_left | Secondary Guide (left) |
pose_estimation_secondary_guide_right | Secondary Guide (right) |
pose_estimation_secondary_guide_up | Secondary Guide (up) |
pose_estimation_secondary_guide_down | Secondary Guide (down) |
Pose estimation usage
Get the pose estimation module from the main AmaniSDK
instance which you have previously initialized.
const androidSettings: AndroidPoseEstimationSettings = {
poseCount: 3,
animationDuration: 500,
faceNotInside: "Your face is not inside the area",
faceNotStraight: "Your face is not straight",
faceIsTooFar: "Your face is not inside the area",
keepStraight: "Please hold stable",
alertTitle: "Verification Failed",
alertDescription: "Failed 1",
alertTryAgain: "Try again",
};
const iosSettings: IOSPoseEstimationSettings = {
faceIsOk: "Please hold stable",
notInArea: "Please align your face to the area",
faceTooSmall: "Your face is in too far",
faceTooBig: "Your face is in too close",
completed: "Verification Completed",
turnRight: "→",
turnLeft: "←",
turnUp: "↑",
turnDown: "↓",
lookStraight: "Look straight",
errorMessage:
"Please complete the steps while your face is aligned to the area",
tryAgain: "Try again",
errorTitle: "Verification Failure",
confirm: "Confirm",
next: "Next",
phonePitch: "Please hold the phone straight",
informationScreenDesc1:
"To start verification, align your face with the area",
informationScreenDesc2: "",
informationScreenTitle: "Selfie Verification Instructions",
wrongPose: "Your face must be straight",
descriptionHeader:
"Please make sure you are doing the correct pose and your face is aligned with the area",
appBackgroundColor: "000000",
appFontColor: "ffffff",
primaryButtonBackgroundColor: "ffffff",
primaryButtonTextColor: "000000",
ovalBorderColor: "ffffff",
ovalBorderSuccessColor: "00ff00",
poseCount: "3",
showOnlyArrow: "true",
buttonRadious: "10",
manualCropTimeout: 30,
};
Later on the buttons onPress
use thıs method
const onStart = useCallback(() => {
AmaniSDK.sharedInstance.poseEstimationSelfie
.start(iosSettings, androidSettings)
.then((image) => setImageData(image));
}, []);