BioPass ID Face SDK Flutter
Key Features • Customizations • Quick Start Guide • Prerequisites • Installation • How to use • LicenseKey • FaceConfig • Something else • Changelog • Support
Key features
- Face Detection
- We ensure that there will be only one face in the capture.
- Face Positioning
- Ensure face position in your capture for better enroll and match.
- Auto Capture
- When a face is detected the capture will be performed in how many seconds you configure.
- Resolution Control
- Configure the image size thinking about the tradeoff between image quality and API's response time.
- Aspect Ratio Control
- Fully customizable interface
Customizations
Increase the security of your applications without harming your user experience.
All customization available:
- Title Text
- Help Text
- Loading Text
- Font Family
- Face Frame
- Overlay
- Default Camera
- Capture button
Enable or disable components:
- Tittle text
- Help Text
- Capture button
- Button icons
- Flip Camera button
- Flash button
Change all colors:
- Overlay color and opacity
- Capture button color
- Capture button text color
- Flip Camera color
- Flash Button color
- Text colors
Quick Start Guide
First, you will need a license key to use the biopassid_face_sdk
. To get your license key contact us through our website BioPass ID.
Check out our official documentation for more in depth information on BioPass ID.
1. Prerequisites:
Android | iOS | |
---|---|---|
Support | SDK 24+ | iOS 14+ |
- A device with a camera
- License key
- Internet connection is required to verify the license
2. Installation
First, add biopassid_face_sdk
as a dependency in your pubspec.yaml file.
Android
Change the minimum Android sdk version to 24 (or higher) in your android/app/build.gradle
file.
minSdkVersion 24
iOS
Requires iOS 14.0 or higher.
Add to the ios/Info.plist
:
- the key
Privacy - Camera Usage Description
and a usage description.
If editing Info.plist
as text, add:
<key>NSCameraUsageDescription</key>
<string>Your camera usage description</string>
Then go into your project's ios folder and run pod install.
# Go into ios folder
$ cd ios
# Install dependencies
$ pod install
Privacy manifest file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeOtherUserContent</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
</dict>
</array>
</dict>
</plist>
3. How to use
Basic example using face detection
To use biopassid_face_sdk
in your Flutter project is as easy as follow:
import 'package:biopassid_face_sdk/biopassid_face_sdk.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Face Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
void takeFace() async {
final config = FaceConfig(licenseKey: 'your-license-key');
// If you want to use Liveness, uncomment this line
// config.liveness.enabled = true;
final controller = FaceController();
await controller.takeFace(
config: config,
onFaceCapture: (face, faceAttributes /* Only available on Liveness */) {
print('onFaceCapture: ${face.first}');
// Only available on Liveness
print('onFaceCapture: $faceAttributes');
},
// Only available on Liveness
onFaceDetected: (faceAttributes) {
print('onFaceDetected: $faceAttributes');
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Face Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: takeFace,
child: const Text('Capture Face'),
),
),
);
}
}
Example using face detection and http package to call the BioPass ID API
In this example we use facial detection in liveness mode to perform automatic facial capture and send it to the BioPass ID API.
We used the Liveness from the Multibiometrics plan.
First, add the http package. To install the http
package, add it to the dependencies section of the pubspec.yaml
file. You can find the latest version of the http package the pub.dev.
dependencies:
http: <latest_version>
Additionally, in your AndroidManifest.xml file, add the Internet permission.
<!-- Required to fetch data from the internet. -->
<uses-permission android:name="android.permission.INTERNET" />
Here, you will need an API key to be able to make requests to the BioPass ID API. To get your API key contact us through our website BioPass ID.
import 'dart:convert';
import 'package:biopassid_face_sdk/biopassid_face_sdk.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Face Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
void takeFace() async {
final config = FaceConfig(licenseKey: 'your-license-key');
config.liveness.enabled = true;
final controller = FaceController();
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) async {
// Encode image to base64 string
final imageBase64 = base64Encode(image);
// Create url
final url =
Uri.https('api.biopassid.com', 'multibiometrics/v2/liveness');
// Create headers passing your api key
final headers = {
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': 'your-api-key'
};
// Create json body
final body = json.encode({
'Spoof': {'Image': imageBase64}
});
// Execute request to BioPass ID API
final response = await http.post(
url,
headers: headers,
body: body,
);
// Handle API response
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');
},
onFaceDetected: (faceAttributes) {
print('onFaceDetected: $faceAttributes');
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Face Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: takeFace,
child: const Text('Capture Face'),
),
),
);
}
}
Basic example using face recognition
import 'dart:typed_data';
import 'package:biopassid_face_sdk/biopassid_face_sdk.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Face Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Uint8List? imageA;
Uint8List? imageB;
FaceExtract? faceExtractA;
FaceExtract? faceExtractB;
final config = FaceConfig(licenseKey: 'your-license-key');
final controller = FaceController();
final faceRecognition = FaceRecognition(licenseKey: 'your-license-key');
@override
void initState() {
super.initState();
faceRecognition.start();
}
@override
void dispose() {
faceRecognition.close();
super.dispose();
}
void extractA() async {
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) async {
setState(() => imageA = image);
faceExtractA = await faceRecognition.extract(artifact: image);
print('ExtractA: $faceExtractA');
},
);
}
void extractB() async {
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) async {
setState(() => imageB = image);
faceExtractB = await faceRecognition.extract(artifact: image);
print('ExtractB: $faceExtractB');
},
);
}
void verify() async {
if (faceExtractA != null && faceExtractB != null) {
final faceVerify = await faceRecognition.verify(
templateA: faceExtractA!.template,
templateB: faceExtractB!.template,
);
print('Verify: $faceVerify');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Face Demo'),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(
top: 54,
left: 30,
right: 30,
),
child: Column(
children: [
const Text(
'Face Recognition',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
SizedBox(
width: 150,
child: imageA != null && imageA!.isNotEmpty
? Image.memory(imageA!)
: null,
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: extractA,
child: const Text('Extract A'),
),
),
const SizedBox(height: 15),
SizedBox(
width: 150,
child: imageB != null && imageB!.isNotEmpty
? Image.memory(imageB!)
: null,
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: extractB,
child: const Text('Extract B'),
),
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: verify,
child: const Text('Verify Templates'),
),
),
const SizedBox(height: 15),
],
),
),
),
);
}
}
Example using face recognition and local DB to save templates
First, add the sqflite and path packages. To install the packages, add them to the dependencies section of the pubspec.yaml
file.
dependencies:
sqflite: <latest_version>
path: <latest_version>
Template data model
Define the Template data model:
import 'dart:typed_data';
class Template {
final int id;
final Uint8List image;
final Uint8List template;
const Template({
required this.id,
required this.image,
required this.template,
});
@override
String toString() {
return 'Template{id: $id, image: $image, template: $template}';
}
}
DBHelper
Create the DBHelper class to handle database:
import 'package:sqflite/sqflite.dart' as sql;
import 'package:path/path.dart' as path;
const tableName = 'templates';
class DbHelper {
static Future<sql.Database> database() async {
final dbPath = await sql.getDatabasesPath();
return sql.openDatabase(
path.join(dbPath, 'template.db'),
onCreate: (db, version) {
return db.execute(
'CREATE TABLE IF NOT EXISTS $tableName (id INTEGER PRIMARY KEY AUTOINCREMENT, image TEXT, template TEXT)');
},
version: 1,
);
}
static Future<void> saveTemplate(Map<String, Object> data) async {
final db = await DbHelper.database();
await db.insert(
tableName,
data,
conflictAlgorithm: sql.ConflictAlgorithm.replace,
);
}
static Future<List<Map<String, dynamic>>> getTemplates() async {
final db = await DbHelper.database();
return db.query(tableName);
}
static Future<void> deleteTemplate(int id) async {
final db = await DbHelper.database();
await db.delete(
tableName,
where: 'id = ?',
whereArgs: [id],
);
}
}
main.dart
In your main.dart:
import 'package:biopassid_face_sdk/biopassid_face_sdk.dart';
import 'package:face_local_db_example_flutter/db_helper.dart';
import 'package:flutter/material.dart';
import 'template.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Face Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final config = FaceConfig(licenseKey: 'your-license-key');
final controller = FaceController();
final faceRecognition = FaceRecognition(licenseKey: 'your-license-key');
List<Template> templates = [];
@override
void initState() {
super.initState();
faceRecognition.start();
loadData();
}
@override
void dispose() {
faceRecognition.close();
super.dispose();
}
Future<void> loadData() async {
final storedTemplates = await getAll();
setState(() => templates = storedTemplates);
}
Future<List<Template>> getAll() async {
final dataList = await DbHelper.getTemplates();
return dataList
.map((item) => Template(
id: item['id'],
image: item['image'],
template: item['template'],
))
.toList();
}
void extractTemplate() async {
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) async {
final faceExtract = await faceRecognition.extract(artifact: image);
if (faceExtract != null) {
final data = {'image': image, 'template': faceExtract.template};
await DbHelper.saveTemplate(data);
loadData();
}
},
);
}
void verifyTemplate() async {
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) async {
final faceExtract = await faceRecognition.extract(artifact: image);
if (faceExtract != null) {
final allTemplates = await getAll();
List<Template> filteredTemplates = [];
for (var template in allTemplates) {
final faceVerify = await faceRecognition.verify(
templateA: faceExtract.template, templateB: template.template);
if (faceVerify?.isGenuine == true) {
filteredTemplates.add(template);
}
}
if (filteredTemplates.isNotEmpty) {
setState(() => templates = filteredTemplates);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('No templates found')),
);
}
}
},
);
}
void removeTemplate(Template template) async {
await DbHelper.deleteTemplate(template.id);
loadData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 5,
title: const Text('Face Demo'),
),
body: Padding(
padding: const EdgeInsets.only(
top: 54,
left: 30,
right: 30,
),
child: Column(
children: [
const Text(
'Face Recognition',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
Expanded(
child: ListView.builder(
itemCount: templates.length,
itemBuilder: (context, index) => InkWell(
onLongPress: () => removeTemplate(templates[index]),
child: ListTile(
leading: CircleAvatar(
backgroundImage: MemoryImage(templates[index].image),
),
title: Text('${templates[index].id}'),
),
),
),
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: extractTemplate,
child: const Text('Add template'),
),
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: verifyTemplate,
child: const Text('Verify Template'),
),
),
const SizedBox(height: 15),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: loadData,
child: const Text('Get All'),
),
),
const SizedBox(height: 15),
],
),
),
);
}
}
4. LicenseKey
First, you will need a license key to use the biopassid_face_sdk
. To get your license key contact us through our website BioPass ID.
To use biopassid_face_sdk
you need a license key. To set the license key needed is simple as setting another attribute. Simply doing:
// Face Detection
final config = FaceConfig(licenseKey: 'your-license-key');
// Face Recognition
final faceRecognition = FaceRecognition(licenseKey: 'your-license-key');
5. Face detection callback
You can set a custom callback to receive the captured image. Note: FaceAttributes will only be available if livenes mode is enabled. You can write you own callback following this example:
void takeFace() async {
final config = FaceConfig(licenseKey: 'your-license-key');
final controller = FaceController();
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) {
print('onFaceCapture: ${image.first}');
print('onFaceCapture: $faceAttributes');
},
onFaceDetected: (faceAttributes) {
print('onFaceDetected: $faceAttributes');
},
);
}
FaceAttributes
Name | Type | Description |
---|---|---|
faceProp | double | Proportion of the area occupied by the face in the image, in percentage |
faceWidth | int | Face width, in pixels |
faceHeight | int | Face height, in pixels |
ied | int | Distance between left eye and right eye, in pixels |
bbox | Rect | Face bounding box |
rollAngle | double | The Euler angle X of the head. Indicates the rotation of the face about the axis pointing out of the image. Positive z euler angle is a counter-clockwise rotation within the image plane |
pitchAngle | double | The Euler angle X of the head. Indicates the rotation of the face about the horizontal axis of the image. Positive x euler angle is when the face is turned upward in the image that is being processed |
yawAngle | double | The Euler angle Y of the head. Indicates the rotation of the face about the vertical axis of the image. Positive y euler angle is when the face is turned towards the right side of the image that is being processed |
leftEyeOpenProbability | double | Probability that the face’s left eye is open, in percentage |
rightEyeOpenProbability | double | Probability that the face’s right eye is open, in percentage |
smilingProbability | double | Probability that the face is smiling, in percentage |
averageLightIntensity | double | The average intensity of the pixels in the image |
6. Face detection
The SDK supports 2 types of facial detection, below you can see their description and how to use them:
Basic face detection
A simpler facial detection, supporting face centering and proximity. This is the SDK's default detection. See FaceDetectionOptions to see what settings are available for this functionality. Note: For this functionality to work, liveness mode and continuous capture must be disabled. See below how to use:
final config = FaceConfig(licenseKey: 'your-license-key');
config.liveness.enabled = false; // liveness mode must be disabled. This is the default value
config.continuousCapture.enabled = false; // continuous capture must be disabled. This is the default value
config.faceDetection.enabled = true; // face detection must be enable
config.faceDetection.autoCapture = true;
config.faceDetection.multipleFacesEnabled = false;
config.faceDetection.timeToCapture = 3000; // time in milliseconds
config.faceDetection.maxFaceDetectionTime = 60000; // time in milliseconds
config.faceDetection.scoreThreshold = 0.5;
Liveness face detection (Android Only)
More accurate facial detection supporting more features beyond face centering and proximity. Ideal for those who want to have more control over facial detection. See FaceLivenessDetectionOptions to see what settings are available for this functionality. Note: This feature only works with the front camera. See below how to use:
final config = FaceConfig(licenseKey: 'your-license-key');
config.liveness.enabled = true;
config.liveness.debug = false;
config.liveness.timeToCapture = 3000; // time in milliseconds
config.liveness.maxFaceDetectionTime = 60000; // time in milliseconds
config.liveness.minFaceProp = 0.1;
config.liveness.maxFaceProp = 0.4;
config.liveness.minFaceWidth = 150;
config.liveness.minFaceHeight = 150;
config.liveness.ied = 90;
config.liveness.bboxPad = 20;
config.liveness.faceDetectionThresh = 0.5;
config.liveness.rollThresh = 4.0;
config.liveness.pitchThresh = 4.0;
config.liveness.yawThresh = 4.0;
config.liveness.closedEyesThresh = 0.7;
config.liveness.smilingThresh = 0.7;
config.liveness.tooDarkThresh = 50;
config.liveness.tooLightThresh = 170;
config.liveness.faceCentralizationThresh = 0.05;
7. Continuous capture
You can use continuous shooting to capture multiple frames at once. Additionally, you can set a maximum number of frames to be captured using maxNumberFrames. As well as capture time with timeToCapture. Note: Facial detection does not work with continuous capture. Using continuous capture is as simple as setting another attribute. Simply by doing:
final config = FaceConfig(licenseKey: 'your-license-key');
config.liveness.enabled = false; // liveness mode must be disabled. This is the default value
config.continuousCapture.enabled = true;
config.continuousCapture.timeToCapture = 1000; // capture every frame per second, time in millisecond
config.continuousCapture.maxNumberFrames = 40;
8. Face recognition (Android Only)
Extract template
Extract is a funcionality to extract a template from a given biometric image. The operation returns a FaceExtract object which contains the resulting template as a byte array and a status.
final faceRecognition = FaceRecognition(licenseKey: 'your-license-key');
final faceExtract = await faceRecognition.extract(artifact: uint8ListImage);
FaceExtract
Name | Type | Description |
---|---|---|
status | int | The resulting status |
template | Uint8List | The resulting template as a Uint8List |
Verify templates
Verify is a funcionality to compares two biometric templates. The operation returns a FaceVerify object which contains the resulting score and if the templates are correspondent.
final faceRecognition = FaceRecognition(licenseKey: 'your-license-key');
final faceVerify = await faceRecognition.verify(
templateA: uint8ListTemplate,
templateB: uint8ListTemplate,
);
FaceVerify
Name | Type | Description |
---|---|---|
isGenuine | bool | Indicates whether the informed biometric templates are correspondent or not |
score | double | Indicates the level of similarity between the two given biometrics. Its value may vary from 0 to 100 |
FaceConfig
You can also use pre-build configurations on your application, so you can automatically start using multiples services and features that better suit your application. You can instantiate each one and use it's default properties, or if you prefer you can change every config available. Here are the types that are supported right now:
FaceConfig
Name | Type | Default value |
---|---|---|
licenseKey | String | '' |
resolutionPreset | FaceResolutionPreset | FaceResolutionPreset.medium |
lensDirection | FaceCameraLensDirection | FaceCameraLensDirection.front |
imageFormat | FaceImageFormat | FaceImageFormat.jpeg |
flashEnabled | bool | false |
fontFamily | String | 'facesdk_opensans_bold' |
liveness | FaceLivenessDetectionOptions | |
continuousCapture | FaceContinuousCaptureOptions | |
faceDetection | FaceDetectionOptions | |
mask | FaceMaskOptions | |
titleText | FaceTextOptions | |
loadingText | FaceTextOptions | |
helpText | FaceTextOptions | |
feedbackText | FaceFeedbackTextOptions | |
backButton | FaceButtonOptions | |
flashButton | FaceFlashButtonOptions | |
switchCameraButton | FaceButtonOptions | |
captureButton | FaceButtonOptions |
FaceContinuousCaptureOptions
Name | Type | Default value |
---|---|---|
enabled | bool | false |
timeToCapture | int | 1000 // time in milliseconds |
maxNumberFrames | int | 40 |
FaceDetectionOptions
Name | Type | Default value | Description |
---|---|---|---|
enabled | bool | true | Activates facial detection |
autoCapture | bool | true | Activates automatic capture |
multipleFacesEnabled | bool | false | Allows the capture of photos with two or more faces |
timeToCapture | int | 3000 | Time it takes to perform an automatic capture, in miliseconds |
maxFaceDetectionTime | int | 60000 | Maximum facial detection attempt time, in miliseconds |
scoreThreshold | double | 0.5 | Minimum trust score for a detection to be considered valid. Must be a number between 0 and 1, which 0.1 would be a lower face detection trust level and 0.9 would be a higher trust level |
FaceLivenessDetectionOptions
Name | Type | Default value | Description |
---|---|---|---|
enabled | bool | false | Activates liveness |
debug | bool | false | If activated, a red rectangle will be drawn around the detected faces, in addition, it will be shown in the feedback message which attribute caused an invalid face |
timeToCapture | int | 3000 | Time it takes to perform an automatic capture, in miliseconds |
maxFaceDetectionTime | int | 60000 | Maximum facial detection attempt time, in miliseconds |
minFaceProp | double | 0.1 | Minimum limit of the proportion of the area occupied by the face in the image, in percentage |
maxFaceProp | double | 0.4 | Maximum limit on the proportion of the area occupied by the face in the image, in percentage |
minFaceWidth | int | 150 | Minimum face width, in pixels |
minFaceHeight | int | 150 | Minimum face height, in pixels |
ied | int | 90 | Minimum distance between left eye and right eye, in pixels |
bboxPad | int | 20 | Padding the face's bounding box to the edges of the image, in pixels |
faceDetectionThresh | double | 0.5 | Minimum trust score for a detection to be considered valid. Must be a number between 0 and 1, which 0.1 would be a lower face detection trust level and 0.9 would be a higher trust level |
rollThresh | double | 4.0 | The Euler angle X of the head. Indicates the rotation of the face about the axis pointing out of the image. Positive z euler angle is a counter-clockwise rotation within the image plane |
pitchThresh | double | 4.0 | The Euler angle X of the head. Indicates the rotation of the face about the horizontal axis of the image. Positive x euler angle is when the face is turned upward in the image that is being processed |
yawThresh | double | 4.0 | The Euler angle Y of the head. Indicates the rotation of the face about the vertical axis of the image. Positive y euler angle is when the face is turned towards the right side of the image that is being processed |
closedEyesThresh | double | 0.7 | Minimum probability threshold that the left eye and right eye of the face are closed, in percentage. A value less than 0.7 indicates that the eyes are likely closed |
smilingThresh | double | 0.7 | Minimum threshold for the probability that the face is smiling, in percentage. A value of 0.7 or more indicates that a person is likely to be smiling |
tooDarkThresh | int | 50 | Minimum threshold for the average intensity of the pixels in the image |
tooLightThresh | int | 170 | Maximum threshold for the average intensity of the pixels in the image |
faceCentralizationThresh | double | 0.05 | Threshold to consider the face centered, in percentage |
FaceMaskOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
type | FaceMaskFormat | FaceMaskFormat.face |
backgroundColor | Color | Color(0xCC000000) |
frameColor | Color | Color(0xFFFFFFFF) |
frameEnabledColor | Color | Color(0xFF16AC81) |
frameErrorColor | Color | Color(0xFFE25353) |
FaceFeedbackTextOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
messages | FaceFeedbackTextMessages | FaceFeedbackTextMessages() |
textColor | Color | Color(0xFFFFFFFF) |
textSize | int | 14 |
FaceFeedbackTextMessages
Name | Type | Default value |
---|---|---|
noDetection | String | 'No faces detected' |
multipleFaces | String | 'Multiple faces detected' |
faceCentered | String | 'Face centered. Do not move' |
tooClose | String | 'Turn your face away' |
tooFar | String | 'Bring your face closer' |
tooLeft | String | 'Move your face to the right' |
tooRight | String | 'Move your face to the left' |
tooUp | String | 'Move your face down' |
tooDown | String | 'Move your face up' |
invalidIED | String | 'Invalid inter-eye distance' |
faceAngleMisaligned | String | 'Misaligned face angle' |
closedEyes | String | 'Open your eyes' |
smiling | String | 'Do not smile' |
tooDark | String | 'Too dark' |
tooLight | String | 'Too light' |
FaceFlashButtonOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
backgroundColor | Color | Color(0xFFFFFFFF) |
buttonPadding | int | 0 |
buttonSize | Size | Size(56, 56) |
flashOnIconOptions | FaceIconOptions | |
flashOnLabelOptions | FaceTextOptions | |
flashOffIconOptions | FaceIconOptions | |
flashOffLabelOptions | FaceTextOptions |
FaceButtonOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
backgroundColor | Color | Color(0xFFFFFFFF) |
buttonPadding | int | 0 |
buttonSize | Size | Size(56, 56) |
iconOptions | FaceIconOptions | |
labelOptions | FaceTextOptions |
FaceIconOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
iconFile | String | 'facesdk_ic_close' |
iconColor | Color | Color(0xFF323232) |
iconSize | Size | Size(32, 32) |
FaceTextOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
content | String | '' |
textColor | Color | Color(0xFF323232) |
textSize | int | 14 |
FaceCameraLensDirection (enum)
Name |
---|
FaceCameraLensDirection.front |
FaceCameraLensDirection.back |
FaceImageFormat (enum)
Name |
---|
FaceImageFormat.jpeg |
FaceImageFormat.png |
FaceMaskFormat (enum)
Name |
---|
FaceMaskFormat.face |
FaceMaskFormat.square |
FaceMaskFormat.ellipse |
FaceResolutionPreset (enum)
Name | Resolution |
---|---|
FaceResolutionPreset.low | 240p (352x288 on iOS, 320x240 on Android) |
FaceResolutionPreset.medium | 480p (640x480 on iOS, 720x480 on Android) |
FaceResolutionPreset.high | 720p (1280x720) |
FaceResolutionPreset.veryhigh | 1080p (1920x1080) |
FaceResolutionPreset.ultrahigh | 2160p (3840x2160) |
FaceResolutionPreset.max | The highest resolution available |
How to change font family
on Android side
You can use the default font family or set one of your own. To set a font family, create a folder font under res directory in your android/app/src/main/res
. Download the font which ever you want and paste it inside font folder. All font file names must be only: lowercase a-z, 0-9, or underscore. The structure should be some thing like below.
on iOS side
To add the font files to your Xcode project:
- In Xcode, select the Project navigator.
- Drag your fonts from a Finder window into your project. This copies the fonts to your project.
- Select the font or folder with the fonts, and verify that the files show their target membership checked for your app’s targets.
Then, add the "Fonts provided by application" key to your app’s Info.plist file. For the key’s value, provide an array of strings containing the relative paths to any added font files.
In the following example, the font file is inside the fonts directory, so you use fonts/roboto_mono_bold_italic.ttf as the string value in the Info.plist file.
on Dart side
Finally, just set the font family passing the name of the font file when instantiating FaceConfig in your Flutter app.
final config = FaceConfig(
licenseKey: 'your-license-key',
fontFamily: 'roboto_mono_bold_italic',
);
How to change icon
on Android side
You can use the default icons or define one of your own. To set a icon, download the icon which ever you want and paste it inside drawable folder in your android/app/src/main/res
. All icon file names must be only: lowercase a-z, 0-9, or underscore. The structure should be some thing like below.
on iOS side
To add icon files to your Xcode project:
- In the Project navigator, select an asset catalog: a file with a .xcassets file extension.
- Drag an image from the Finder to the outline view. A new image set appears in the outline view, and the image asset appears in a well in the detail area.
on Dart side
Finally, just set the icon passing the name of the icon file when instantiating FaceConfig in your Flutter app.
final config = FaceConfig(licenseKey: 'your-license-key');
// Changing back button icon
config.backButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing switch camera button icon
config.switchCameraButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing capture button icon
config.captureButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing flash button icon
config.flashButton.flashOnIconOptions.iconFile = 'ic_baseline_camera';
config.flashButton.flashOffIconOptions.iconFile = 'ic_baseline_camera';
Something else
Do you like the Face SDK and would you like to know about our other products? We have solutions for fingerprint detection and digital signature capture.
- Face SDK
- Fingerprint SDK
- Signature SDK
Changelog
v4.0.1
- Documentation update;
- Fixed a bug where the maximum detection time was reset even after the SDK was closed.
v4.0.0
- Documentation update;
- All texts in English by default;
- Bug fixes for face centering;
- Changing the name of FaceFeedbackTextMessages properties, see faceconfig section;
- Added new liveness mode for face detection (Android only);
- Added new face recognition (Android only):
- Extract: Operation to extract a template from a given biometric image;
- Verify: Operation that compares two biometric templates.
Breaking Changes
Initialize face capture
// Before
final config = FaceConfig(licenseKey: 'your-license-key');
final controller = FaceController(
config: config,
onFaceCapture: (image) {
print('onFaceCapture: $image');
},
);
await controller.takeFace();
// Now
final config = FaceConfig(licenseKey: 'your-license-key');
final controller = FaceController();
await controller.takeFace(
config: config,
onFaceCapture: (image, faceAttributes) {
print('onFaceCapture: $image');
},
);
FaceFeedbackTextMessages
// Before
final config = FaceConfig(licenseKey: 'your-license-key');
config.feedbackText.messages.noFaceDetectedMessage = 'Nenhuma face detectada';
config.feedbackText.messages.multipleFacesDetectedMessage = 'Múltiplas faces detectadas';
config.feedbackText.messages.detectedFaceIsCenteredMessage = 'Mantenha o celular parado';
config.feedbackText.messages.detectedFaceIsTooCloseMessage = 'Afaste o rosto da câmera';
config.feedbackText.messages.detectedFaceIsTooFarMessage = 'Aproxime o rosto da câmera';
config.feedbackText.messages.detectedFaceIsOnTheLeftMessage = 'Mova o celular para a direita';
config.feedbackText.messages.detectedFaceIsOnTheRightMessage = 'Mova o celular para a esquerda';
config.feedbackText.messages.detectedFaceIsTooUpMessage = 'Mova o celular para baixo';
config.feedbackText.messages.detectedFaceIsTooDownMessage = 'Mova o celular para cima';
// Now
final config = FaceConfig(licenseKey: 'your-license-key');
config.feedbackText.messages.noDetection = 'No faces detected';
config.feedbackText.messages.multipleFaces = 'Multiple faces detected';
config.feedbackText.messages.faceCentered = 'Face centered. Do not move';
config.feedbackText.messages.tooClose = 'Turn your face away';
config.feedbackText.messages.tooFar = 'Bring your face closer';
config.feedbackText.messages.tooLeft = 'Move your face to the right';
config.feedbackText.messages.tooRight = 'Move your face to the left';
config.feedbackText.messages.tooUp = 'Move your face down';
config.feedbackText.messages.tooDown = 'Move your face up';
v3.0.2
- Documentation update;
- Connection timeout for license activation removed on Android;
- References to class R fixed on Android.
v3.0.1
- Documentation update;
- Upgrade to Kotlin 1.9.10 on Android;
- Added privacy manifest info on iOS.
v3.0.0
- Documentation update;
- Changed the minimum Android sdk version from 21 to 24, see installation section;
- Removed faceDetectionDisabledMessage from FaceFeedbackTextMessages;
- Renamed FaceMaskFormat.ellipsis to FaceMaskFormat.ellipse;
- Added new score threshold functionality to FaceDetectionOptions:
- Minimum trust score for a detection to be considered valid. Must be a number between 0 and 1, which 0.1 would be a lower face detection trust level and 0.9 would be a higher trust level. Default: 0.7.
v2.1.6
- Documentation update;
- Bug fixes on Android.
v2.1.5
- Documentation update;
- Reverted change in facial proximity calculation on Android.
v2.1.4
- Documentation update;
- Fixed a bug that caused crash when perform multiple switch camera click requests simultaneously on Android;
- Improved facial proximity calculation on Android.
v2.1.3
- Documentation update;
- Fixing bug that caused crash when clicking the back button while capturing the photo on Android.
v2.1.2
- Documentation update;
- Fixed a bug that caused the captured image to be different from the camera preview image on some devices.
v2.1.1
- Documentation update;
- Fixed a bug that left the face shape stretched on some devices.
v2.1.0
- Documentation update;
- Added screen brightness adjustment functionality during frontal captures.
v2.0.4
- Documentation update;
- Facial detection adjustment for Android.
v2.0.3
- Documentation update;
- Layout fixes for Android.
v2.0.2
- Documentation update.
v2.0.1
- Documentation update;
- Bug fix in license functionality for Android;
- Face detection improvements for Android;
- Bug fix in camera preview for Android.
v2.0.0
- Documentation update;
- Refactoring in FaceConfig;
- Refactoring in UI customization functionality.
v1.2.1
- Documentation update;
- Bug fix in maxFaceDetectionTime for Android.
v1.2.0
- Documentation update;
- Refactoring on autoCaptureTimeout:
- Now the autoCaptureTimeout is called timeToCapture.
- New feature maxFaceDetectionTime:
- It is now possible to set a maximum time that face detection will be active.
v1.1.1
- Documentation update.
v1.1.0
- New feature maxNumberFrames:
- It is now possible to set a maximum number of frames to be captured during continuous capture.
- Documentation update.
v1.0.1
- Documentation update;
- Fixed a bug that caused the camera preview image to be stretched during continuous capture for Android;
- Improved license functionality for iOS.
v1.0.0
- Documentation update;
- FaceCameraPreset Refactoring;
- Fix autoCaptute and autoCaptuteTimeout for iOS;
- Fix CustomFonts feature for iOS.
v0.1.23
- Documentation update;
- New config option autoCaptureTimeout;
- UI customization improvements:
- Added FaceScreenShape with more face shape options;
- Added progress animation during face detection.
v0.1.22
- Bug fixes;
- Documentation update.
v0.1.21
- Bug fixes.
v0.1.20
- New licensing feature.
v0.1.19
- Bug fixes.
v0.1.18
- Bug fixes;
- Flash mode fixes;
- Face detection improvement;
- New feature automatic capture;
- UI customization improvements;
- New feature face detection;
- Camera preset fix;
- Camera preview fix;
- New icon capture button;
- Fix in requesting permissions;
- Fix in performance of ContinuousCapture;
- Parameterizable screenTitle;
- New option to set text color;
- New custom capture button;
- Class name standardization;
- New option to set the font.
v0.1.13
- Removing API Integration;
- New CaptureFormat configuration.
v0.1.12
- Refactoring enroll and update person;
- Addition of delete and verify person;
- Added loading message during capture.
v0.1.11
- Adding error handling for devices that don't have a camera;
- Adding error handling for when there are no cameras available for the camera position chosen during setup;
- Addition of enroll and update person.
v0.1.10
- Update package name;
- Fix base url;
- Fix face shape.
v0.1.9
- Configuration and Integration with BioPassID SDK Android and iOS v0.1.9;
- New flashButtonEnabledColor attribute in BioPassIDStyles.
v0.1.8
- Configuration and Integration with BioPassID SDK iOS v0.1.8;
- Configuration and Integration with BioPassID SDK Android v0.1.8;
- Implemented spoof on liveness (Android);
- Bug fixes.
v0.1.7
- Configuration and Integration with BioPassID SDK Android v0.1.7;
- Configuration and Integration with BioPassID SDK iOS v0.1.7;
- Add liveness detection config;
- Implemented spoof on liveness (iOS);
- Bug fixes.
v0.1.6
- Configuration and Integration with BioPassID SDK iOS v0.1.6;
- Configuration and Integration with BioPassID SDK Android v0.1.6;
- An apiKey for each BioPassID plan;
- New way to set apiKey.
v0.1.5
- Configuration and integration with BioPassID SDK Android v0.1.5;
- Add face detection config;
- ICAO, Spoofing and APIKey variables added to config;
- BioPassIDEvent modified to return photo and response from ICAO and Spoofing endpoints.