Add ExtractPedestrianFeatureAttribute.
This commit is contained in:
@@ -627,6 +627,42 @@ FacebodyClient::EnhanceFaceOutcomeCallable FacebodyClient::enhanceFaceCallable(c
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
FacebodyClient::ExtractPedestrianFeatureAttributeOutcome FacebodyClient::extractPedestrianFeatureAttribute(const ExtractPedestrianFeatureAttributeRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ExtractPedestrianFeatureAttributeOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ExtractPedestrianFeatureAttributeOutcome(ExtractPedestrianFeatureAttributeResult(outcome.result()));
|
||||
else
|
||||
return ExtractPedestrianFeatureAttributeOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void FacebodyClient::extractPedestrianFeatureAttributeAsync(const ExtractPedestrianFeatureAttributeRequest& request, const ExtractPedestrianFeatureAttributeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, extractPedestrianFeatureAttribute(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
FacebodyClient::ExtractPedestrianFeatureAttributeOutcomeCallable FacebodyClient::extractPedestrianFeatureAttributeCallable(const ExtractPedestrianFeatureAttributeRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ExtractPedestrianFeatureAttributeOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->extractPedestrianFeatureAttribute(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
FacebodyClient::FaceBeautyOutcome FacebodyClient::faceBeauty(const FaceBeautyRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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/ExtractPedestrianFeatureAttributeRequest.h>
|
||||
|
||||
using AlibabaCloud::Facebody::Model::ExtractPedestrianFeatureAttributeRequest;
|
||||
|
||||
ExtractPedestrianFeatureAttributeRequest::ExtractPedestrianFeatureAttributeRequest() :
|
||||
RpcServiceRequest("facebody", "2019-12-30", "ExtractPedestrianFeatureAttribute")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ExtractPedestrianFeatureAttributeRequest::~ExtractPedestrianFeatureAttributeRequest()
|
||||
{}
|
||||
|
||||
std::string ExtractPedestrianFeatureAttributeRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void ExtractPedestrianFeatureAttributeRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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/ExtractPedestrianFeatureAttributeResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Facebody;
|
||||
using namespace AlibabaCloud::Facebody::Model;
|
||||
|
||||
ExtractPedestrianFeatureAttributeResult::ExtractPedestrianFeatureAttributeResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ExtractPedestrianFeatureAttributeResult::ExtractPedestrianFeatureAttributeResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ExtractPedestrianFeatureAttributeResult::~ExtractPedestrianFeatureAttributeResult()
|
||||
{}
|
||||
|
||||
void ExtractPedestrianFeatureAttributeResult::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["ObjType"].isNull())
|
||||
data_.objType = dataNode["ObjType"].asString();
|
||||
if(!dataNode["ObjTypeScore"].isNull())
|
||||
data_.objTypeScore = std::stof(dataNode["ObjTypeScore"].asString());
|
||||
if(!dataNode["Feature"].isNull())
|
||||
data_.feature = dataNode["Feature"].asString();
|
||||
if(!dataNode["QualityScore"].isNull())
|
||||
data_.qualityScore = std::stof(dataNode["QualityScore"].asString());
|
||||
if(!dataNode["UpperColor"].isNull())
|
||||
data_.upperColor = dataNode["UpperColor"].asString();
|
||||
if(!dataNode["UpperColorScore"].isNull())
|
||||
data_.upperColorScore = std::stof(dataNode["UpperColorScore"].asString());
|
||||
if(!dataNode["UpperType"].isNull())
|
||||
data_.upperType = dataNode["UpperType"].asString();
|
||||
if(!dataNode["UpperTypeScore"].isNull())
|
||||
data_.upperTypeScore = std::stof(dataNode["UpperTypeScore"].asString());
|
||||
if(!dataNode["LowerColor"].isNull())
|
||||
data_.lowerColor = dataNode["LowerColor"].asString();
|
||||
if(!dataNode["LowerColorScore"].isNull())
|
||||
data_.lowerColorScore = std::stof(dataNode["LowerColorScore"].asString());
|
||||
if(!dataNode["LowerType"].isNull())
|
||||
data_.lowerType = dataNode["LowerType"].asString();
|
||||
if(!dataNode["LowerTypeScore"].isNull())
|
||||
data_.lowerTypeScore = std::stof(dataNode["LowerTypeScore"].asString());
|
||||
if(!dataNode["Gender"].isNull())
|
||||
data_.gender = dataNode["Gender"].asString();
|
||||
if(!dataNode["GenderScore"].isNull())
|
||||
data_.genderScore = std::stof(dataNode["GenderScore"].asString());
|
||||
if(!dataNode["Hair"].isNull())
|
||||
data_.hair = dataNode["Hair"].asString();
|
||||
if(!dataNode["HairScore"].isNull())
|
||||
data_.hairScore = std::stof(dataNode["HairScore"].asString());
|
||||
if(!dataNode["Age"].isNull())
|
||||
data_.age = dataNode["Age"].asString();
|
||||
if(!dataNode["AgeScore"].isNull())
|
||||
data_.ageScore = std::stof(dataNode["AgeScore"].asString());
|
||||
|
||||
}
|
||||
|
||||
ExtractPedestrianFeatureAttributeResult::Data ExtractPedestrianFeatureAttributeResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user