1 #include <iostream>
2 #include "../utils.h"
3 #include "alibabacloud/core/AlibabaCloud.h"
4 #include "alibabacloud/facebody/FacebodyClient.h"
5 #include "alibabacloud/core/CommonClient.h"
6 
7 using namespace std;
8 using namespace AlibabaCloud;
9 using namespace AlibabaCloud::Facebody;
10 
main()11 int main() {
12     utUtils utils;
13     string key = "Your-Access-Key";
14     string secret = "Your-Access-Secret";
15     InitializeSdk();
16     ClientConfiguration configuration("cn-shanghai");
17 
18     configuration.setEndpoint("facebody.cn-shanghai.aliyuncs.com");
19     FacebodyClient client(key, secret, configuration);
20     Model::CompareFaceRequest request;
21 
22     request.setMethod(HttpRequest::Method::Post);
23     request.setImageURLA("https://aibox-train-bucket.oss-cn-shanghai.aliyuncs.com/face/9_Press_Conference_Press_Conference_9_472.jpg?Expires=1608266970&OSSAccessKeyId=TMP.3Kdiw8VbXJ4JEYeZxcdf6DsDE2H43Q4QgiJKreabL6Mkym1JAgJvkapV3HPKq4jjvnALNUefBbzgGF5qJjoh4u2G2YbHhp&Signature=CL8WSF75gzeaAzWub%2BXw9nYxgaE%3D&versionId=CAEQEhiBgIDen.7PsxciIDlhYjQwMmMzZWJjZjQzYTQ4OGVlMGIyN2NlZWZjNTcw&response-content-type=application%2Foctet-stream");
24     request.setImageURLB("https://aibox-train-bucket.oss-cn-shanghai.aliyuncs.com/face/9_Press_Conference_Press_Conference_9_472.jpg?Expires=1608266970&OSSAccessKeyId=TMP.3Kdiw8VbXJ4JEYeZxcdf6DsDE2H43Q4QgiJKreabL6Mkym1JAgJvkapV3HPKq4jjvnALNUefBbzgGF5qJjoh4u2G2YbHhp&Signature=CL8WSF75gzeaAzWub%2BXw9nYxgaE%3D&versionId=CAEQEhiBgIDen.7PsxciIDlhYjQwMmMzZWJjZjQzYTQ4OGVlMGIyN2NlZWZjNTcw&response-content-type=application%2Foctet-stream");
25 
26     auto outcome =  client.compareFace(request);
27     cout << endl << "facebody describeInstances returned:" << endl;
28     cout << "error code: " << outcome.error().errorCode() << endl;
29     cout << "requestId: " << outcome.result().requestId() << endl << endl;
30 
31     cout << outcome.result().getData().confidence << endl;
32     cout << outcome.result().getData().rectAList[0] << endl;
33     cout << outcome.result().getData().rectAList[1] << endl;
34     cout << outcome.result().getData().rectAList[2] << endl;
35     cout << outcome.result().getData().rectAList[3] << endl;
36 
37     ShutdownSdk();
38 }
39