Update DetectFace.

This commit is contained in:
sdk-team
2022-01-25 02:17:14 +00:00
parent 605dc1cf5a
commit 9b557e564e
15 changed files with 130 additions and 247 deletions

View File

@@ -71,8 +71,6 @@ set(facebody_public_header_model
include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h
include/alibabacloud/facebody/model/DetectLivingFaceRequest.h
include/alibabacloud/facebody/model/DetectLivingFaceResult.h
include/alibabacloud/facebody/model/DetectMaskRequest.h
include/alibabacloud/facebody/model/DetectMaskResult.h
include/alibabacloud/facebody/model/DetectPedestrianRequest.h
include/alibabacloud/facebody/model/DetectPedestrianResult.h
include/alibabacloud/facebody/model/DetectPedestrianIntrusionRequest.h
@@ -204,8 +202,6 @@ set(facebody_src
src/model/DetectIPCPedestrianResult.cc
src/model/DetectLivingFaceRequest.cc
src/model/DetectLivingFaceResult.cc
src/model/DetectMaskRequest.cc
src/model/DetectMaskResult.cc
src/model/DetectPedestrianRequest.cc
src/model/DetectPedestrianResult.cc
src/model/DetectPedestrianIntrusionRequest.cc

View File

@@ -72,8 +72,6 @@
#include "model/DetectIPCPedestrianResult.h"
#include "model/DetectLivingFaceRequest.h"
#include "model/DetectLivingFaceResult.h"
#include "model/DetectMaskRequest.h"
#include "model/DetectMaskResult.h"
#include "model/DetectPedestrianRequest.h"
#include "model/DetectPedestrianResult.h"
#include "model/DetectPedestrianIntrusionRequest.h"
@@ -236,9 +234,6 @@ namespace AlibabaCloud
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;
typedef Outcome<Error, Model::DetectMaskResult> DetectMaskOutcome;
typedef std::future<DetectMaskOutcome> DetectMaskOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::DetectMaskRequest&, const DetectMaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectMaskAsyncHandler;
typedef Outcome<Error, Model::DetectPedestrianResult> DetectPedestrianOutcome;
typedef std::future<DetectPedestrianOutcome> DetectPedestrianOutcomeCallable;
typedef std::function<void(const FacebodyClient*, const Model::DetectPedestrianRequest&, const DetectPedestrianOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectPedestrianAsyncHandler;
@@ -436,9 +431,6 @@ namespace AlibabaCloud
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;
DetectMaskOutcome detectMask(const Model::DetectMaskRequest &request)const;
void detectMaskAsync(const Model::DetectMaskRequest& request, const DetectMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectMaskOutcomeCallable detectMaskCallable(const Model::DetectMaskRequest& request) const;
DetectPedestrianOutcome detectPedestrian(const Model::DetectPedestrianRequest &request)const;
void detectPedestrianAsync(const Model::DetectPedestrianRequest& request, const DetectPedestrianAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectPedestrianOutcomeCallable detectPedestrianCallable(const Model::DetectPedestrianRequest& request) const;

View File

@@ -37,12 +37,18 @@ namespace AlibabaCloud
long getMaxFaceNumber()const;
void setMaxFaceNumber(long maxFaceNumber);
bool getFormatResultToJson()const;
void setFormatResultToJson(bool formatResultToJson);
bool getLandmark()const;
void setLandmark(bool landmark);
std::string getOssFile()const;
void setOssFile(const std::string& ossFile);
int getImageType()const;
void setImageType(int imageType);
bool getPose()const;
void setPose(bool pose);
std::string getRequestProxyBy()const;
void setRequestProxyBy(const std::string& requestProxyBy);
bool getQuality()const;
void setQuality(bool quality);
std::string getImageURL()const;
@@ -50,9 +56,12 @@ namespace AlibabaCloud
private:
long maxFaceNumber_;
bool formatResultToJson_;
bool landmark_;
std::string ossFile_;
int imageType_;
bool pose_;
std::string requestProxyBy_;
bool quality_;
std::string imageURL_;

View File

@@ -41,11 +41,20 @@ namespace AlibabaCloud
DetectLivingFaceRequest();
~DetectLivingFaceRequest();
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_;
};
}

View File

@@ -1,48 +0,0 @@
/*
* 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_DETECTMASKREQUEST_H_
#define ALIBABACLOUD_FACEBODY_MODEL_DETECTMASKREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/facebody/FacebodyExport.h>
namespace AlibabaCloud
{
namespace Facebody
{
namespace Model
{
class ALIBABACLOUD_FACEBODY_EXPORT DetectMaskRequest : public RpcServiceRequest
{
public:
DetectMaskRequest();
~DetectMaskRequest();
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
private:
std::string imageURL_;
};
}
}
}
#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTMASKREQUEST_H_

View File

@@ -1,56 +0,0 @@
/*
* 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_DETECTMASKRESULT_H_
#define ALIBABACLOUD_FACEBODY_MODEL_DETECTMASKRESULT_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 DetectMaskResult : public ServiceResult
{
public:
struct Data
{
int mask;
float faceProbability;
};
DetectMaskResult();
explicit DetectMaskResult(const std::string &payload);
~DetectMaskResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTMASKRESULT_H_

View File

@@ -35,13 +35,22 @@ namespace AlibabaCloud
ExtractFingerPrintRequest();
~ExtractFingerPrintRequest();
bool getFormatResultToJson()const;
void setFormatResultToJson(bool formatResultToJson);
std::string getOssFile()const;
void setOssFile(const std::string& ossFile);
std::string getImageData()const;
void setImageData(const std::string& imageData);
std::string getRequestProxyBy()const;
void setRequestProxyBy(const std::string& requestProxyBy);
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
private:
bool formatResultToJson_;
std::string ossFile_;
std::string imageData_;
std::string requestProxyBy_;
std::string imageURL_;
};

View File

@@ -951,42 +951,6 @@ FacebodyClient::DetectLivingFaceOutcomeCallable FacebodyClient::detectLivingFace
return task->get_future();
}
FacebodyClient::DetectMaskOutcome FacebodyClient::detectMask(const DetectMaskRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DetectMaskOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DetectMaskOutcome(DetectMaskResult(outcome.result()));
else
return DetectMaskOutcome(outcome.error());
}
void FacebodyClient::detectMaskAsync(const DetectMaskRequest& request, const DetectMaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, detectMask(request), context);
};
asyncExecute(new Runnable(fn));
}
FacebodyClient::DetectMaskOutcomeCallable FacebodyClient::detectMaskCallable(const DetectMaskRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DetectMaskOutcome()>>(
[this, request]()
{
return this->detectMask(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
FacebodyClient::DetectPedestrianOutcome FacebodyClient::detectPedestrian(const DetectPedestrianRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -38,6 +38,17 @@ void DetectFaceRequest::setMaxFaceNumber(long maxFaceNumber)
setBodyParameter("MaxFaceNumber", std::to_string(maxFaceNumber));
}
bool DetectFaceRequest::getFormatResultToJson()const
{
return formatResultToJson_;
}
void DetectFaceRequest::setFormatResultToJson(bool formatResultToJson)
{
formatResultToJson_ = formatResultToJson;
setParameter("FormatResultToJson", formatResultToJson ? "true" : "false");
}
bool DetectFaceRequest::getLandmark()const
{
return landmark_;
@@ -49,6 +60,17 @@ void DetectFaceRequest::setLandmark(bool landmark)
setBodyParameter("Landmark", landmark ? "true" : "false");
}
std::string DetectFaceRequest::getOssFile()const
{
return ossFile_;
}
void DetectFaceRequest::setOssFile(const std::string& ossFile)
{
ossFile_ = ossFile;
setParameter("OssFile", ossFile);
}
int DetectFaceRequest::getImageType()const
{
return imageType_;
@@ -71,6 +93,17 @@ void DetectFaceRequest::setPose(bool pose)
setBodyParameter("Pose", pose ? "true" : "false");
}
std::string DetectFaceRequest::getRequestProxyBy()const
{
return requestProxyBy_;
}
void DetectFaceRequest::setRequestProxyBy(const std::string& requestProxyBy)
{
requestProxyBy_ = requestProxyBy;
setParameter("RequestProxyBy", requestProxyBy);
}
bool DetectFaceRequest::getQuality()const
{
return quality_;

View File

@@ -27,6 +27,28 @@ DetectLivingFaceRequest::DetectLivingFaceRequest() :
DetectLivingFaceRequest::~DetectLivingFaceRequest()
{}
bool DetectLivingFaceRequest::getFormatResultToJson()const
{
return formatResultToJson_;
}
void DetectLivingFaceRequest::setFormatResultToJson(bool formatResultToJson)
{
formatResultToJson_ = formatResultToJson;
setParameter("FormatResultToJson", formatResultToJson ? "true" : "false");
}
std::string DetectLivingFaceRequest::getOssFile()const
{
return ossFile_;
}
void DetectLivingFaceRequest::setOssFile(const std::string& ossFile)
{
ossFile_ = ossFile;
setParameter("OssFile", ossFile);
}
std::vector<DetectLivingFaceRequest::Tasks> DetectLivingFaceRequest::getTasks()const
{
return tasks_;
@@ -43,3 +65,14 @@ void DetectLivingFaceRequest::setTasks(const std::vector<Tasks>& tasks)
}
}
std::string DetectLivingFaceRequest::getRequestProxyBy()const
{
return requestProxyBy_;
}
void DetectLivingFaceRequest::setRequestProxyBy(const std::string& requestProxyBy)
{
requestProxyBy_ = requestProxyBy;
setParameter("RequestProxyBy", requestProxyBy);
}

View File

@@ -1,40 +0,0 @@
/*
* 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/DetectMaskRequest.h>
using AlibabaCloud::Facebody::Model::DetectMaskRequest;
DetectMaskRequest::DetectMaskRequest() :
RpcServiceRequest("facebody", "2019-12-30", "DetectMask")
{
setMethod(HttpRequest::Method::Post);
}
DetectMaskRequest::~DetectMaskRequest()
{}
std::string DetectMaskRequest::getImageURL()const
{
return imageURL_;
}
void DetectMaskRequest::setImageURL(const std::string& imageURL)
{
imageURL_ = imageURL;
setBodyParameter("ImageURL", imageURL);
}

View File

@@ -1,54 +0,0 @@
/*
* 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/DetectMaskResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Facebody;
using namespace AlibabaCloud::Facebody::Model;
DetectMaskResult::DetectMaskResult() :
ServiceResult()
{}
DetectMaskResult::DetectMaskResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DetectMaskResult::~DetectMaskResult()
{}
void DetectMaskResult::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["Mask"].isNull())
data_.mask = std::stoi(dataNode["Mask"].asString());
if(!dataNode["FaceProbability"].isNull())
data_.faceProbability = std::stof(dataNode["FaceProbability"].asString());
}
DetectMaskResult::Data DetectMaskResult::getData()const
{
return data_;
}

View File

@@ -27,6 +27,28 @@ ExtractFingerPrintRequest::ExtractFingerPrintRequest() :
ExtractFingerPrintRequest::~ExtractFingerPrintRequest()
{}
bool ExtractFingerPrintRequest::getFormatResultToJson()const
{
return formatResultToJson_;
}
void ExtractFingerPrintRequest::setFormatResultToJson(bool formatResultToJson)
{
formatResultToJson_ = formatResultToJson;
setParameter("FormatResultToJson", formatResultToJson ? "true" : "false");
}
std::string ExtractFingerPrintRequest::getOssFile()const
{
return ossFile_;
}
void ExtractFingerPrintRequest::setOssFile(const std::string& ossFile)
{
ossFile_ = ossFile;
setParameter("OssFile", ossFile);
}
std::string ExtractFingerPrintRequest::getImageData()const
{
return imageData_;
@@ -38,6 +60,17 @@ void ExtractFingerPrintRequest::setImageData(const std::string& imageData)
setBodyParameter("ImageData", imageData);
}
std::string ExtractFingerPrintRequest::getRequestProxyBy()const
{
return requestProxyBy_;
}
void ExtractFingerPrintRequest::setRequestProxyBy(const std::string& requestProxyBy)
{
requestProxyBy_ = requestProxyBy;
setParameter("RequestProxyBy", requestProxyBy);
}
std::string ExtractFingerPrintRequest::getImageURL()const
{
return imageURL_;