Face Capture

Automatically capture a photo with a person's face on it

Face Capture is a UI module that displays Camera UI and automatically captures a photo with a person's face on it.

Face Capture comes with a configuration allowing you to change the behavior and appearance of some UI elements. For more UI customization please check out UI Customization.

At the moment, the configuration is only available for iOS and Android platforms.

Show the Face Capture module with configuration:

Swift
Objective-C
Kotlin
Java
React Native
Flutter
Cordova
Ionic
Swift
let configuration = FaceCaptureConfiguration {
$0.cameraPosition = .front
$0.cameraSwitchEnabled = true
}
FaceSDK.service.presentFaceCaptureViewController(
from: viewController,
animated: true,
configuration: configuration,
onCapture: { response in
// ... check response.image for capture result.
},
completion: nil
)
Objective-C
RFSFaceCaptureConfiguration *configuration = [RFSFaceCaptureConfiguration configurationWithBuilder:^(RFSFaceCaptureConfigurationBuilder * _Nonnull builder) {
builder.cameraPosition = RFSCameraPositionFront;
builder.cameraSwitchEnabled = YES;
}];
[RFSFaceSDK.service presentFaceCaptureViewControllerFrom:viewController
animated:YES
configuration:configuration
onCapture:^(RFSFaceCaptureResponse * _Nonnull response) {
// ... check response.image for capture result.
} completion:nil];
Kotlin
val configuration = FaceCaptureConfiguration.Builder()
.setCameraId(0)
.setCameraSwitchEnabled(true)
.build()
FaceSDK.Instance().presentFaceCaptureActivity(this@MainActivity, configuration) { response ->
// ... check response.image for capture result.
}
Java
FaceCaptureConfiguration configuration = new FaceCaptureConfiguration.Builder()
.setCameraId(0)
.setCameraSwitchEnabled(true)
.build();
FaceSDK.Instance().presentFaceCaptureActivity(MainActivity.this, configuration, response -> {
// ... check response.getImage(); for capture result.
});
React Native
FaceSDK.presentFaceCaptureActivity(faceCaptureResponse => {
const response = FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
Flutter
FaceSDK.presentFaceCaptureActivity().then((faceCaptureResponse) {
var response = FaceCaptureResponse.fromJson(jsonDecode(faceCaptureResponse));
// ... check response?.image for capture result.
});
Cordova
FaceSDK.presentFaceCaptureActivity(faceCaptureResponse => {
const response = FaceSDK.FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
Ionic
FaceSDK.presentFaceCaptureActivity().then(faceCaptureResponse => {
const response = FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
});

When you want to keep the default configuration you can omit the configuration parameter.

For more information on FaceCaptureConfiguration and FaceCaptureResponse please see SDK Reference.