Face Capture
Face Capture is a UI module that displays the 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.
Info
At the moment, the configuration is available only for the iOS and Android platforms.
Show the Face Capture module with configuration:
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
)
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];
val configuration = FaceCaptureConfiguration.Builder()
.setCameraId(0)
.setCameraSwitchEnabled(true)
.build()
FaceSDK.Instance().presentFaceCaptureActivity(this@MainActivity, configuration) { response ->
// ... check response.image for capture result.
}
FaceCaptureConfiguration configuration = new FaceCaptureConfiguration.Builder()
.setCameraId(0)
.setCameraSwitchEnabled(true)
.build();
FaceSDK.Instance().presentFaceCaptureActivity(MainActivity.this, configuration, response -> {
// ... check response.getImage(); for capture result.
});
FaceSDK.presentFaceCaptureActivity(faceCaptureResponse => {
const response = FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
FaceSDK.presentFaceCaptureActivity().then((faceCaptureResponse) {
var response = FaceCaptureResponse.fromJson(jsonDecode(faceCaptureResponse));
// ... check response?.image for capture result.
});
FaceSDK.presentFaceCaptureActivity(faceCaptureResponse => {
const response = FaceSDK.FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
FaceSDK.presentFaceCaptureActivity().then(faceCaptureResponse => {
const response = FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
});
To keep the default configuration, omit the configuration parameter.
Info
For more information on FaceCaptureConfiguration
and FaceCaptureResponse
, please see SDK Reference.