diff --git a/CHANGELOG b/CHANGELOG index 9c7eadeb7..677ace58c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-08-14 Version: 1.36.583 +- Supported Api DetectIPCPedestrian. + 2020-08-14 Version: 1.36.582 - Supported CheckCloudResourceAuthorized API. diff --git a/VERSION b/VERSION index 62fe5e041..871a4bd8e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.582 \ No newline at end of file +1.36.583 \ No newline at end of file diff --git a/facebody/CMakeLists.txt b/facebody/CMakeLists.txt index d220c8370..96fd6049e 100644 --- a/facebody/CMakeLists.txt +++ b/facebody/CMakeLists.txt @@ -25,6 +25,8 @@ set(facebody_public_header_model include/alibabacloud/facebody/model/AddFaceResult.h include/alibabacloud/facebody/model/AddFaceEntityRequest.h include/alibabacloud/facebody/model/AddFaceEntityResult.h + include/alibabacloud/facebody/model/BlurFaceRequest.h + include/alibabacloud/facebody/model/BlurFaceResult.h include/alibabacloud/facebody/model/BodyPostureRequest.h include/alibabacloud/facebody/model/BodyPostureResult.h include/alibabacloud/facebody/model/CompareFaceRequest.h @@ -43,6 +45,8 @@ set(facebody_public_header_model include/alibabacloud/facebody/model/DetectCelebrityResult.h include/alibabacloud/facebody/model/DetectFaceRequest.h include/alibabacloud/facebody/model/DetectFaceResult.h + include/alibabacloud/facebody/model/DetectIPCPedestrianRequest.h + include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h include/alibabacloud/facebody/model/DetectLivingFaceRequest.h include/alibabacloud/facebody/model/DetectLivingFaceResult.h include/alibabacloud/facebody/model/DetectMaskRequest.h @@ -94,6 +98,8 @@ set(facebody_src src/model/AddFaceResult.cc src/model/AddFaceEntityRequest.cc src/model/AddFaceEntityResult.cc + src/model/BlurFaceRequest.cc + src/model/BlurFaceResult.cc src/model/BodyPostureRequest.cc src/model/BodyPostureResult.cc src/model/CompareFaceRequest.cc @@ -112,6 +118,8 @@ set(facebody_src src/model/DetectCelebrityResult.cc src/model/DetectFaceRequest.cc src/model/DetectFaceResult.cc + src/model/DetectIPCPedestrianRequest.cc + src/model/DetectIPCPedestrianResult.cc src/model/DetectLivingFaceRequest.cc src/model/DetectLivingFaceResult.cc src/model/DetectMaskRequest.cc diff --git a/facebody/include/alibabacloud/facebody/FacebodyClient.h b/facebody/include/alibabacloud/facebody/FacebodyClient.h index a2e23bfb4..bd7912d7c 100644 --- a/facebody/include/alibabacloud/facebody/FacebodyClient.h +++ b/facebody/include/alibabacloud/facebody/FacebodyClient.h @@ -26,6 +26,8 @@ #include "model/AddFaceResult.h" #include "model/AddFaceEntityRequest.h" #include "model/AddFaceEntityResult.h" +#include "model/BlurFaceRequest.h" +#include "model/BlurFaceResult.h" #include "model/BodyPostureRequest.h" #include "model/BodyPostureResult.h" #include "model/CompareFaceRequest.h" @@ -44,6 +46,8 @@ #include "model/DetectCelebrityResult.h" #include "model/DetectFaceRequest.h" #include "model/DetectFaceResult.h" +#include "model/DetectIPCPedestrianRequest.h" +#include "model/DetectIPCPedestrianResult.h" #include "model/DetectLivingFaceRequest.h" #include "model/DetectLivingFaceResult.h" #include "model/DetectMaskRequest.h" @@ -103,6 +107,9 @@ namespace AlibabaCloud typedef Outcome AddFaceEntityOutcome; typedef std::future AddFaceEntityOutcomeCallable; typedef std::function&)> AddFaceEntityAsyncHandler; + typedef Outcome BlurFaceOutcome; + typedef std::future BlurFaceOutcomeCallable; + typedef std::function&)> BlurFaceAsyncHandler; typedef Outcome BodyPostureOutcome; typedef std::future BodyPostureOutcomeCallable; typedef std::function&)> BodyPostureAsyncHandler; @@ -130,6 +137,9 @@ namespace AlibabaCloud typedef Outcome DetectFaceOutcome; typedef std::future DetectFaceOutcomeCallable; typedef std::function&)> DetectFaceAsyncHandler; + typedef Outcome DetectIPCPedestrianOutcome; + typedef std::future DetectIPCPedestrianOutcomeCallable; + typedef std::function&)> DetectIPCPedestrianAsyncHandler; typedef Outcome DetectLivingFaceOutcome; typedef std::future DetectLivingFaceOutcomeCallable; typedef std::function&)> DetectLivingFaceAsyncHandler; @@ -207,6 +217,9 @@ namespace AlibabaCloud AddFaceEntityOutcome addFaceEntity(const Model::AddFaceEntityRequest &request)const; void addFaceEntityAsync(const Model::AddFaceEntityRequest& request, const AddFaceEntityAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; AddFaceEntityOutcomeCallable addFaceEntityCallable(const Model::AddFaceEntityRequest& request) const; + BlurFaceOutcome blurFace(const Model::BlurFaceRequest &request)const; + void blurFaceAsync(const Model::BlurFaceRequest& request, const BlurFaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + BlurFaceOutcomeCallable blurFaceCallable(const Model::BlurFaceRequest& request) const; BodyPostureOutcome bodyPosture(const Model::BodyPostureRequest &request)const; void bodyPostureAsync(const Model::BodyPostureRequest& request, const BodyPostureAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; BodyPostureOutcomeCallable bodyPostureCallable(const Model::BodyPostureRequest& request) const; @@ -234,6 +247,9 @@ namespace AlibabaCloud DetectFaceOutcome detectFace(const Model::DetectFaceRequest &request)const; void detectFaceAsync(const Model::DetectFaceRequest& request, const DetectFaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectFaceOutcomeCallable detectFaceCallable(const Model::DetectFaceRequest& request) const; + DetectIPCPedestrianOutcome detectIPCPedestrian(const Model::DetectIPCPedestrianRequest &request)const; + void detectIPCPedestrianAsync(const Model::DetectIPCPedestrianRequest& request, const DetectIPCPedestrianAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DetectIPCPedestrianOutcomeCallable detectIPCPedestrianCallable(const Model::DetectIPCPedestrianRequest& request) const; DetectLivingFaceOutcome detectLivingFace(const Model::DetectLivingFaceRequest &request)const; void detectLivingFaceAsync(const Model::DetectLivingFaceRequest& request, const DetectLivingFaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectLivingFaceOutcomeCallable detectLivingFaceCallable(const Model::DetectLivingFaceRequest& request) const; diff --git a/facebody/include/alibabacloud/facebody/model/BlurFaceRequest.h b/facebody/include/alibabacloud/facebody/model/BlurFaceRequest.h new file mode 100644 index 000000000..17aad411b --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/BlurFaceRequest.h @@ -0,0 +1,48 @@ +/* + * 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_BLURFACEREQUEST_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_BLURFACEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT BlurFaceRequest : public RpcServiceRequest + { + + public: + BlurFaceRequest(); + ~BlurFaceRequest(); + + std::string getImageURL()const; + void setImageURL(const std::string& imageURL); + + private: + std::string imageURL_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_BLURFACEREQUEST_H_ \ No newline at end of file diff --git a/facebody/include/alibabacloud/facebody/model/BlurFaceResult.h b/facebody/include/alibabacloud/facebody/model/BlurFaceResult.h new file mode 100644 index 000000000..2811079b2 --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/BlurFaceResult.h @@ -0,0 +1,55 @@ +/* + * 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_BLURFACERESULT_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_BLURFACERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT BlurFaceResult : public ServiceResult + { + public: + struct Data + { + std::string imageURL; + }; + + + BlurFaceResult(); + explicit BlurFaceResult(const std::string &payload); + ~BlurFaceResult(); + Data getData()const; + + protected: + void parse(const std::string &payload); + private: + Data data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_BLURFACERESULT_H_ \ No newline at end of file diff --git a/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianRequest.h b/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianRequest.h new file mode 100644 index 000000000..073b1942f --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianRequest.h @@ -0,0 +1,66 @@ +/* + * 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_DETECTIPCPEDESTRIANREQUEST_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_DETECTIPCPEDESTRIANREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT DetectIPCPedestrianRequest : public RpcServiceRequest + { + public: + struct URLList + { + std::string dataId; + std::string imageURL; + }; + + public: + DetectIPCPedestrianRequest(); + ~DetectIPCPedestrianRequest(); + + std::string getImageData()const; + void setImageData(const std::string& imageData); + std::vector getURLList()const; + void setURLList(const std::vector& uRLList); + bool getContinueOnError()const; + void setContinueOnError(bool continueOnError); + int getWidth()const; + void setWidth(int width); + int getHeight()const; + void setHeight(int height); + + private: + std::string imageData_; + std::vector uRLList_; + bool continueOnError_; + int width_; + int height_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTIPCPEDESTRIANREQUEST_H_ \ No newline at end of file diff --git a/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h b/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h new file mode 100644 index 000000000..a710e5089 --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/DetectIPCPedestrianResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_FACEBODY_MODEL_DETECTIPCPEDESTRIANRESULT_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_DETECTIPCPEDESTRIANRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT DetectIPCPedestrianResult : public ServiceResult + { + public: + struct Data + { + struct ImageInfoListItem + { + struct Element + { + float score; + std::vector boxes; + }; + std::string dataId; + std::string errorCode; + std::vector elements; + std::string errorMessage; + }; + std::vector imageInfoList; + }; + + + DetectIPCPedestrianResult(); + explicit DetectIPCPedestrianResult(const std::string &payload); + ~DetectIPCPedestrianResult(); + Data getData()const; + + protected: + void parse(const std::string &payload); + private: + Data data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_DETECTIPCPEDESTRIANRESULT_H_ \ No newline at end of file diff --git a/facebody/src/FacebodyClient.cc b/facebody/src/FacebodyClient.cc index 1b5bb19a0..701e6399f 100644 --- a/facebody/src/FacebodyClient.cc +++ b/facebody/src/FacebodyClient.cc @@ -31,21 +31,21 @@ FacebodyClient::FacebodyClient(const Credentials &credentials, const ClientConfi RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) { auto locationClient = std::make_shared(credentials, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "facebody"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); } FacebodyClient::FacebodyClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) { auto locationClient = std::make_shared(credentialsProvider, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "facebody"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); } FacebodyClient::FacebodyClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) { auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "facebody"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); } FacebodyClient::~FacebodyClient() @@ -123,6 +123,42 @@ FacebodyClient::AddFaceEntityOutcomeCallable FacebodyClient::addFaceEntityCallab return task->get_future(); } +FacebodyClient::BlurFaceOutcome FacebodyClient::blurFace(const BlurFaceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return BlurFaceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return BlurFaceOutcome(BlurFaceResult(outcome.result())); + else + return BlurFaceOutcome(outcome.error()); +} + +void FacebodyClient::blurFaceAsync(const BlurFaceRequest& request, const BlurFaceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, blurFace(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FacebodyClient::BlurFaceOutcomeCallable FacebodyClient::blurFaceCallable(const BlurFaceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->blurFace(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + FacebodyClient::BodyPostureOutcome FacebodyClient::bodyPosture(const BodyPostureRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -447,6 +483,42 @@ FacebodyClient::DetectFaceOutcomeCallable FacebodyClient::detectFaceCallable(con return task->get_future(); } +FacebodyClient::DetectIPCPedestrianOutcome FacebodyClient::detectIPCPedestrian(const DetectIPCPedestrianRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DetectIPCPedestrianOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DetectIPCPedestrianOutcome(DetectIPCPedestrianResult(outcome.result())); + else + return DetectIPCPedestrianOutcome(outcome.error()); +} + +void FacebodyClient::detectIPCPedestrianAsync(const DetectIPCPedestrianRequest& request, const DetectIPCPedestrianAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, detectIPCPedestrian(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FacebodyClient::DetectIPCPedestrianOutcomeCallable FacebodyClient::detectIPCPedestrianCallable(const DetectIPCPedestrianRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->detectIPCPedestrian(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + FacebodyClient::DetectLivingFaceOutcome FacebodyClient::detectLivingFace(const DetectLivingFaceRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/facebody/src/model/BlurFaceRequest.cc b/facebody/src/model/BlurFaceRequest.cc new file mode 100644 index 000000000..04961d83c --- /dev/null +++ b/facebody/src/model/BlurFaceRequest.cc @@ -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 + +using AlibabaCloud::Facebody::Model::BlurFaceRequest; + +BlurFaceRequest::BlurFaceRequest() : + RpcServiceRequest("facebody", "2019-12-30", "BlurFace") +{ + setMethod(HttpRequest::Method::Post); +} + +BlurFaceRequest::~BlurFaceRequest() +{} + +std::string BlurFaceRequest::getImageURL()const +{ + return imageURL_; +} + +void BlurFaceRequest::setImageURL(const std::string& imageURL) +{ + imageURL_ = imageURL; + setBodyParameter("ImageURL", imageURL); +} + diff --git a/facebody/src/model/BlurFaceResult.cc b/facebody/src/model/BlurFaceResult.cc new file mode 100644 index 000000000..eae658e90 --- /dev/null +++ b/facebody/src/model/BlurFaceResult.cc @@ -0,0 +1,52 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Facebody; +using namespace AlibabaCloud::Facebody::Model; + +BlurFaceResult::BlurFaceResult() : + ServiceResult() +{} + +BlurFaceResult::BlurFaceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +BlurFaceResult::~BlurFaceResult() +{} + +void BlurFaceResult::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["ImageURL"].isNull()) + data_.imageURL = dataNode["ImageURL"].asString(); + +} + +BlurFaceResult::Data BlurFaceResult::getData()const +{ + return data_; +} + diff --git a/facebody/src/model/DetectIPCPedestrianRequest.cc b/facebody/src/model/DetectIPCPedestrianRequest.cc new file mode 100644 index 000000000..67863a2b7 --- /dev/null +++ b/facebody/src/model/DetectIPCPedestrianRequest.cc @@ -0,0 +1,89 @@ +/* + * 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 + +using AlibabaCloud::Facebody::Model::DetectIPCPedestrianRequest; + +DetectIPCPedestrianRequest::DetectIPCPedestrianRequest() : + RpcServiceRequest("facebody", "2019-12-30", "DetectIPCPedestrian") +{ + setMethod(HttpRequest::Method::Post); +} + +DetectIPCPedestrianRequest::~DetectIPCPedestrianRequest() +{} + +std::string DetectIPCPedestrianRequest::getImageData()const +{ + return imageData_; +} + +void DetectIPCPedestrianRequest::setImageData(const std::string& imageData) +{ + imageData_ = imageData; + setBodyParameter("ImageData", imageData); +} + +std::vector DetectIPCPedestrianRequest::getURLList()const +{ + return uRLList_; +} + +void DetectIPCPedestrianRequest::setURLList(const std::vector& uRLList) +{ + uRLList_ = uRLList; + for(int dep1 = 0; dep1!= uRLList.size(); dep1++) { + auto uRLListObj = uRLList.at(dep1); + std::string uRLListObjStr = "URLList." + std::to_string(dep1 + 1); + setParameter(uRLListObjStr + ".DataId", uRLListObj.dataId); + setParameter(uRLListObjStr + ".ImageURL", uRLListObj.imageURL); + } +} + +bool DetectIPCPedestrianRequest::getContinueOnError()const +{ + return continueOnError_; +} + +void DetectIPCPedestrianRequest::setContinueOnError(bool continueOnError) +{ + continueOnError_ = continueOnError; + setBodyParameter("ContinueOnError", continueOnError ? "true" : "false"); +} + +int DetectIPCPedestrianRequest::getWidth()const +{ + return width_; +} + +void DetectIPCPedestrianRequest::setWidth(int width) +{ + width_ = width; + setBodyParameter("Width", std::to_string(width)); +} + +int DetectIPCPedestrianRequest::getHeight()const +{ + return height_; +} + +void DetectIPCPedestrianRequest::setHeight(int height) +{ + height_ = height; + setBodyParameter("Height", std::to_string(height)); +} + diff --git a/facebody/src/model/DetectIPCPedestrianResult.cc b/facebody/src/model/DetectIPCPedestrianResult.cc new file mode 100644 index 000000000..baa46cdda --- /dev/null +++ b/facebody/src/model/DetectIPCPedestrianResult.cc @@ -0,0 +1,73 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Facebody; +using namespace AlibabaCloud::Facebody::Model; + +DetectIPCPedestrianResult::DetectIPCPedestrianResult() : + ServiceResult() +{} + +DetectIPCPedestrianResult::DetectIPCPedestrianResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DetectIPCPedestrianResult::~DetectIPCPedestrianResult() +{} + +void DetectIPCPedestrianResult::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; + if(!dataNodeImageInfoListImageInfoListItem["ErrorCode"].isNull()) + imageInfoListItemObject.errorCode = dataNodeImageInfoListImageInfoListItem["ErrorCode"].asString(); + if(!dataNodeImageInfoListImageInfoListItem["ErrorMessage"].isNull()) + imageInfoListItemObject.errorMessage = dataNodeImageInfoListImageInfoListItem["ErrorMessage"].asString(); + if(!dataNodeImageInfoListImageInfoListItem["DataId"].isNull()) + imageInfoListItemObject.dataId = dataNodeImageInfoListImageInfoListItem["DataId"].asString(); + 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); + } + +} + +DetectIPCPedestrianResult::Data DetectIPCPedestrianResult::getData()const +{ + return data_; +} +