Update RecognizeIdentityCard.

This commit is contained in:
sdk-team
2023-12-06 04:00:05 +00:00
parent 78f4dae59d
commit 217a9b18ed
12 changed files with 1 additions and 570 deletions

View File

@@ -1 +1 @@
1.36.1812
1.36.1813

View File

@@ -25,8 +25,6 @@ set(ocr_public_header_model
include/alibabacloud/ocr/model/GetAsyncJobResultResult.h
include/alibabacloud/ocr/model/RecognizeBankCardRequest.h
include/alibabacloud/ocr/model/RecognizeBankCardResult.h
include/alibabacloud/ocr/model/RecognizeBusinessCardRequest.h
include/alibabacloud/ocr/model/RecognizeBusinessCardResult.h
include/alibabacloud/ocr/model/RecognizeBusinessLicenseRequest.h
include/alibabacloud/ocr/model/RecognizeBusinessLicenseResult.h
include/alibabacloud/ocr/model/RecognizeCharacterRequest.h
@@ -45,8 +43,6 @@ set(ocr_public_header_model
include/alibabacloud/ocr/model/RecognizeQrCodeResult.h
include/alibabacloud/ocr/model/RecognizeQuotaInvoiceRequest.h
include/alibabacloud/ocr/model/RecognizeQuotaInvoiceResult.h
include/alibabacloud/ocr/model/RecognizeStampRequest.h
include/alibabacloud/ocr/model/RecognizeStampResult.h
include/alibabacloud/ocr/model/RecognizeTableRequest.h
include/alibabacloud/ocr/model/RecognizeTableResult.h
include/alibabacloud/ocr/model/RecognizeTaxiInvoiceRequest.h
@@ -68,8 +64,6 @@ set(ocr_src
src/model/GetAsyncJobResultResult.cc
src/model/RecognizeBankCardRequest.cc
src/model/RecognizeBankCardResult.cc
src/model/RecognizeBusinessCardRequest.cc
src/model/RecognizeBusinessCardResult.cc
src/model/RecognizeBusinessLicenseRequest.cc
src/model/RecognizeBusinessLicenseResult.cc
src/model/RecognizeCharacterRequest.cc
@@ -88,8 +82,6 @@ set(ocr_src
src/model/RecognizeQrCodeResult.cc
src/model/RecognizeQuotaInvoiceRequest.cc
src/model/RecognizeQuotaInvoiceResult.cc
src/model/RecognizeStampRequest.cc
src/model/RecognizeStampResult.cc
src/model/RecognizeTableRequest.cc
src/model/RecognizeTableResult.cc
src/model/RecognizeTaxiInvoiceRequest.cc

View File

@@ -26,8 +26,6 @@
#include "model/GetAsyncJobResultResult.h"
#include "model/RecognizeBankCardRequest.h"
#include "model/RecognizeBankCardResult.h"
#include "model/RecognizeBusinessCardRequest.h"
#include "model/RecognizeBusinessCardResult.h"
#include "model/RecognizeBusinessLicenseRequest.h"
#include "model/RecognizeBusinessLicenseResult.h"
#include "model/RecognizeCharacterRequest.h"
@@ -46,8 +44,6 @@
#include "model/RecognizeQrCodeResult.h"
#include "model/RecognizeQuotaInvoiceRequest.h"
#include "model/RecognizeQuotaInvoiceResult.h"
#include "model/RecognizeStampRequest.h"
#include "model/RecognizeStampResult.h"
#include "model/RecognizeTableRequest.h"
#include "model/RecognizeTableResult.h"
#include "model/RecognizeTaxiInvoiceRequest.h"
@@ -77,9 +73,6 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::RecognizeBankCardResult> RecognizeBankCardOutcome;
typedef std::future<RecognizeBankCardOutcome> RecognizeBankCardOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeBankCardRequest&, const RecognizeBankCardOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeBankCardAsyncHandler;
typedef Outcome<Error, Model::RecognizeBusinessCardResult> RecognizeBusinessCardOutcome;
typedef std::future<RecognizeBusinessCardOutcome> RecognizeBusinessCardOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeBusinessCardRequest&, const RecognizeBusinessCardOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeBusinessCardAsyncHandler;
typedef Outcome<Error, Model::RecognizeBusinessLicenseResult> RecognizeBusinessLicenseOutcome;
typedef std::future<RecognizeBusinessLicenseOutcome> RecognizeBusinessLicenseOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeBusinessLicenseRequest&, const RecognizeBusinessLicenseOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeBusinessLicenseAsyncHandler;
@@ -107,9 +100,6 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::RecognizeQuotaInvoiceResult> RecognizeQuotaInvoiceOutcome;
typedef std::future<RecognizeQuotaInvoiceOutcome> RecognizeQuotaInvoiceOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeQuotaInvoiceRequest&, const RecognizeQuotaInvoiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeQuotaInvoiceAsyncHandler;
typedef Outcome<Error, Model::RecognizeStampResult> RecognizeStampOutcome;
typedef std::future<RecognizeStampOutcome> RecognizeStampOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeStampRequest&, const RecognizeStampOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeStampAsyncHandler;
typedef Outcome<Error, Model::RecognizeTableResult> RecognizeTableOutcome;
typedef std::future<RecognizeTableOutcome> RecognizeTableOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeTableRequest&, const RecognizeTableOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeTableAsyncHandler;
@@ -142,9 +132,6 @@ namespace AlibabaCloud
RecognizeBankCardOutcome recognizeBankCard(const Model::RecognizeBankCardRequest &request)const;
void recognizeBankCardAsync(const Model::RecognizeBankCardRequest& request, const RecognizeBankCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeBankCardOutcomeCallable recognizeBankCardCallable(const Model::RecognizeBankCardRequest& request) const;
RecognizeBusinessCardOutcome recognizeBusinessCard(const Model::RecognizeBusinessCardRequest &request)const;
void recognizeBusinessCardAsync(const Model::RecognizeBusinessCardRequest& request, const RecognizeBusinessCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeBusinessCardOutcomeCallable recognizeBusinessCardCallable(const Model::RecognizeBusinessCardRequest& request) const;
RecognizeBusinessLicenseOutcome recognizeBusinessLicense(const Model::RecognizeBusinessLicenseRequest &request)const;
void recognizeBusinessLicenseAsync(const Model::RecognizeBusinessLicenseRequest& request, const RecognizeBusinessLicenseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeBusinessLicenseOutcomeCallable recognizeBusinessLicenseCallable(const Model::RecognizeBusinessLicenseRequest& request) const;
@@ -172,9 +159,6 @@ namespace AlibabaCloud
RecognizeQuotaInvoiceOutcome recognizeQuotaInvoice(const Model::RecognizeQuotaInvoiceRequest &request)const;
void recognizeQuotaInvoiceAsync(const Model::RecognizeQuotaInvoiceRequest& request, const RecognizeQuotaInvoiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeQuotaInvoiceOutcomeCallable recognizeQuotaInvoiceCallable(const Model::RecognizeQuotaInvoiceRequest& request) const;
RecognizeStampOutcome recognizeStamp(const Model::RecognizeStampRequest &request)const;
void recognizeStampAsync(const Model::RecognizeStampRequest& request, const RecognizeStampAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeStampOutcomeCallable recognizeStampCallable(const Model::RecognizeStampRequest& request) const;
RecognizeTableOutcome recognizeTable(const Model::RecognizeTableRequest &request)const;
void recognizeTableAsync(const Model::RecognizeTableRequest& request, const RecognizeTableAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeTableOutcomeCallable recognizeTableCallable(const Model::RecognizeTableRequest& request) const;

View File

@@ -1,45 +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_OCR_MODEL_RECOGNIZEBUSINESSCARDREQUEST_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEBUSINESSCARDREQUEST_H_
#include <alibabacloud/ocr/OcrExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Ocr {
namespace Model {
class ALIBABACLOUD_OCR_EXPORT RecognizeBusinessCardRequest : public RpcServiceRequest {
public:
RecognizeBusinessCardRequest();
~RecognizeBusinessCardRequest();
int getImageType() const;
void setImageType(int imageType);
std::string getImageURL() const;
void setImageURL(const std::string &imageURL);
private:
int imageType_;
std::string imageURL_;
};
} // namespace Model
} // namespace Ocr
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEBUSINESSCARDREQUEST_H_

View File

@@ -1,62 +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_OCR_MODEL_RECOGNIZEBUSINESSCARDRESULT_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEBUSINESSCARDRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ocr/OcrExport.h>
namespace AlibabaCloud
{
namespace Ocr
{
namespace Model
{
class ALIBABACLOUD_OCR_EXPORT RecognizeBusinessCardResult : public ServiceResult
{
public:
struct Data
{
std::vector<std::string> addresses;
std::vector<std::string> departments;
std::vector<std::string> companies;
std::vector<std::string> emails;
std::vector<std::string> officePhoneNumbers;
std::vector<std::string> cellPhoneNumbers;
std::vector<std::string> titles;
std::string name;
};
RecognizeBusinessCardResult();
explicit RecognizeBusinessCardResult(const std::string &payload);
~RecognizeBusinessCardResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEBUSINESSCARDRESULT_H_

View File

@@ -1,45 +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_OCR_MODEL_RECOGNIZESTAMPREQUEST_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZESTAMPREQUEST_H_
#include <alibabacloud/ocr/OcrExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Ocr {
namespace Model {
class ALIBABACLOUD_OCR_EXPORT RecognizeStampRequest : public RpcServiceRequest {
public:
RecognizeStampRequest();
~RecognizeStampRequest();
int getImageType() const;
void setImageType(int imageType);
std::string getImageURL() const;
void setImageURL(const std::string &imageURL);
private:
int imageType_;
std::string imageURL_;
};
} // namespace Model
} // namespace Ocr
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZESTAMPREQUEST_H_

View File

@@ -1,78 +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_OCR_MODEL_RECOGNIZESTAMPRESULT_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZESTAMPRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/ocr/OcrExport.h>
namespace AlibabaCloud
{
namespace Ocr
{
namespace Model
{
class ALIBABACLOUD_OCR_EXPORT RecognizeStampResult : public ServiceResult
{
public:
struct Data
{
struct ResultsItem
{
struct Text
{
float confidence;
std::string content;
};
struct Roi
{
int left;
int top;
int height;
int width;
};
struct GeneralTextItem
{
float confidence;
std::string content;
};
Text text;
Roi roi;
std::vector<ResultsItem::GeneralTextItem> generalText;
};
std::vector<ResultsItem> results;
};
RecognizeStampResult();
explicit RecognizeStampResult(const std::string &payload);
~RecognizeStampResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZESTAMPRESULT_H_

View File

@@ -123,42 +123,6 @@ OcrClient::RecognizeBankCardOutcomeCallable OcrClient::recognizeBankCardCallable
return task->get_future();
}
OcrClient::RecognizeBusinessCardOutcome OcrClient::recognizeBusinessCard(const RecognizeBusinessCardRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RecognizeBusinessCardOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RecognizeBusinessCardOutcome(RecognizeBusinessCardResult(outcome.result()));
else
return RecognizeBusinessCardOutcome(outcome.error());
}
void OcrClient::recognizeBusinessCardAsync(const RecognizeBusinessCardRequest& request, const RecognizeBusinessCardAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, recognizeBusinessCard(request), context);
};
asyncExecute(new Runnable(fn));
}
OcrClient::RecognizeBusinessCardOutcomeCallable OcrClient::recognizeBusinessCardCallable(const RecognizeBusinessCardRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RecognizeBusinessCardOutcome()>>(
[this, request]()
{
return this->recognizeBusinessCard(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OcrClient::RecognizeBusinessLicenseOutcome OcrClient::recognizeBusinessLicense(const RecognizeBusinessLicenseRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -483,42 +447,6 @@ OcrClient::RecognizeQuotaInvoiceOutcomeCallable OcrClient::recognizeQuotaInvoice
return task->get_future();
}
OcrClient::RecognizeStampOutcome OcrClient::recognizeStamp(const RecognizeStampRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RecognizeStampOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RecognizeStampOutcome(RecognizeStampResult(outcome.result()));
else
return RecognizeStampOutcome(outcome.error());
}
void OcrClient::recognizeStampAsync(const RecognizeStampRequest& request, const RecognizeStampAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, recognizeStamp(request), context);
};
asyncExecute(new Runnable(fn));
}
OcrClient::RecognizeStampOutcomeCallable OcrClient::recognizeStampCallable(const RecognizeStampRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RecognizeStampOutcome()>>(
[this, request]()
{
return this->recognizeStamp(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OcrClient::RecognizeTableOutcome OcrClient::recognizeTable(const RecognizeTableRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -1,45 +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/ocr/model/RecognizeBusinessCardRequest.h>
using AlibabaCloud::Ocr::Model::RecognizeBusinessCardRequest;
RecognizeBusinessCardRequest::RecognizeBusinessCardRequest()
: RpcServiceRequest("ocr", "2019-12-30", "RecognizeBusinessCard") {
setMethod(HttpRequest::Method::Post);
}
RecognizeBusinessCardRequest::~RecognizeBusinessCardRequest() {}
int RecognizeBusinessCardRequest::getImageType() const {
return imageType_;
}
void RecognizeBusinessCardRequest::setImageType(int imageType) {
imageType_ = imageType;
setBodyParameter(std::string("ImageType"), std::to_string(imageType));
}
std::string RecognizeBusinessCardRequest::getImageURL() const {
return imageURL_;
}
void RecognizeBusinessCardRequest::setImageURL(const std::string &imageURL) {
imageURL_ = imageURL;
setBodyParameter(std::string("ImageURL"), imageURL);
}

View File

@@ -1,73 +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/ocr/model/RecognizeBusinessCardResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ocr;
using namespace AlibabaCloud::Ocr::Model;
RecognizeBusinessCardResult::RecognizeBusinessCardResult() :
ServiceResult()
{}
RecognizeBusinessCardResult::RecognizeBusinessCardResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RecognizeBusinessCardResult::~RecognizeBusinessCardResult()
{}
void RecognizeBusinessCardResult::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["Name"].isNull())
data_.name = dataNode["Name"].asString();
auto allCompanies = dataNode["Companies"]["Company"];
for (auto value : allCompanies)
data_.companies.push_back(value.asString());
auto allTitles = dataNode["Titles"]["Title"];
for (auto value : allTitles)
data_.titles.push_back(value.asString());
auto allEmails = dataNode["Emails"]["Email"];
for (auto value : allEmails)
data_.emails.push_back(value.asString());
auto allDepartments = dataNode["Departments"]["Department"];
for (auto value : allDepartments)
data_.departments.push_back(value.asString());
auto allOfficePhoneNumbers = dataNode["OfficePhoneNumbers"]["OfficePhoneNumber"];
for (auto value : allOfficePhoneNumbers)
data_.officePhoneNumbers.push_back(value.asString());
auto allCellPhoneNumbers = dataNode["CellPhoneNumbers"]["CellPhoneNumber"];
for (auto value : allCellPhoneNumbers)
data_.cellPhoneNumbers.push_back(value.asString());
auto allAddresses = dataNode["Addresses"]["Address"];
for (auto value : allAddresses)
data_.addresses.push_back(value.asString());
}
RecognizeBusinessCardResult::Data RecognizeBusinessCardResult::getData()const
{
return data_;
}

View File

@@ -1,45 +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/ocr/model/RecognizeStampRequest.h>
using AlibabaCloud::Ocr::Model::RecognizeStampRequest;
RecognizeStampRequest::RecognizeStampRequest()
: RpcServiceRequest("ocr", "2019-12-30", "RecognizeStamp") {
setMethod(HttpRequest::Method::Post);
}
RecognizeStampRequest::~RecognizeStampRequest() {}
int RecognizeStampRequest::getImageType() const {
return imageType_;
}
void RecognizeStampRequest::setImageType(int imageType) {
imageType_ = imageType;
setBodyParameter(std::string("ImageType"), std::to_string(imageType));
}
std::string RecognizeStampRequest::getImageURL() const {
return imageURL_;
}
void RecognizeStampRequest::setImageURL(const std::string &imageURL) {
imageURL_ = imageURL;
setBodyParameter(std::string("ImageURL"), imageURL);
}

View File

@@ -1,80 +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/ocr/model/RecognizeStampResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ocr;
using namespace AlibabaCloud::Ocr::Model;
RecognizeStampResult::RecognizeStampResult() :
ServiceResult()
{}
RecognizeStampResult::RecognizeStampResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RecognizeStampResult::~RecognizeStampResult()
{}
void RecognizeStampResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto allResultsNode = dataNode["Results"]["ResultsItem"];
for (auto dataNodeResultsResultsItem : allResultsNode)
{
Data::ResultsItem resultsItemObject;
auto allGeneralTextNode = dataNodeResultsResultsItem["GeneralText"]["GeneralTextItem"];
for (auto dataNodeResultsResultsItemGeneralTextGeneralTextItem : allGeneralTextNode)
{
Data::ResultsItem::GeneralTextItem generalTextObject;
if(!dataNodeResultsResultsItemGeneralTextGeneralTextItem["Confidence"].isNull())
generalTextObject.confidence = std::stof(dataNodeResultsResultsItemGeneralTextGeneralTextItem["Confidence"].asString());
if(!dataNodeResultsResultsItemGeneralTextGeneralTextItem["Content"].isNull())
generalTextObject.content = dataNodeResultsResultsItemGeneralTextGeneralTextItem["Content"].asString();
resultsItemObject.generalText.push_back(generalTextObject);
}
auto textNode = value["Text"];
if(!textNode["Confidence"].isNull())
resultsItemObject.text.confidence = std::stof(textNode["Confidence"].asString());
if(!textNode["Content"].isNull())
resultsItemObject.text.content = textNode["Content"].asString();
auto roiNode = value["Roi"];
if(!roiNode["Top"].isNull())
resultsItemObject.roi.top = std::stoi(roiNode["Top"].asString());
if(!roiNode["Width"].isNull())
resultsItemObject.roi.width = std::stoi(roiNode["Width"].asString());
if(!roiNode["Height"].isNull())
resultsItemObject.roi.height = std::stoi(roiNode["Height"].asString());
if(!roiNode["Left"].isNull())
resultsItemObject.roi.left = std::stoi(roiNode["Left"].asString());
data_.results.push_back(resultsItemObject);
}
}
RecognizeStampResult::Data RecognizeStampResult::getData()const
{
return data_;
}