Release MonitorExamination.
This commit is contained in:
@@ -1707,6 +1707,42 @@ FacebodyClient::MergeImageFaceOutcomeCallable FacebodyClient::mergeImageFaceCall
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
FacebodyClient::MonitorExaminationOutcome FacebodyClient::monitorExamination(const MonitorExaminationRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return MonitorExaminationOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return MonitorExaminationOutcome(MonitorExaminationResult(outcome.result()));
|
||||
else
|
||||
return MonitorExaminationOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void FacebodyClient::monitorExaminationAsync(const MonitorExaminationRequest& request, const MonitorExaminationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, monitorExamination(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
FacebodyClient::MonitorExaminationOutcomeCallable FacebodyClient::monitorExaminationCallable(const MonitorExaminationRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<MonitorExaminationOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->monitorExamination(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
FacebodyClient::PedestrianDetectAttributeOutcome FacebodyClient::pedestrianDetectAttribute(const PedestrianDetectAttributeRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -39,6 +39,7 @@ void DetectLivingFaceRequest::setTasks(const std::vector<Tasks>& tasks)
|
||||
auto tasksObj = tasks.at(dep1);
|
||||
std::string tasksObjStr = "Tasks." + std::to_string(dep1 + 1);
|
||||
setParameter(tasksObjStr + ".ImageURL", tasksObj.imageURL);
|
||||
setParameter(tasksObjStr + ".ImageData", tasksObj.imageData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ void DetectLivingFaceResult::parse(const std::string &payload)
|
||||
for (auto dataNodeElementsElementResultsResult : allResultsNode)
|
||||
{
|
||||
Data::Element::Result resultsObject;
|
||||
if(!dataNodeElementsElementResultsResult["Label"].isNull())
|
||||
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Suggestion"].isNull())
|
||||
resultsObject.suggestion = dataNodeElementsElementResultsResult["Suggestion"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Rate"].isNull())
|
||||
resultsObject.rate = std::stof(dataNodeElementsElementResultsResult["Rate"].asString());
|
||||
if(!dataNodeElementsElementResultsResult["Label"].isNull())
|
||||
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
|
||||
auto allFramesNode = dataNodeElementsElementResultsResult["Frames"]["Frame"];
|
||||
for (auto dataNodeElementsElementResultsResultFramesFrame : allFramesNode)
|
||||
{
|
||||
|
||||
51
facebody/src/model/MonitorExaminationRequest.cc
Normal file
51
facebody/src/model/MonitorExaminationRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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/MonitorExaminationRequest.h>
|
||||
|
||||
using AlibabaCloud::Facebody::Model::MonitorExaminationRequest;
|
||||
|
||||
MonitorExaminationRequest::MonitorExaminationRequest() :
|
||||
RpcServiceRequest("facebody", "2019-12-30", "MonitorExamination")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
MonitorExaminationRequest::~MonitorExaminationRequest()
|
||||
{}
|
||||
|
||||
long MonitorExaminationRequest::getType()const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void MonitorExaminationRequest::setType(long type)
|
||||
{
|
||||
type_ = type;
|
||||
setBodyParameter("Type", std::to_string(type));
|
||||
}
|
||||
|
||||
std::string MonitorExaminationRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void MonitorExaminationRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
93
facebody/src/model/MonitorExaminationResult.cc
Normal file
93
facebody/src/model/MonitorExaminationResult.cc
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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/MonitorExaminationResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Facebody;
|
||||
using namespace AlibabaCloud::Facebody::Model;
|
||||
|
||||
MonitorExaminationResult::MonitorExaminationResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
MonitorExaminationResult::MonitorExaminationResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
MonitorExaminationResult::~MonitorExaminationResult()
|
||||
{}
|
||||
|
||||
void MonitorExaminationResult::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["ChatScore"].isNull())
|
||||
data_.chatScore = std::stof(dataNode["ChatScore"].asString());
|
||||
if(!dataNode["Threshold"].isNull())
|
||||
data_.threshold = std::stof(dataNode["Threshold"].asString());
|
||||
auto personInfoNode = dataNode["PersonInfo"];
|
||||
if(!personInfoNode["PersonNumber"].isNull())
|
||||
data_.personInfo.personNumber = std::stol(personInfoNode["PersonNumber"].asString());
|
||||
auto earPhoneNode = personInfoNode["EarPhone"];
|
||||
if(!earPhoneNode["Score"].isNull())
|
||||
data_.personInfo.earPhone.score = std::stof(earPhoneNode["Score"].asString());
|
||||
if(!earPhoneNode["Threshold"].isNull())
|
||||
data_.personInfo.earPhone.threshold = std::stof(earPhoneNode["Threshold"].asString());
|
||||
auto cellPhoneNode = personInfoNode["CellPhone"];
|
||||
if(!cellPhoneNode["Score"].isNull())
|
||||
data_.personInfo.cellPhone.score = std::stof(cellPhoneNode["Score"].asString());
|
||||
if(!cellPhoneNode["Threshold"].isNull())
|
||||
data_.personInfo.cellPhone.threshold = std::stof(cellPhoneNode["Threshold"].asString());
|
||||
auto faceInfoNode = dataNode["FaceInfo"];
|
||||
if(!faceInfoNode["Completeness"].isNull())
|
||||
data_.faceInfo.completeness = std::stol(faceInfoNode["Completeness"].asString());
|
||||
if(!faceInfoNode["FaceNumber"].isNull())
|
||||
data_.faceInfo.faceNumber = std::stol(faceInfoNode["FaceNumber"].asString());
|
||||
auto poseNode = faceInfoNode["Pose"];
|
||||
if(!poseNode["Pitch"].isNull())
|
||||
data_.faceInfo.pose.pitch = std::stof(poseNode["Pitch"].asString());
|
||||
if(!poseNode["Roll"].isNull())
|
||||
data_.faceInfo.pose.roll = std::stof(poseNode["Roll"].asString());
|
||||
if(!poseNode["Yaw"].isNull())
|
||||
data_.faceInfo.pose.yaw = std::stof(poseNode["Yaw"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string MonitorExaminationResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
MonitorExaminationResult::Data MonitorExaminationResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string MonitorExaminationResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ void RecognizePublicFaceRequest::setTask(const std::vector<Task>& task)
|
||||
auto taskObj = task.at(dep1);
|
||||
std::string taskObjStr = "Task." + std::to_string(dep1 + 1);
|
||||
setParameter(taskObjStr + ".ImageURL", taskObj.imageURL);
|
||||
setParameter(taskObjStr + ".ImageData", taskObj.imageData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,34 +52,34 @@ void RecognizePublicFaceResult::parse(const std::string &payload)
|
||||
for (auto dataNodeElementsElementResultsResult : allResultsNode)
|
||||
{
|
||||
Data::Element::Result resultsObject;
|
||||
if(!dataNodeElementsElementResultsResult["Label"].isNull())
|
||||
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Suggestion"].isNull())
|
||||
resultsObject.suggestion = dataNodeElementsElementResultsResult["Suggestion"].asString();
|
||||
if(!dataNodeElementsElementResultsResult["Rate"].isNull())
|
||||
resultsObject.rate = std::stof(dataNodeElementsElementResultsResult["Rate"].asString());
|
||||
if(!dataNodeElementsElementResultsResult["Label"].isNull())
|
||||
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
|
||||
auto allSubResultsNode = dataNodeElementsElementResultsResult["SubResults"]["SubResult"];
|
||||
for (auto dataNodeElementsElementResultsResultSubResultsSubResult : allSubResultsNode)
|
||||
{
|
||||
Data::Element::Result::SubResult subResultsObject;
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResult["H"].isNull())
|
||||
subResultsObject.h = std::stof(dataNodeElementsElementResultsResultSubResultsSubResult["H"].asString());
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResult["W"].isNull())
|
||||
subResultsObject.w = std::stof(dataNodeElementsElementResultsResultSubResultsSubResult["W"].asString());
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResult["X"].isNull())
|
||||
subResultsObject.x = std::stof(dataNodeElementsElementResultsResultSubResultsSubResult["X"].asString());
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResult["H"].isNull())
|
||||
subResultsObject.h = std::stof(dataNodeElementsElementResultsResultSubResultsSubResult["H"].asString());
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResult["Y"].isNull())
|
||||
subResultsObject.y = std::stof(dataNodeElementsElementResultsResultSubResultsSubResult["Y"].asString());
|
||||
auto allFacesNode = dataNodeElementsElementResultsResultSubResultsSubResult["Faces"]["Face"];
|
||||
for (auto dataNodeElementsElementResultsResultSubResultsSubResultFacesFace : allFacesNode)
|
||||
{
|
||||
Data::Element::Result::SubResult::Face facesObject;
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Rate"].isNull())
|
||||
facesObject.rate = std::stof(dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Rate"].asString());
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Id"].isNull())
|
||||
facesObject.id = dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Id"].asString();
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Name"].isNull())
|
||||
facesObject.name = dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Name"].asString();
|
||||
if(!dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Rate"].isNull())
|
||||
facesObject.rate = std::stof(dataNodeElementsElementResultsResultSubResultsSubResultFacesFace["Rate"].asString());
|
||||
subResultsObject.faces.push_back(facesObject);
|
||||
}
|
||||
resultsObject.subResults.push_back(subResultsObject);
|
||||
|
||||
Reference in New Issue
Block a user