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.
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.
});
config = {
cameraPositionIOS: 0,
cameraId: 0,
cameraSwitchEnabled: true
}
FaceSDK.presentFaceCaptureActivityWithConfig(config, faceCaptureResponse => {
const response = FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
var config = {
"cameraPositionIOS": 0,
"cameraId": 0,
"cameraSwitchEnabled": true
};
FaceSDK.presentFaceCaptureActivityWithConfig(config).then((faceCaptureResponse) {
var response = FaceCaptureResponse.fromJson(jsonDecode(faceCaptureResponse));
// ... check response?.image for capture result.
});
config = {
cameraPositionIOS: 0,
cameraId: 0,
cameraSwitchEnabled: true
}
FaceSDK.presentFaceCaptureActivityWithConfig(config, faceCaptureResponse => {
const response = FaceSDK.FaceCaptureResponse.fromJson(JSON.parse(faceCaptureResponse));
// ... check response.image.bitmap for capture result.
}, e => { });
var config = {
cameraPositionIOS: 0,
cameraId: 0,
cameraSwitchEnabled: true
}
FaceSDK.presentFaceCaptureActivityWithConfig(config).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.