-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathenroll.cc
50 lines (44 loc) · 1.36 KB
/
enroll.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020-2021 Intel Corporation. All Rights Reserved.
#include "RealSenseID/FaceAuthenticator.h"
#include <iostream>
#include <stdio.h>
class MyEnrollClbk : public RealSenseID::EnrollmentCallback
{
public:
void OnResult(const RealSenseID::EnrollStatus status) override
{
std::cout << "Result " << status << std::endl;
}
void OnProgress(const RealSenseID::FacePose pose) override
{
std::cout << "OnProgress " << pose << std::endl;
}
void OnHint(const RealSenseID::EnrollStatus hint) override
{
std::cout << "Hint " << hint << std::endl;
}
void OnFaceDetected(const std::vector<RealSenseID::FaceRect>& faces, const unsigned int ts) override
{
for (auto& face : faces)
{
printf("** Detected face %u,%u %ux%u (timestamp %u)\n", face.x, face.y, face.w, face.h, ts);
}
}
};
int main()
{
RealSenseID::FaceAuthenticator authenticator;
#ifdef _WIN32
auto status = authenticator.Connect({"COM9"});
#elif LINUX
auto status = authenticator.Connect({"/dev/ttyACM0"});
#endif
if(status != RealSenseID::Status::Ok)
{
std::cout << "Failed connecting with status " << status << std::endl;
return 1;
}
MyEnrollClbk enroll_clbk;
authenticator.Enroll(enroll_clbk, "john");
}