Release CompareFaceWithMask DetectInfraredLivingFace.

This commit is contained in:
sdk-team
2023-02-03 05:47:16 +00:00
parent b85b690930
commit dbfef6a376
12 changed files with 693 additions and 1 deletions

View File

@@ -1 +1 @@
1.36.1435
1.36.1436

View File

@@ -37,6 +37,8 @@ set(facebody_public_header_model
include/alibabacloud/facebody/model/BodyPostureResult.h
include/alibabacloud/facebody/model/CompareFaceRequest.h
include/alibabacloud/facebody/model/CompareFaceResult.h
include/alibabacloud/facebody/model/CompareFaceWithMaskRequest.h
include/alibabacloud/facebody/model/CompareFaceWithMaskResult.h
include/alibabacloud/facebody/model/CountCrowdRequest.h
include/alibabacloud/facebody/model/CountCrowdResult.h
include/alibabacloud/facebody/model/CreateFaceDbRequest.h
@@ -59,6 +61,8 @@ set(facebody_public_header_model
include/alibabacloud/facebody/model/DetectFaceResult.h
include/alibabacloud/facebody/model/DetectIPCPedestrianRequest.h
include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h
include/alibabacloud/facebody/model/DetectInfraredLivingFaceRequest.h
include/alibabacloud/facebody/model/DetectInfraredLivingFaceResult.h
include/alibabacloud/facebody/model/DetectLivingFaceRequest.h
include/alibabacloud/facebody/model/DetectLivingFaceResult.h
include/alibabacloud/facebody/model/DetectPedestrianRequest.h
@@ -148,6 +152,8 @@ set(facebody_src
src/model/BodyPostureResult.cc
src/model/CompareFaceRequest.cc
src/model/CompareFaceResult.cc
src/model/CompareFaceWithMaskRequest.cc
src/model/CompareFaceWithMaskResult.cc
src/model/CountCrowdRequest.cc
src/model/CountCrowdResult.cc
src/model/CreateFaceDbRequest.cc
@@ -170,6 +176,8 @@ set(facebody_src
src/model/DetectFaceResult.cc
src/model/DetectIPCPedestrianRequest.cc
src/model/DetectIPCPedestrianResult.cc
src/model/DetectInfraredLivingFaceRequest.cc
src/model/DetectInfraredLivingFaceResult.cc
src/model/DetectLivingFaceRequest.cc
src/model/DetectLivingFaceResult.cc
src/model/DetectPedestrianRequest.cc

View File

@@ -38,6 +38,8 @@
#include "model/BodyPostureResult.h"
#include "model/CompareFaceRequest.h"
#include "model/CompareFaceResult.h"
#include "model/CompareFaceWithMaskRequest.h"
#include "model/CompareFaceWithMaskResult.h"
#include "model/CountCrowdRequest.h"
#include "model/CountCrowdResult.h"
#include "model/CreateFaceDbRequest.h"
@@ -60,6 +62,8 @@
#include "model/DetectFaceResult.h"
#include "model/DetectIPCPedestrianRequest.h"
#include "model/DetectIPCPedestrianResult.h"
#include "model/DetectInfraredLivingFaceRequest.h"
#include "model/DetectInfraredLivingFaceResult.h"
#include "model/DetectLivingFaceRequest.h"
#include "model/DetectLivingFaceResult.h"
#include "model/DetectPedestrianRequest.h"
@@ -163,6 +167,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::CompareFaceResult> CompareFaceOutcome;
typedef std::future<CompareFaceOutcome> CompareFaceOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::CompareFaceRequest&, const CompareFaceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CompareFaceAsyncHandler;
typedef Outcome<Error, Model::CompareFaceWithMaskResult> CompareFaceWithMaskOutcome;
typedef std::future<CompareFaceWithMaskOutcome> CompareFaceWithMaskOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::CompareFaceWithMaskRequest&, const CompareFaceWithMaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CompareFaceWithMaskAsyncHandler;
typedef Outcome<Error, Model::CountCrowdResult> CountCrowdOutcome;
typedef std::future<CountCrowdOutcome> CountCrowdOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::CountCrowdRequest&, const CountCrowdOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CountCrowdAsyncHandler;
@@ -196,6 +203,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::DetectIPCPedestrianResult> DetectIPCPedestrianOutcome;
typedef std::future<DetectIPCPedestrianOutcome> DetectIPCPedestrianOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::DetectIPCPedestrianRequest&, const DetectIPCPedestrianOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectIPCPedestrianAsyncHandler;
typedef Outcome<Error, Model::DetectInfraredLivingFaceResult> DetectInfraredLivingFaceOutcome;
typedef std::future<DetectInfraredLivingFaceOutcome> DetectInfraredLivingFaceOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::DetectInfraredLivingFaceRequest&, const DetectInfraredLivingFaceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectInfraredLivingFaceAsyncHandler;
typedef Outcome<Error, Model::DetectLivingFaceResult> DetectLivingFaceOutcome;
typedef std::future<DetectLivingFaceOutcome> DetectLivingFaceOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::DetectLivingFaceRequest&, const DetectLivingFaceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectLivingFaceAsyncHandler;
@@ -330,6 +340,9 @@ namespace AlibabaCloud
CompareFaceOutcome compareFace(const Model::CompareFaceRequest &request)const;
void compareFaceAsync(const Model::CompareFaceRequest& request, const CompareFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CompareFaceOutcomeCallable compareFaceCallable(const Model::CompareFaceRequest& request) const;
CompareFaceWithMaskOutcome compareFaceWithMask(const Model::CompareFaceWithMaskRequest &request)const;
void compareFaceWithMaskAsync(const Model::CompareFaceWithMaskRequest& request, const CompareFaceWithMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CompareFaceWithMaskOutcomeCallable compareFaceWithMaskCallable(const Model::CompareFaceWithMaskRequest& request) const;
CountCrowdOutcome countCrowd(const Model::CountCrowdRequest &request)const;
void countCrowdAsync(const Model::CountCrowdRequest& request, const CountCrowdAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CountCrowdOutcomeCallable countCrowdCallable(const Model::CountCrowdRequest& request) const;
@@ -363,6 +376,9 @@ namespace AlibabaCloud
DetectIPCPedestrianOutcome detectIPCPedestrian(const Model::DetectIPCPedestrianRequest &request)const;
void detectIPCPedestrianAsync(const Model::DetectIPCPedestrianRequest& request, const DetectIPCPedestrianAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectIPCPedestrianOutcomeCallable detectIPCPedestrianCallable(const Model::DetectIPCPedestrianRequest& request) const;
DetectInfraredLivingFaceOutcome detectInfraredLivingFace(const Model::DetectInfraredLivingFaceRequest &request)const;
void detectInfraredLivingFaceAsync(const Model::DetectInfraredLivingFaceRequest& request, const DetectInfraredLivingFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectInfraredLivingFaceOutcomeCallable detectInfraredLivingFaceCallable(const Model::DetectInfraredLivingFaceRequest& request) const;
DetectLivingFaceOutcome detectLivingFace(const Model::DetectLivingFaceRequest &request)const;
void detectLivingFaceAsync(const Model::DetectLivingFaceRequest& request, const DetectLivingFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectLivingFaceOutcomeCallable detectLivingFaceCallable(const Model::DetectLivingFaceRequest& request) const;

View File

@@ -0,0 +1,57 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKREQUEST_H_
#define ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKREQUEST_H_
#include <alibabacloud/facebody/FacebodyExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Facebody {
namespace Model {
class ALIBABACLOUD_FACEBODY_EXPORT CompareFaceWithMaskRequest : public RpcServiceRequest {
public:
CompareFaceWithMaskRequest();
~CompareFaceWithMaskRequest();
bool getFormatResultToJson() const;
void setFormatResultToJson(bool formatResultToJson);
float getQualityScoreThreshold() const;
void setQualityScoreThreshold(float qualityScoreThreshold);
std::string getImageURLB() const;
void setImageURLB(const std::string &imageURLB);
std::string getImageURLA() const;
void setImageURLA(const std::string &imageURLA);
std::string getOssFile() const;
void setOssFile(const std::string &ossFile);
std::string getRequestProxyBy() const;
void setRequestProxyBy(const std::string &requestProxyBy);
private:
bool formatResultToJson_;
float qualityScoreThreshold_;
std::string imageURLB_;
std::string imageURLA_;
std::string ossFile_;
std::string requestProxyBy_;
};
} // namespace Model
} // namespace Facebody
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKREQUEST_H_

View File

@@ -0,0 +1,69 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKRESULT_H_
#define ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/facebody/FacebodyExport.h>
namespace AlibabaCloud
{
namespace Facebody
{
namespace Model
{
class ALIBABACLOUD_FACEBODY_EXPORT CompareFaceWithMaskResult : public ServiceResult
{
public:
struct Data
{
float qualityScoreA;
std::string messageTips;
float qualityScoreB;
long isMaskB;
long isMaskA;
std::vector<std::string> thresholds;
float confidence;
std::vector<std::string> landmarksAList;
std::vector<std::string> landmarksBList;
std::vector<std::string> rectAList;
std::vector<std::string> rectBList;
};
CompareFaceWithMaskResult();
explicit CompareFaceWithMaskResult(const std::string &payload);
~CompareFaceWithMaskResult();
std::string getMessage()const;
Data getData()const;
std::string getCode()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
Data data_;
std::string code_;
};
}
}
}
#endif // !ALIBABACLOUD_FACEBODY_MODEL_COMPAREFACEWITHMASKRESULT_H_

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACEREQUEST_H_
#define ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACEREQUEST_H_
#include <alibabacloud/facebody/FacebodyExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Facebody {
namespace Model {
class ALIBABACLOUD_FACEBODY_EXPORT DetectInfraredLivingFaceRequest : public RpcServiceRequest {
public:
struct Tasks {
std::string imageURL;
};
DetectInfraredLivingFaceRequest();
~DetectInfraredLivingFaceRequest();
bool getFormatResultToJson() const;
void setFormatResultToJson(bool formatResultToJson);
std::string getOssFile() const;
void setOssFile(const std::string &ossFile);
std::vector<Tasks> getTasks() const;
void setTasks(const std::vector<Tasks> &tasks);
std::string getRequestProxyBy() const;
void setRequestProxyBy(const std::string &requestProxyBy);
private:
bool formatResultToJson_;
std::string ossFile_;
std::vector<Tasks> tasks_;
std::string requestProxyBy_;
};
} // namespace Model
} // namespace Facebody
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACEREQUEST_H_

View File

@@ -0,0 +1,80 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACERESULT_H_
#define ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/facebody/FacebodyExport.h>
namespace AlibabaCloud
{
namespace Facebody
{
namespace Model
{
class ALIBABACLOUD_FACEBODY_EXPORT DetectInfraredLivingFaceResult : public ServiceResult
{
public:
struct Data
{
struct ElementsItem
{
struct ResultsItem
{
struct Rect
{
long left;
long top;
long height;
long width;
};
std::string messageTips;
std::string suggestion;
Rect rect;
float rate;
std::string label;
};
std::vector<ElementsItem::ResultsItem> results;
std::string imageURL;
long faceNumber;
};
std::vector<ElementsItem> elements;
};
DetectInfraredLivingFaceResult();
explicit DetectInfraredLivingFaceResult(const std::string &payload);
~DetectInfraredLivingFaceResult();
std::string getMessage()const;
Data getData()const;
std::string getCode()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
Data data_;
std::string code_;
};
}
}
}
#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTINFRAREDLIVINGFACERESULT_H_

View File

@@ -339,6 +339,42 @@ FacebodyClient::CompareFaceOutcomeCallable FacebodyClient::compareFaceCallable(c
return task->get_future();
}
FacebodyClient::CompareFaceWithMaskOutcome FacebodyClient::compareFaceWithMask(const CompareFaceWithMaskRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CompareFaceWithMaskOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CompareFaceWithMaskOutcome(CompareFaceWithMaskResult(outcome.result()));
else
return CompareFaceWithMaskOutcome(outcome.error());
}
void FacebodyClient::compareFaceWithMaskAsync(const CompareFaceWithMaskRequest& request, const CompareFaceWithMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, compareFaceWithMask(request), context);
};
asyncExecute(new Runnable(fn));
}
FacebodyClient::CompareFaceWithMaskOutcomeCallable FacebodyClient::compareFaceWithMaskCallable(const CompareFaceWithMaskRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CompareFaceWithMaskOutcome()>>(
[this, request]()
{
return this->compareFaceWithMask(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
FacebodyClient::CountCrowdOutcome FacebodyClient::countCrowd(const CountCrowdRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -735,6 +771,42 @@ FacebodyClient::DetectIPCPedestrianOutcomeCallable FacebodyClient::detectIPCPede
return task->get_future();
}
FacebodyClient::DetectInfraredLivingFaceOutcome FacebodyClient::detectInfraredLivingFace(const DetectInfraredLivingFaceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DetectInfraredLivingFaceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DetectInfraredLivingFaceOutcome(DetectInfraredLivingFaceResult(outcome.result()));
else
return DetectInfraredLivingFaceOutcome(outcome.error());
}
void FacebodyClient::detectInfraredLivingFaceAsync(const DetectInfraredLivingFaceRequest& request, const DetectInfraredLivingFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, detectInfraredLivingFace(request), context);
};
asyncExecute(new Runnable(fn));
}
FacebodyClient::DetectInfraredLivingFaceOutcomeCallable FacebodyClient::detectInfraredLivingFaceCallable(const DetectInfraredLivingFaceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DetectInfraredLivingFaceOutcome()>>(
[this, request]()
{
return this->detectInfraredLivingFace(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
FacebodyClient::DetectLivingFaceOutcome FacebodyClient::detectLivingFace(const DetectLivingFaceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/facebody/model/CompareFaceWithMaskRequest.h>
using AlibabaCloud::Facebody::Model::CompareFaceWithMaskRequest;
CompareFaceWithMaskRequest::CompareFaceWithMaskRequest()
: RpcServiceRequest("facebody", "2019-12-30", "CompareFaceWithMask") {
setMethod(HttpRequest::Method::Post);
}
CompareFaceWithMaskRequest::~CompareFaceWithMaskRequest() {}
bool CompareFaceWithMaskRequest::getFormatResultToJson() const {
return formatResultToJson_;
}
void CompareFaceWithMaskRequest::setFormatResultToJson(bool formatResultToJson) {
formatResultToJson_ = formatResultToJson;
setParameter(std::string("FormatResultToJson"), formatResultToJson ? "true" : "false");
}
float CompareFaceWithMaskRequest::getQualityScoreThreshold() const {
return qualityScoreThreshold_;
}
void CompareFaceWithMaskRequest::setQualityScoreThreshold(float qualityScoreThreshold) {
qualityScoreThreshold_ = qualityScoreThreshold;
setBodyParameter(std::string("QualityScoreThreshold"), std::to_string(qualityScoreThreshold));
}
std::string CompareFaceWithMaskRequest::getImageURLB() const {
return imageURLB_;
}
void CompareFaceWithMaskRequest::setImageURLB(const std::string &imageURLB) {
imageURLB_ = imageURLB;
setBodyParameter(std::string("ImageURLB"), imageURLB);
}
std::string CompareFaceWithMaskRequest::getImageURLA() const {
return imageURLA_;
}
void CompareFaceWithMaskRequest::setImageURLA(const std::string &imageURLA) {
imageURLA_ = imageURLA;
setBodyParameter(std::string("ImageURLA"), imageURLA);
}
std::string CompareFaceWithMaskRequest::getOssFile() const {
return ossFile_;
}
void CompareFaceWithMaskRequest::setOssFile(const std::string &ossFile) {
ossFile_ = ossFile;
setParameter(std::string("OssFile"), ossFile);
}
std::string CompareFaceWithMaskRequest::getRequestProxyBy() const {
return requestProxyBy_;
}
void CompareFaceWithMaskRequest::setRequestProxyBy(const std::string &requestProxyBy) {
requestProxyBy_ = requestProxyBy;
setParameter(std::string("RequestProxyBy"), requestProxyBy);
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/facebody/model/CompareFaceWithMaskResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Facebody;
using namespace AlibabaCloud::Facebody::Model;
CompareFaceWithMaskResult::CompareFaceWithMaskResult() :
ServiceResult()
{}
CompareFaceWithMaskResult::CompareFaceWithMaskResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CompareFaceWithMaskResult::~CompareFaceWithMaskResult()
{}
void CompareFaceWithMaskResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["Confidence"].isNull())
data_.confidence = std::stof(dataNode["Confidence"].asString());
if(!dataNode["IsMaskA"].isNull())
data_.isMaskA = std::stol(dataNode["IsMaskA"].asString());
if(!dataNode["IsMaskB"].isNull())
data_.isMaskB = std::stol(dataNode["IsMaskB"].asString());
if(!dataNode["QualityScoreA"].isNull())
data_.qualityScoreA = std::stof(dataNode["QualityScoreA"].asString());
if(!dataNode["QualityScoreB"].isNull())
data_.qualityScoreB = std::stof(dataNode["QualityScoreB"].asString());
if(!dataNode["MessageTips"].isNull())
data_.messageTips = dataNode["MessageTips"].asString();
auto allLandmarksAList = dataNode["LandmarksAList"]["landmarksAList"];
for (auto value : allLandmarksAList)
data_.landmarksAList.push_back(value.asString());
auto allLandmarksBList = dataNode["LandmarksBList"]["landmarksBList"];
for (auto value : allLandmarksBList)
data_.landmarksBList.push_back(value.asString());
auto allRectAList = dataNode["RectAList"]["rectAList"];
for (auto value : allRectAList)
data_.rectAList.push_back(value.asString());
auto allRectBList = dataNode["RectBList"]["rectBList"];
for (auto value : allRectBList)
data_.rectBList.push_back(value.asString());
auto allThresholds = dataNode["Thresholds"]["thresholds"];
for (auto value : allThresholds)
data_.thresholds.push_back(value.asString());
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string CompareFaceWithMaskResult::getMessage()const
{
return message_;
}
CompareFaceWithMaskResult::Data CompareFaceWithMaskResult::getData()const
{
return data_;
}
std::string CompareFaceWithMaskResult::getCode()const
{
return code_;
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/facebody/model/DetectInfraredLivingFaceRequest.h>
using AlibabaCloud::Facebody::Model::DetectInfraredLivingFaceRequest;
DetectInfraredLivingFaceRequest::DetectInfraredLivingFaceRequest()
: RpcServiceRequest("facebody", "2019-12-30", "DetectInfraredLivingFace") {
setMethod(HttpRequest::Method::Post);
}
DetectInfraredLivingFaceRequest::~DetectInfraredLivingFaceRequest() {}
bool DetectInfraredLivingFaceRequest::getFormatResultToJson() const {
return formatResultToJson_;
}
void DetectInfraredLivingFaceRequest::setFormatResultToJson(bool formatResultToJson) {
formatResultToJson_ = formatResultToJson;
setParameter(std::string("FormatResultToJson"), formatResultToJson ? "true" : "false");
}
std::string DetectInfraredLivingFaceRequest::getOssFile() const {
return ossFile_;
}
void DetectInfraredLivingFaceRequest::setOssFile(const std::string &ossFile) {
ossFile_ = ossFile;
setParameter(std::string("OssFile"), ossFile);
}
std::vector<DetectInfraredLivingFaceRequest::Tasks> DetectInfraredLivingFaceRequest::getTasks() const {
return tasks_;
}
void DetectInfraredLivingFaceRequest::setTasks(const std::vector<DetectInfraredLivingFaceRequest::Tasks> &tasks) {
tasks_ = tasks;
for(int dep1 = 0; dep1 != tasks.size(); dep1++) {
auto tasksObj = tasks.at(dep1);
std::string tasksObjStr = std::string("Tasks") + "." + std::to_string(dep1 + 1);
setBodyParameter(tasksObjStr + ".ImageURL", tasksObj.imageURL);
}
}
std::string DetectInfraredLivingFaceRequest::getRequestProxyBy() const {
return requestProxyBy_;
}
void DetectInfraredLivingFaceRequest::setRequestProxyBy(const std::string &requestProxyBy) {
requestProxyBy_ = requestProxyBy;
setParameter(std::string("RequestProxyBy"), requestProxyBy);
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/facebody/model/DetectInfraredLivingFaceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Facebody;
using namespace AlibabaCloud::Facebody::Model;
DetectInfraredLivingFaceResult::DetectInfraredLivingFaceResult() :
ServiceResult()
{}
DetectInfraredLivingFaceResult::DetectInfraredLivingFaceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DetectInfraredLivingFaceResult::~DetectInfraredLivingFaceResult()
{}
void DetectInfraredLivingFaceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto allElementsNode = dataNode["Elements"]["elementsItem"];
for (auto dataNodeElementselementsItem : allElementsNode)
{
Data::ElementsItem elementsItemObject;
if(!dataNodeElementselementsItem["FaceNumber"].isNull())
elementsItemObject.faceNumber = std::stol(dataNodeElementselementsItem["FaceNumber"].asString());
if(!dataNodeElementselementsItem["ImageURL"].isNull())
elementsItemObject.imageURL = dataNodeElementselementsItem["ImageURL"].asString();
auto allResultsNode = dataNodeElementselementsItem["Results"]["resultsItem"];
for (auto dataNodeElementselementsItemResultsresultsItem : allResultsNode)
{
Data::ElementsItem::ResultsItem resultsObject;
if(!dataNodeElementselementsItemResultsresultsItem["Label"].isNull())
resultsObject.label = dataNodeElementselementsItemResultsresultsItem["Label"].asString();
if(!dataNodeElementselementsItemResultsresultsItem["Rate"].isNull())
resultsObject.rate = std::stof(dataNodeElementselementsItemResultsresultsItem["Rate"].asString());
if(!dataNodeElementselementsItemResultsresultsItem["Suggestion"].isNull())
resultsObject.suggestion = dataNodeElementselementsItemResultsresultsItem["Suggestion"].asString();
if(!dataNodeElementselementsItemResultsresultsItem["MessageTips"].isNull())
resultsObject.messageTips = dataNodeElementselementsItemResultsresultsItem["MessageTips"].asString();
auto rectNode = value["Rect"];
if(!rectNode["Height"].isNull())
resultsObject.rect.height = std::stol(rectNode["Height"].asString());
if(!rectNode["Width"].isNull())
resultsObject.rect.width = std::stol(rectNode["Width"].asString());
if(!rectNode["Top"].isNull())
resultsObject.rect.top = std::stol(rectNode["Top"].asString());
if(!rectNode["Left"].isNull())
resultsObject.rect.left = std::stol(rectNode["Left"].asString());
elementsItemObject.results.push_back(resultsObject);
}
data_.elements.push_back(elementsItemObject);
}
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string DetectInfraredLivingFaceResult::getMessage()const
{
return message_;
}
DetectInfraredLivingFaceResult::Data DetectInfraredLivingFaceResult::getData()const
{
return data_;
}
std::string DetectInfraredLivingFaceResult::getCode()const
{
return code_;
}