Release PedestrianDetectAttribute.

This commit is contained in:
sdk-team
2020-10-13 03:01:48 +00:00
parent 96b3defcc9
commit 5d7d320deb
13 changed files with 392 additions and 261 deletions

View File

@@ -31,21 +31,21 @@ FacebodyClient::FacebodyClient(const Credentials &credentials, const ClientConfi
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "facebody");
}
FacebodyClient::FacebodyClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "facebody");
}
FacebodyClient::FacebodyClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "facebody");
}
FacebodyClient::~FacebodyClient()
@@ -555,42 +555,6 @@ FacebodyClient::DetectIPCPedestrianOutcomeCallable FacebodyClient::detectIPCPede
return task->get_future();
}
FacebodyClient::DetectIPCPedestrianOptimizedOutcome FacebodyClient::detectIPCPedestrianOptimized(const DetectIPCPedestrianOptimizedRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DetectIPCPedestrianOptimizedOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DetectIPCPedestrianOptimizedOutcome(DetectIPCPedestrianOptimizedResult(outcome.result()));
else
return DetectIPCPedestrianOptimizedOutcome(outcome.error());
}
void FacebodyClient::detectIPCPedestrianOptimizedAsync(const DetectIPCPedestrianOptimizedRequest& request, const DetectIPCPedestrianOptimizedAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, detectIPCPedestrianOptimized(request), context);
};
asyncExecute(new Runnable(fn));
}
FacebodyClient::DetectIPCPedestrianOptimizedOutcomeCallable FacebodyClient::detectIPCPedestrianOptimizedCallable(const DetectIPCPedestrianOptimizedRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DetectIPCPedestrianOptimizedOutcome()>>(
[this, request]()
{
return this->detectIPCPedestrianOptimized(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
FacebodyClient::DetectLivingFaceOutcome FacebodyClient::detectLivingFace(const DetectLivingFaceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1131,6 +1095,42 @@ FacebodyClient::ListFaceEntitiesOutcomeCallable FacebodyClient::listFaceEntities
return task->get_future();
}
FacebodyClient::PedestrianDetectAttributeOutcome FacebodyClient::pedestrianDetectAttribute(const PedestrianDetectAttributeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return PedestrianDetectAttributeOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return PedestrianDetectAttributeOutcome(PedestrianDetectAttributeResult(outcome.result()));
else
return PedestrianDetectAttributeOutcome(outcome.error());
}
void FacebodyClient::pedestrianDetectAttributeAsync(const PedestrianDetectAttributeRequest& request, const PedestrianDetectAttributeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, pedestrianDetectAttribute(request), context);
};
asyncExecute(new Runnable(fn));
}
FacebodyClient::PedestrianDetectAttributeOutcomeCallable FacebodyClient::pedestrianDetectAttributeCallable(const PedestrianDetectAttributeRequest &request) const
{
auto task = std::make_shared<std::packaged_task<PedestrianDetectAttributeOutcome()>>(
[this, request]()
{
return this->pedestrianDetectAttribute(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
FacebodyClient::RecognizeActionOutcome FacebodyClient::recognizeAction(const RecognizeActionRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -1,63 +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/DetectIPCPedestrianOptimizedRequest.h>
using AlibabaCloud::Facebody::Model::DetectIPCPedestrianOptimizedRequest;
DetectIPCPedestrianOptimizedRequest::DetectIPCPedestrianOptimizedRequest() :
RoaServiceRequest("facebody", "2020-09-10")
{
setResourcePath("/viapi/k8s/facebody/detect-ipc-pedestrian-optimized");
setMethod(HttpRequest::Method::Post);
}
DetectIPCPedestrianOptimizedRequest::~DetectIPCPedestrianOptimizedRequest()
{}
std::string DetectIPCPedestrianOptimizedRequest::getImageData()const
{
return imageData_;
}
void DetectIPCPedestrianOptimizedRequest::setImageData(const std::string& imageData)
{
imageData_ = imageData;
setBodyParameter("ImageData", imageData);
}
long DetectIPCPedestrianOptimizedRequest::getWidth()const
{
return width_;
}
void DetectIPCPedestrianOptimizedRequest::setWidth(long width)
{
width_ = width;
setBodyParameter("Width", std::to_string(width));
}
long DetectIPCPedestrianOptimizedRequest::getHeight()const
{
return height_;
}
void DetectIPCPedestrianOptimizedRequest::setHeight(long height)
{
height_ = height;
setBodyParameter("Height", std::to_string(height));
}

View File

@@ -1,67 +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/DetectIPCPedestrianOptimizedResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Facebody;
using namespace AlibabaCloud::Facebody::Model;
DetectIPCPedestrianOptimizedResult::DetectIPCPedestrianOptimizedResult() :
ServiceResult()
{}
DetectIPCPedestrianOptimizedResult::DetectIPCPedestrianOptimizedResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DetectIPCPedestrianOptimizedResult::~DetectIPCPedestrianOptimizedResult()
{}
void DetectIPCPedestrianOptimizedResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto allImageInfoListNode = dataNode["ImageInfoList"]["imageInfoListItem"];
for (auto dataNodeImageInfoListimageInfoListItem : allImageInfoListNode)
{
Data::ImageInfoListItem imageInfoListItemObject;
auto allElementsNode = allImageInfoListNode["Elements"]["Element"];
for (auto allImageInfoListNodeElementsElement : allElementsNode)
{
Data::ImageInfoListItem::Element elementsObject;
if(!allImageInfoListNodeElementsElement["Score"].isNull())
elementsObject.score = std::stof(allImageInfoListNodeElementsElement["Score"].asString());
auto allBoxes = value["Boxes"]["Box"];
for (auto value : allBoxes)
elementsObject.boxes.push_back(value.asString());
imageInfoListItemObject.elements.push_back(elementsObject);
}
data_.imageInfoList.push_back(imageInfoListItemObject);
}
}
DetectIPCPedestrianOptimizedResult::Data DetectIPCPedestrianOptimizedResult::getData()const
{
return data_;
}

View File

@@ -27,6 +27,17 @@ ExtractPedestrianFeatureAttributeRequest::ExtractPedestrianFeatureAttributeReque
ExtractPedestrianFeatureAttributeRequest::~ExtractPedestrianFeatureAttributeRequest()
{}
std::string ExtractPedestrianFeatureAttributeRequest::getMode()const
{
return mode_;
}
void ExtractPedestrianFeatureAttributeRequest::setMode(const std::string& mode)
{
mode_ = mode;
setBodyParameter("Mode", mode);
}
std::string ExtractPedestrianFeatureAttributeRequest::getImageURL()const
{
return imageURL_;

View File

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

View File

@@ -0,0 +1,134 @@
/*
* 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/PedestrianDetectAttributeResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Facebody;
using namespace AlibabaCloud::Facebody::Model;
PedestrianDetectAttributeResult::PedestrianDetectAttributeResult() :
ServiceResult()
{}
PedestrianDetectAttributeResult::PedestrianDetectAttributeResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
PedestrianDetectAttributeResult::~PedestrianDetectAttributeResult()
{}
void PedestrianDetectAttributeResult::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["PersonNumber"].isNull())
data_.personNumber = std::stoi(dataNode["PersonNumber"].asString());
auto allAttributesNode = dataNode["Attributes"]["AttributesItem"];
for (auto dataNodeAttributesAttributesItem : allAttributesNode)
{
Data::AttributesItem attributesItemObject;
auto ageNode = value["Age"];
if(!ageNode["Name"].isNull())
attributesItemObject.age.name = ageNode["Name"].asString();
if(!ageNode["Score"].isNull())
attributesItemObject.age.score = std::stof(ageNode["Score"].asString());
auto backpackNode = value["Backpack"];
if(!backpackNode["Name"].isNull())
attributesItemObject.backpack.name = backpackNode["Name"].asString();
if(!backpackNode["Score"].isNull())
attributesItemObject.backpack.score = std::stof(backpackNode["Score"].asString());
auto genderNode = value["Gender"];
if(!genderNode["Name"].isNull())
attributesItemObject.gender.name = genderNode["Name"].asString();
if(!genderNode["Score"].isNull())
attributesItemObject.gender.score = std::stof(genderNode["Score"].asString());
auto glassesNode = value["Glasses"];
if(!glassesNode["Name"].isNull())
attributesItemObject.glasses.name = glassesNode["Name"].asString();
if(!glassesNode["Score"].isNull())
attributesItemObject.glasses.score = std::stof(glassesNode["Score"].asString());
auto handbagNode = value["Handbag"];
if(!handbagNode["Name"].isNull())
attributesItemObject.handbag.name = handbagNode["Name"].asString();
if(!handbagNode["Score"].isNull())
attributesItemObject.handbag.score = std::stof(handbagNode["Score"].asString());
auto hatNode = value["Hat"];
if(!hatNode["Name"].isNull())
attributesItemObject.hat.name = hatNode["Name"].asString();
if(!hatNode["Score"].isNull())
attributesItemObject.hat.score = std::stof(hatNode["Score"].asString());
auto lowerColorNode = value["LowerColor"];
if(!lowerColorNode["Name"].isNull())
attributesItemObject.lowerColor.name = lowerColorNode["Name"].asString();
if(!lowerColorNode["Score"].isNull())
attributesItemObject.lowerColor.score = std::stof(lowerColorNode["Score"].asString());
auto lowerWearNode = value["LowerWear"];
if(!lowerWearNode["Name"].isNull())
attributesItemObject.lowerWear.name = lowerWearNode["Name"].asString();
if(!lowerWearNode["Score"].isNull())
attributesItemObject.lowerWear.score = std::stof(lowerWearNode["Score"].asString());
auto orientNode = value["Orient"];
if(!orientNode["Name"].isNull())
attributesItemObject.orient.name = orientNode["Name"].asString();
if(!orientNode["Score"].isNull())
attributesItemObject.orient.score = std::stof(orientNode["Score"].asString());
auto shoulderBagNode = value["ShoulderBag"];
if(!shoulderBagNode["Name"].isNull())
attributesItemObject.shoulderBag.name = shoulderBagNode["Name"].asString();
if(!shoulderBagNode["Score"].isNull())
attributesItemObject.shoulderBag.score = std::stof(shoulderBagNode["Score"].asString());
auto upperColorNode = value["UpperColor"];
if(!upperColorNode["Name"].isNull())
attributesItemObject.upperColor.name = upperColorNode["Name"].asString();
if(!upperColorNode["Score"].isNull())
attributesItemObject.upperColor.score = std::stof(upperColorNode["Score"].asString());
auto upperWearNode = value["UpperWear"];
if(!upperWearNode["Name"].isNull())
attributesItemObject.upperWear.name = upperWearNode["Name"].asString();
if(!upperWearNode["Score"].isNull())
attributesItemObject.upperWear.score = std::stof(upperWearNode["Score"].asString());
data_.attributes.push_back(attributesItemObject);
}
auto allBoxesNode = dataNode["Boxes"]["BoxesItem"];
for (auto dataNodeBoxesBoxesItem : allBoxesNode)
{
Data::BoxesItem boxesItemObject;
if(!dataNodeBoxesBoxesItem["Score"].isNull())
boxesItemObject.score = std::stof(dataNodeBoxesBoxesItem["Score"].asString());
if(!dataNodeBoxesBoxesItem["TopLeftX"].isNull())
boxesItemObject.topLeftX = std::stof(dataNodeBoxesBoxesItem["TopLeftX"].asString());
if(!dataNodeBoxesBoxesItem["TopLeftY"].isNull())
boxesItemObject.topLeftY = std::stof(dataNodeBoxesBoxesItem["TopLeftY"].asString());
if(!dataNodeBoxesBoxesItem["BottomRightX"].isNull())
boxesItemObject.bottomRightX = std::stof(dataNodeBoxesBoxesItem["BottomRightX"].asString());
if(!dataNodeBoxesBoxesItem["BottomRightY"].isNull())
boxesItemObject.bottomRightY = std::stof(dataNodeBoxesBoxesItem["BottomRightY"].asString());
data_.boxes.push_back(boxesItemObject);
}
}
PedestrianDetectAttributeResult::Data PedestrianDetectAttributeResult::getData()const
{
return data_;
}