Skip to content

Commit ea543a4

Browse files
committed
Version 0.16.0
1 parent 63d8cee commit ea543a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2853
-1346
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ option(RSID_DEBUG_CONSOLE "Log everything to console" ON)
5656
option(RSID_DEBUG_FILE "Log everything to rsid_debug.log file" OFF)
5757
option(RSID_DEBUG_SERIAL "Log all serial communication" OFF)
5858
option(RSID_DEBUG_VALUES "Replace default common values with debug ones" OFF)
59-
option(RSID_PREVIEW "Enable opencv preview" OFF)
59+
option(RSID_PREVIEW "Enable preview" OFF)
6060
option(RSID_SAMPLES "Build samples" OFF)
6161
option(RSID_TIDY "Enable clang-tidy" OFF)
6262
option(RSID_DOXYGEN "Build doxygen docs" OFF)
@@ -97,8 +97,6 @@ endif()
9797
if(RSID_PREVIEW)
9898
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
9999
include(UVC)
100-
else()
101-
include(OpenCV)
102100
endif()
103101
endif()
104102

Readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ bool success = deviceController.Reboot();
289289

290290

291291
#### Preview API
292-
Host needs to have OpenCV installed.
293-
Currently 640x352 YUV format is available.
292+
Currently 704x1280 RGB format is available.
294293

295294
##### StartPreview
296295
Starts preview. Callback function that is provided as parameter will be invoked for a newly arrived image and can be rendered by your application.

cmake/OpenCV.cmake

Lines changed: 0 additions & 22 deletions
This file was deleted.

include/RealSenseID/AuthFaceprintsExtractionCallback.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#pragma once
55

6+
#include "AuthenticateStatus.h"
7+
#include "FaceRect.h"
8+
#include <vector>
9+
610
namespace RealSenseID
711
{
812
class Faceprints;
@@ -30,6 +34,17 @@ class AuthFaceprintsExtractionCallback
3034
* @param[in] hint Hint for the problem encountered.
3135
*/
3236
virtual void OnHint(const AuthenticateStatus hint) = 0;
37+
38+
39+
/**
40+
* Called to inform the client about detected faces during the authentication operation.
41+
*
42+
* @param[in] face Detected faces. First item is the selected one for the authentication operation.
43+
*/
44+
virtual void OnFaceDetected(const std::vector<FaceRect>& faces)
45+
{
46+
// default empty impl for backward compatibilty
47+
}
3348
};
3449

3550
} // namespace RealSenseID

include/RealSenseID/AuthenticationCallback.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#pragma once
55

66
#include "AuthenticateStatus.h"
7+
#include "FaceRect.h"
8+
#include<vector>
79

810
namespace RealSenseID
911
{
@@ -31,5 +33,16 @@ class RSID_API AuthenticationCallback
3133
* @param[in] hint Hint for the problem encountered.
3234
*/
3335
virtual void OnHint(const AuthenticateStatus hint) = 0;
36+
37+
38+
/**
39+
* Called to inform the client about detected faces during the authentication operation.
40+
*
41+
* @param[in] face Detected faces. First item is the selected one for the authentication operation.
42+
*/
43+
virtual void OnFaceDetected(const std::vector<FaceRect> &faces)
44+
{
45+
//default empty impl for backward compatibilty
46+
}
3447
};
3548
} // namespace RealSenseID

include/RealSenseID/DiscoverDevices.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ struct RSID_API DeviceInfo
1515
static constexpr std::size_t MaxBufferSize = 256;
1616

1717
char serialPort[MaxBufferSize];
18+
1819
};
1920

2021
std::vector<DeviceInfo> RSID_API DiscoverDevices();
22+
std::vector<int> RSID_API DiscoverCapture();
2123

2224
} // namespace RealSenseID

include/RealSenseID/EnrollFaceprintsExtractionCallback.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include "EnrollStatus.h"
77
#include "FacePose.h"
8+
#include "FaceRect.h"
9+
#include <vector>
810

911
namespace RealSenseID
1012
{
@@ -40,6 +42,16 @@ class EnrollFaceprintsExtractionCallback
4042
* @param[in] hint Hint for the problem encountered.
4143
*/
4244
virtual void OnHint(const EnrollStatus hint) = 0;
45+
46+
/**
47+
* Called to inform the client about detected faces during the authentication operation.
48+
*
49+
* @param[in] face Detected faces. First item is the selected one for the authentication operation.
50+
*/
51+
virtual void OnFaceDetected(const std::vector<FaceRect>& faces)
52+
{
53+
// default empty impl for backward compatibilty
54+
}
4355
};
4456

4557
} // namespace RealSenseID

include/RealSenseID/EnrollmentCallback.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#pragma once
55

66
#include "FacePose.h"
7+
#include "FaceRect.h"
78
#include "EnrollStatus.h"
9+
#include <vector>
810

911
namespace RealSenseID
1012
{
@@ -37,5 +39,15 @@ class RSID_API EnrollmentCallback
3739
* @param[in] hint Hint for the problem encountered.
3840
*/
3941
virtual void OnHint(const EnrollStatus hint) = 0;
42+
43+
/**
44+
* Called to inform the client about detected faces during the authentication operation.
45+
*
46+
* @param[in] face Detected faces. First item is the selected one for the authentication operation.
47+
*/
48+
virtual void OnFaceDetected(const std::vector<FaceRect> &faces)
49+
{
50+
//default empty impl for backward compatibilty
51+
}
4052
};
4153
} // namespace RealSenseID

include/RealSenseID/FaceAuthenticator.h

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "RealSenseID/SignatureCallback.h"
1414
#include "RealSenseID/Status.h"
1515
#include "RealSenseID/MatchResultHost.h"
16+
#include <cstddef>
1617

1718
#ifdef ANDROID
1819
#include "RealSenseID/AndroidSerialConfig.h"
@@ -54,7 +55,7 @@ class RSID_API FaceAuthenticator
5455
/**
5556
* Connect to device using the given Android serial config
5657
* reconnect if already connected.
57-
*
58+
*
5859
* @param[in] config Android config Serial configuration
5960
* @return Status (Status::Ok on success).
6061
*/
@@ -87,6 +88,11 @@ class RSID_API FaceAuthenticator
8788
Status Unpair();
8889
#endif // RSID_SECURE
8990

91+
/**
92+
* Max user id size is 30 bytes, 31 bytes including '\0'
93+
*/
94+
static constexpr size_t MAX_USERID_LENGTH = 31;
95+
9096
/**
9197
* Enroll a user.
9298
* Starts the enrollment process, which starts the camera, captures frames and then extracts
@@ -95,7 +101,8 @@ class RSID_API FaceAuthenticator
95101
* Once process is done, camera will be closed properly and device will be in ready state.
96102
*
97103
* @param[in] callback User defined callback to handle the process updates.
98-
* @param[in] user_id Null terminated C string of ascii chars. Max user id size is 30 bytes (max total of 31 bytes
104+
* @param[in] user_id Null terminated C string of ascii chars. Max user id size is MAX_USERID_LENGTH bytes
105+
99106
* including the terminating zero byte). user.
100107
* @return Status (Status::Ok on success).
101108
*/
@@ -116,7 +123,7 @@ class RSID_API FaceAuthenticator
116123
/**
117124
* Start Authentication Loop.
118125
* Starts infinite authentication loop. Call Cancel to stop it.
119-
*
126+
*
120127
* @param[in] callback User defined callback object to handle the process updates.
121128
* @return Status (Status::Ok on success).
122129
*/
@@ -125,7 +132,7 @@ class RSID_API FaceAuthenticator
125132
/**
126133
* Detect a spoof attempt.
127134
* This is advanced mode feature, please check if FW supports it using QueryDeviceConfig API.
128-
* Starts the spoof flow which also includes face detection,
135+
* Starts the spoof flow which also includes face detection,
129136
* During the process callbacks will be called to provide information if needed.
130137
* Once process is done, camera will be closed properly and device will be in ready state.
131138
*
@@ -166,47 +173,49 @@ class RSID_API FaceAuthenticator
166173

167174
/**
168175
* Query FW authentication settings.
169-
*
176+
*
170177
* @param[out] device_config config with settings.
171178
* @return Status (Status::Ok on success).
172179
*/
173180
Status QueryDeviceConfig(DeviceConfig& device_config);
174181

175182
/**
176183
* Query the device about all enrolled users.
177-
*
178-
* @param[out] pre-allocated array of user ids.
184+
*
185+
* @param[out] pre-allocated array of user ids. app is expected to allocated array of length = QueryNumberOfUsers(),
186+
* each entry in the array is string of size = MAX_USERID_LENGTH
179187
* @param[in/out] number of users to retrieve.
180188
* @return Status (Status::Ok on success).
181189
*/
182190
Status QueryUserIds(char** user_ids, unsigned int& number_of_users_in_out);
183191

184192
/**
185193
* Query the device about the number of enrolled users.
186-
*
194+
*
187195
* @param[out] number of users.
188196
* @return Status (Status::Ok on success).
189197
*/
190198
Status QueryNumberOfUsers(unsigned int& number_of_users);
191199

192200
/**
193201
* Prepare device to standby - for now it's saving database of users to flash.
194-
*
202+
*
195203
* @return Status (Status::Ok on success).
196204
*/
197205
Status Standby();
198206

199-
/*************************************************/
200-
/************** Server Mode Methods **************/
201-
/*************************************************/
207+
/**************************************************************************/
208+
/*************************** Host Mode Methods ****************************/
209+
/**************************************************************************/
210+
202211
/**
203212
* Attempt to extract faceprints using enrollment flow.
204213
* Starts the enrollment process, which starts the camera, captures frames, extracts
205214
* faceprints of different face-poses, and sends them to the host.
206215
* During the process callbacks will be called to provide information if needed.
207216
* Once process is done, camera will be closed properly and device will be in ready state.
208217
*
209-
* @param[in] callback User defined callback to handle the process updates.
218+
* @param[in] callback User defined callback to handle the process updates.
210219
* @return Status (Status::Ok on success).
211220
*/
212221
Status ExtractFaceprintsForEnroll(EnrollFaceprintsExtractionCallback& callback);
@@ -226,8 +235,8 @@ class RSID_API FaceAuthenticator
226235
/**
227236
* Attempt faceprints extraction in a loop using authentication flow.
228237
* Starts infinite authentication loop. Call Cancel to stop it.
229-
*
230-
* @param[in] callback User defined callback object to handle the process updates.
238+
*
239+
* @param[in] callback User defined callback object to handle the process updates.
231240
* @return Status (Status::Ok on success).
232241
*/
233242
Status ExtractFaceprintsForAuthLoop(AuthFaceprintsExtractionCallback& callback);
@@ -240,10 +249,11 @@ class RSID_API FaceAuthenticator
240249
* @param[in] new_faceprints faceprints which were extracted from a single image of a person.
241250
* @param[in] existing_faceprints faceprints which were calculated from one or more images of the same person.
242251
* @param[in] updated_faceprints a placeholder to write the updated-faceprints into, if the match was successful.
243-
* @return MatchResultHost match result, the 'success' field indicates if the two faceprints belong to the same person.
252+
* @return MatchResultHost match result, the 'success' field indicates if the two faceprints belong to the same
253+
* person.
244254
*/
245255
MatchResultHost MatchFaceprints(Faceprints& new_faceprints, Faceprints& existing_faceprints,
246-
Faceprints& updated_faceprints);
256+
Faceprints& updated_faceprints);
247257

248258
private:
249259
FaceAuthenticatorImpl* _impl = nullptr;

include/RealSenseID/FaceRect.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// License: Apache 2.0. See LICENSE file in root directory.
2+
// Copyright(c) 2020-2021 Intel Corporation. All Rights Reserved.
3+
4+
#pragma once
5+
6+
#include "RealSenseIDExports.h"
7+
#include <cstdint>
8+
9+
#pragma pack(push)
10+
#pragma pack(1)
11+
12+
namespace RealSenseID
13+
{
14+
/**
15+
* Detected face info
16+
* Upper left corner, width and height
17+
*/
18+
struct RSID_API FaceRect
19+
{
20+
uint32_t x = 0;
21+
uint32_t y = 0;
22+
uint32_t w = 0;
23+
uint32_t h = 0;
24+
};
25+
26+
} // namespace RealSenseID
27+
28+
#pragma pack(pop)

0 commit comments

Comments
 (0)