Update RecognizeCharacter.

This commit is contained in:
sdk-team
2021-11-23 06:55:48 +00:00
parent 14dc74bf6a
commit a34003466f
24 changed files with 682 additions and 281 deletions

View File

@@ -1,3 +1,6 @@
2021-11-23 Version: 1.36.942
- Update RecognizeCharacter.
2021-11-23 Version: 1.36.941
- Generated 2016-04-08 for `Emr`.

View File

@@ -1 +1 @@
1.36.941
1.36.942

View File

@@ -73,6 +73,8 @@ set(ocr_public_header_model
include/alibabacloud/ocr/model/RecognizeVINCodeResult.h
include/alibabacloud/ocr/model/RecognizeVerificationcodeRequest.h
include/alibabacloud/ocr/model/RecognizeVerificationcodeResult.h
include/alibabacloud/ocr/model/RecognizeVideoCharacterRequest.h
include/alibabacloud/ocr/model/RecognizeVideoCharacterResult.h
include/alibabacloud/ocr/model/TrimDocumentRequest.h
include/alibabacloud/ocr/model/TrimDocumentResult.h )
@@ -130,6 +132,8 @@ set(ocr_src
src/model/RecognizeVINCodeResult.cc
src/model/RecognizeVerificationcodeRequest.cc
src/model/RecognizeVerificationcodeResult.cc
src/model/RecognizeVideoCharacterRequest.cc
src/model/RecognizeVideoCharacterResult.cc
src/model/TrimDocumentRequest.cc
src/model/TrimDocumentResult.cc )

View File

@@ -74,6 +74,8 @@
#include "model/RecognizeVINCodeResult.h"
#include "model/RecognizeVerificationcodeRequest.h"
#include "model/RecognizeVerificationcodeResult.h"
#include "model/RecognizeVideoCharacterRequest.h"
#include "model/RecognizeVideoCharacterResult.h"
#include "model/TrimDocumentRequest.h"
#include "model/TrimDocumentResult.h"
@@ -163,6 +165,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::RecognizeVerificationcodeResult> RecognizeVerificationcodeOutcome;
typedef std::future<RecognizeVerificationcodeOutcome> RecognizeVerificationcodeOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeVerificationcodeRequest&, const RecognizeVerificationcodeOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeVerificationcodeAsyncHandler;
typedef Outcome<Error, Model::RecognizeVideoCharacterResult> RecognizeVideoCharacterOutcome;
typedef std::future<RecognizeVideoCharacterOutcome> RecognizeVideoCharacterOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::RecognizeVideoCharacterRequest&, const RecognizeVideoCharacterOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeVideoCharacterAsyncHandler;
typedef Outcome<Error, Model::TrimDocumentResult> TrimDocumentOutcome;
typedef std::future<TrimDocumentOutcome> TrimDocumentOutcomeCallable;
typedef std::function<void(const OcrClient*, const Model::TrimDocumentRequest&, const TrimDocumentOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TrimDocumentAsyncHandler;
@@ -249,6 +254,9 @@ namespace AlibabaCloud
RecognizeVerificationcodeOutcome recognizeVerificationcode(const Model::RecognizeVerificationcodeRequest &request)const;
void recognizeVerificationcodeAsync(const Model::RecognizeVerificationcodeRequest& request, const RecognizeVerificationcodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeVerificationcodeOutcomeCallable recognizeVerificationcodeCallable(const Model::RecognizeVerificationcodeRequest& request) const;
RecognizeVideoCharacterOutcome recognizeVideoCharacter(const Model::RecognizeVideoCharacterRequest &request)const;
void recognizeVideoCharacterAsync(const Model::RecognizeVideoCharacterRequest& request, const RecognizeVideoCharacterAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeVideoCharacterOutcomeCallable recognizeVideoCharacterCallable(const Model::RecognizeVideoCharacterRequest& request) const;
TrimDocumentOutcome trimDocument(const Model::TrimDocumentRequest &request)const;
void trimDocumentAsync(const Model::TrimDocumentRequest& request, const TrimDocumentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TrimDocumentOutcomeCallable trimDocumentCallable(const Model::TrimDocumentRequest& request) const;

View File

@@ -34,8 +34,8 @@ namespace AlibabaCloud
public:
struct Data
{
std::string bankName;
std::string cardNumber;
std::string bankName;
std::string validDate;
};

View File

@@ -34,7 +34,7 @@ namespace AlibabaCloud
public:
struct Data
{
struct Emblem
struct Stamp
{
int left;
int top;
@@ -48,7 +48,7 @@ namespace AlibabaCloud
int height;
int width;
};
struct Stamp
struct Emblem
{
int left;
int top;

View File

@@ -35,20 +35,29 @@ namespace AlibabaCloud
RecognizeCharacterRequest();
~RecognizeCharacterRequest();
bool getFormatResultToJson()const;
void setFormatResultToJson(bool formatResultToJson);
int getMinHeight()const;
void setMinHeight(int minHeight);
std::string getOssFile()const;
void setOssFile(const std::string& ossFile);
int getImageType()const;
void setImageType(int imageType);
std::string getRequestProxyBy()const;
void setRequestProxyBy(const std::string& requestProxyBy);
bool getOutputProbability()const;
void setOutputProbability(bool outputProbability);
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
int getMinHeight()const;
void setMinHeight(int minHeight);
private:
bool formatResultToJson_;
int minHeight_;
std::string ossFile_;
int imageType_;
std::string requestProxyBy_;
bool outputProbability_;
std::string imageURL_;
int minHeight_;
};
}

View File

@@ -39,8 +39,8 @@ namespace AlibabaCloud
struct TextRectangles
{
int left;
int angle;
int top;
int angle;
int height;
int width;
};

View File

@@ -34,19 +34,6 @@ namespace AlibabaCloud
public:
struct Data
{
struct FaceResult
{
std::string plateNumber;
std::string owner;
std::string engineNumber;
std::string address;
std::string vehicleType;
std::string model;
std::string registerDate;
std::string issueDate;
std::string vin;
std::string useCharacter;
};
struct BackResult
{
std::string approvedPassengerCapacity;
@@ -57,8 +44,21 @@ namespace AlibabaCloud
std::string approvedLoad;
std::string inspectionRecord;
std::string unladenMass;
std::string fileNumber;
std::string overallDimension;
std::string fileNumber;
};
struct FaceResult
{
std::string owner;
std::string plateNumber;
std::string engineNumber;
std::string address;
std::string vehicleType;
std::string model;
std::string registerDate;
std::string issueDate;
std::string vin;
std::string useCharacter;
};
FaceResult faceResult;
BackResult backResult;

View File

@@ -34,30 +34,36 @@ namespace AlibabaCloud
public:
struct Data
{
struct BackResult
{
std::string startDate;
std::string issue;
std::string endDate;
};
struct FrontResult
{
struct FaceRectangle
{
struct Center
{
float x;
float y;
};
struct Size
{
float height;
float width;
};
struct Center
{
float x;
float y;
};
Center center;
float angle;
Size size;
};
struct CardArea
struct FaceRectVertice
{
float x;
float y;
};
struct FaceRectVertice
struct CardArea
{
float x;
float y;
@@ -68,15 +74,9 @@ namespace AlibabaCloud
std::vector<CardArea> cardAreas;
std::string gender;
std::string nationality;
std::string birthDate;
std::string name;
std::string iDNumber;
std::string birthDate;
};
struct BackResult
{
std::string startDate;
std::string issue;
std::string endDate;
};
FrontResult frontResult;
BackResult backResult;

View File

@@ -34,28 +34,6 @@ namespace AlibabaCloud
public:
struct Data
{
struct Content
{
std::string checker;
std::string payeeAddress;
std::string payeeName;
std::string payerAddress;
std::string antiFakeCode;
std::string payerBankName;
std::string invoiceNo;
std::string payerRegisterNo;
std::string payerName;
std::string withoutTaxAmount;
std::string invoiceAmount;
std::string taxAmount;
std::string payeeBankName;
std::string clerk;
std::string invoiceCode;
std::string payeeRegisterNo;
std::string invoiceDate;
std::string sumAmount;
std::string payee;
};
struct Box
{
std::vector<std::string> payerRegisterNoes;
@@ -66,18 +44,40 @@ namespace AlibabaCloud
std::vector<std::string> clerks;
std::vector<std::string> withoutTaxAmounts;
std::vector<std::string> checkers;
std::vector<std::string> invoiceCodes;
std::vector<std::string> taxAmounts;
std::vector<std::string> invoiceCodes;
std::vector<std::string> sumAmounts;
std::vector<std::string> payerNames;
std::vector<std::string> invoiceFakeCodes;
std::vector<std::string> payeeNames;
std::vector<std::string> payeeBankNames;
std::vector<std::string> payeeNames;
std::vector<std::string> payees;
std::vector<std::string> invoiceNoes;
std::vector<std::string> payerBankNames;
std::vector<std::string> payeeRegisterNoes;
};
struct Content
{
std::string checker;
std::string payeeAddress;
std::string payeeName;
std::string payerAddress;
std::string antiFakeCode;
std::string payerBankName;
std::string invoiceNo;
std::string payerRegisterNo;
std::string withoutTaxAmount;
std::string invoiceAmount;
std::string payerName;
std::string taxAmount;
std::string payeeBankName;
std::string clerk;
std::string payeeRegisterNo;
std::string invoiceCode;
std::string invoiceDate;
std::string sumAmount;
std::string payee;
};
Content content;
Box box;
};

View File

@@ -0,0 +1,60 @@
/*
* 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_RECOGNIZEVIDEOCHARACTERREQUEST_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEVIDEOCHARACTERREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/ocr/OcrExport.h>
namespace AlibabaCloud
{
namespace Ocr
{
namespace Model
{
class ALIBABACLOUD_OCR_EXPORT RecognizeVideoCharacterRequest : public RpcServiceRequest
{
public:
RecognizeVideoCharacterRequest();
~RecognizeVideoCharacterRequest();
bool getFormatResultToJson()const;
void setFormatResultToJson(bool formatResultToJson);
std::string getOssFile()const;
void setOssFile(const std::string& ossFile);
std::string getRequestProxyBy()const;
void setRequestProxyBy(const std::string& requestProxyBy);
bool getAsync()const;
void setAsync(bool async);
std::string getVideoURL()const;
void setVideoURL(const std::string& videoURL);
private:
bool formatResultToJson_;
std::string ossFile_;
std::string requestProxyBy_;
bool async_;
std::string videoURL_;
};
}
}
}
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEVIDEOCHARACTERREQUEST_H_

View File

@@ -0,0 +1,76 @@
/*
* 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_RECOGNIZEVIDEOCHARACTERRESULT_H_
#define ALIBABACLOUD_OCR_MODEL_RECOGNIZEVIDEOCHARACTERRESULT_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 RecognizeVideoCharacterResult : public ServiceResult
{
public:
struct Data
{
struct Frame
{
struct Element
{
struct TextRectangle
{
long left;
long angle;
long top;
long height;
long width;
};
std::vector<Element::TextRectangle> textRectangles;
float score;
std::string text;
};
std::vector<Frame::Element> elements;
long timestamp;
};
std::vector<Frame> frames;
long height;
long width;
};
RecognizeVideoCharacterResult();
explicit RecognizeVideoCharacterResult(const std::string &payload);
~RecognizeVideoCharacterResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_OCR_MODEL_RECOGNIZEVIDEOCHARACTERRESULT_H_

View File

@@ -987,6 +987,42 @@ OcrClient::RecognizeVerificationcodeOutcomeCallable OcrClient::recognizeVerifica
return task->get_future();
}
OcrClient::RecognizeVideoCharacterOutcome OcrClient::recognizeVideoCharacter(const RecognizeVideoCharacterRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RecognizeVideoCharacterOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RecognizeVideoCharacterOutcome(RecognizeVideoCharacterResult(outcome.result()));
else
return RecognizeVideoCharacterOutcome(outcome.error());
}
void OcrClient::recognizeVideoCharacterAsync(const RecognizeVideoCharacterRequest& request, const RecognizeVideoCharacterAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, recognizeVideoCharacter(request), context);
};
asyncExecute(new Runnable(fn));
}
OcrClient::RecognizeVideoCharacterOutcomeCallable OcrClient::recognizeVideoCharacterCallable(const RecognizeVideoCharacterRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RecognizeVideoCharacterOutcome()>>(
[this, request]()
{
return this->recognizeVideoCharacter(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
OcrClient::TrimDocumentOutcome OcrClient::trimDocument(const TrimDocumentRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -40,12 +40,12 @@ void RecognizeBankCardResult::parse(const std::string &payload)
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["BankName"].isNull())
data_.bankName = dataNode["BankName"].asString();
if(!dataNode["CardNumber"].isNull())
data_.cardNumber = dataNode["CardNumber"].asString();
if(!dataNode["ValidDate"].isNull())
data_.validDate = dataNode["ValidDate"].asString();
if(!dataNode["BankName"].isNull())
data_.bankName = dataNode["BankName"].asString();
}

View File

@@ -40,62 +40,62 @@ void RecognizeBusinessLicenseResult::parse(const std::string &payload)
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["Angle"].isNull())
data_.angle = std::stof(dataNode["Angle"].asString());
if(!dataNode["RegisterNumber"].isNull())
data_.registerNumber = dataNode["RegisterNumber"].asString();
if(!dataNode["Name"].isNull())
data_.name = dataNode["Name"].asString();
if(!dataNode["Type"].isNull())
data_.type = dataNode["Type"].asString();
if(!dataNode["LegalPerson"].isNull())
data_.legalPerson = dataNode["LegalPerson"].asString();
if(!dataNode["EstablishDate"].isNull())
data_.establishDate = dataNode["EstablishDate"].asString();
if(!dataNode["ValidPeriod"].isNull())
data_.validPeriod = dataNode["ValidPeriod"].asString();
if(!dataNode["Business"].isNull())
data_.business = dataNode["Business"].asString();
if(!dataNode["Angle"].isNull())
data_.angle = std::stof(dataNode["Angle"].asString());
if(!dataNode["RegisterNumber"].isNull())
data_.registerNumber = dataNode["RegisterNumber"].asString();
if(!dataNode["Address"].isNull())
data_.address = dataNode["Address"].asString();
if(!dataNode["Capital"].isNull())
data_.capital = dataNode["Capital"].asString();
if(!dataNode["Business"].isNull())
data_.business = dataNode["Business"].asString();
auto emblemNode = dataNode["Emblem"];
if(!emblemNode["Top"].isNull())
data_.emblem.top = std::stoi(emblemNode["Top"].asString());
if(!emblemNode["Left"].isNull())
data_.emblem.left = std::stoi(emblemNode["Left"].asString());
if(!emblemNode["Height"].isNull())
data_.emblem.height = std::stoi(emblemNode["Height"].asString());
if(!emblemNode["Width"].isNull())
data_.emblem.width = std::stoi(emblemNode["Width"].asString());
auto titleNode = dataNode["Title"];
if(!titleNode["Top"].isNull())
data_.title.top = std::stoi(titleNode["Top"].asString());
if(!titleNode["Left"].isNull())
data_.title.left = std::stoi(titleNode["Left"].asString());
if(!titleNode["Height"].isNull())
data_.title.height = std::stoi(titleNode["Height"].asString());
if(!titleNode["Width"].isNull())
data_.title.width = std::stoi(titleNode["Width"].asString());
if(!dataNode["Name"].isNull())
data_.name = dataNode["Name"].asString();
if(!dataNode["LegalPerson"].isNull())
data_.legalPerson = dataNode["LegalPerson"].asString();
auto stampNode = dataNode["Stamp"];
if(!stampNode["Top"].isNull())
data_.stamp.top = std::stoi(stampNode["Top"].asString());
if(!stampNode["Left"].isNull())
data_.stamp.left = std::stoi(stampNode["Left"].asString());
if(!stampNode["Height"].isNull())
data_.stamp.height = std::stoi(stampNode["Height"].asString());
if(!stampNode["Width"].isNull())
data_.stamp.width = std::stoi(stampNode["Width"].asString());
if(!stampNode["Height"].isNull())
data_.stamp.height = std::stoi(stampNode["Height"].asString());
if(!stampNode["Left"].isNull())
data_.stamp.left = std::stoi(stampNode["Left"].asString());
auto titleNode = dataNode["Title"];
if(!titleNode["Top"].isNull())
data_.title.top = std::stoi(titleNode["Top"].asString());
if(!titleNode["Width"].isNull())
data_.title.width = std::stoi(titleNode["Width"].asString());
if(!titleNode["Height"].isNull())
data_.title.height = std::stoi(titleNode["Height"].asString());
if(!titleNode["Left"].isNull())
data_.title.left = std::stoi(titleNode["Left"].asString());
auto emblemNode = dataNode["Emblem"];
if(!emblemNode["Top"].isNull())
data_.emblem.top = std::stoi(emblemNode["Top"].asString());
if(!emblemNode["Width"].isNull())
data_.emblem.width = std::stoi(emblemNode["Width"].asString());
if(!emblemNode["Height"].isNull())
data_.emblem.height = std::stoi(emblemNode["Height"].asString());
if(!emblemNode["Left"].isNull())
data_.emblem.left = std::stoi(emblemNode["Left"].asString());
auto qRCodeNode = dataNode["QRCode"];
if(!qRCodeNode["Top"].isNull())
data_.qRCode.top = std::stoi(qRCodeNode["Top"].asString());
if(!qRCodeNode["Left"].isNull())
data_.qRCode.left = std::stoi(qRCodeNode["Left"].asString());
if(!qRCodeNode["Height"].isNull())
data_.qRCode.height = std::stoi(qRCodeNode["Height"].asString());
if(!qRCodeNode["Width"].isNull())
data_.qRCode.width = std::stoi(qRCodeNode["Width"].asString());
if(!qRCodeNode["Height"].isNull())
data_.qRCode.height = std::stoi(qRCodeNode["Height"].asString());
if(!qRCodeNode["Left"].isNull())
data_.qRCode.left = std::stoi(qRCodeNode["Left"].asString());
}

View File

@@ -27,6 +27,39 @@ RecognizeCharacterRequest::RecognizeCharacterRequest() :
RecognizeCharacterRequest::~RecognizeCharacterRequest()
{}
bool RecognizeCharacterRequest::getFormatResultToJson()const
{
return formatResultToJson_;
}
void RecognizeCharacterRequest::setFormatResultToJson(bool formatResultToJson)
{
formatResultToJson_ = formatResultToJson;
setParameter("FormatResultToJson", formatResultToJson ? "true" : "false");
}
int RecognizeCharacterRequest::getMinHeight()const
{
return minHeight_;
}
void RecognizeCharacterRequest::setMinHeight(int minHeight)
{
minHeight_ = minHeight;
setBodyParameter("MinHeight", std::to_string(minHeight));
}
std::string RecognizeCharacterRequest::getOssFile()const
{
return ossFile_;
}
void RecognizeCharacterRequest::setOssFile(const std::string& ossFile)
{
ossFile_ = ossFile;
setParameter("OssFile", ossFile);
}
int RecognizeCharacterRequest::getImageType()const
{
return imageType_;
@@ -38,6 +71,17 @@ void RecognizeCharacterRequest::setImageType(int imageType)
setBodyParameter("ImageType", std::to_string(imageType));
}
std::string RecognizeCharacterRequest::getRequestProxyBy()const
{
return requestProxyBy_;
}
void RecognizeCharacterRequest::setRequestProxyBy(const std::string& requestProxyBy)
{
requestProxyBy_ = requestProxyBy;
setParameter("RequestProxyBy", requestProxyBy);
}
bool RecognizeCharacterRequest::getOutputProbability()const
{
return outputProbability_;
@@ -60,14 +104,3 @@ void RecognizeCharacterRequest::setImageURL(const std::string& imageURL)
setBodyParameter("ImageURL", imageURL);
}
int RecognizeCharacterRequest::getMinHeight()const
{
return minHeight_;
}
void RecognizeCharacterRequest::setMinHeight(int minHeight)
{
minHeight_ = minHeight;
setBodyParameter("MinHeight", std::to_string(minHeight));
}

View File

@@ -44,21 +44,21 @@ void RecognizeCharacterResult::parse(const std::string &payload)
for (auto dataNodeResultsResult : allResultsNode)
{
Data::Result resultObject;
if(!dataNodeResultsResult["Probability"].isNull())
resultObject.probability = std::stof(dataNodeResultsResult["Probability"].asString());
if(!dataNodeResultsResult["Text"].isNull())
resultObject.text = dataNodeResultsResult["Text"].asString();
if(!dataNodeResultsResult["Probability"].isNull())
resultObject.probability = std::stof(dataNodeResultsResult["Probability"].asString());
auto textRectanglesNode = value["TextRectangles"];
if(!textRectanglesNode["Angle"].isNull())
resultObject.textRectangles.angle = std::stoi(textRectanglesNode["Angle"].asString());
if(!textRectanglesNode["Left"].isNull())
resultObject.textRectangles.left = std::stoi(textRectanglesNode["Left"].asString());
if(!textRectanglesNode["Top"].isNull())
resultObject.textRectangles.top = std::stoi(textRectanglesNode["Top"].asString());
if(!textRectanglesNode["Width"].isNull())
resultObject.textRectangles.width = std::stoi(textRectanglesNode["Width"].asString());
if(!textRectanglesNode["Height"].isNull())
resultObject.textRectangles.height = std::stoi(textRectanglesNode["Height"].asString());
if(!textRectanglesNode["Angle"].isNull())
resultObject.textRectangles.angle = std::stoi(textRectanglesNode["Angle"].asString());
if(!textRectanglesNode["Left"].isNull())
resultObject.textRectangles.left = std::stoi(textRectanglesNode["Left"].asString());
data_.results.push_back(resultObject);
}

View File

@@ -40,48 +40,48 @@ void RecognizeDrivingLicenseResult::parse(const std::string &payload)
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto backResultNode = dataNode["BackResult"];
if(!backResultNode["OverallDimension"].isNull())
data_.backResult.overallDimension = backResultNode["OverallDimension"].asString();
if(!backResultNode["InspectionRecord"].isNull())
data_.backResult.inspectionRecord = backResultNode["InspectionRecord"].asString();
if(!backResultNode["UnladenMass"].isNull())
data_.backResult.unladenMass = backResultNode["UnladenMass"].asString();
if(!backResultNode["FileNumber"].isNull())
data_.backResult.fileNumber = backResultNode["FileNumber"].asString();
if(!backResultNode["TractionMass"].isNull())
data_.backResult.tractionMass = backResultNode["TractionMass"].asString();
if(!backResultNode["GrossMass"].isNull())
data_.backResult.grossMass = backResultNode["GrossMass"].asString();
if(!backResultNode["PlateNumber"].isNull())
data_.backResult.plateNumber = backResultNode["PlateNumber"].asString();
if(!backResultNode["ApprovedPassengerCapacity"].isNull())
data_.backResult.approvedPassengerCapacity = backResultNode["ApprovedPassengerCapacity"].asString();
if(!backResultNode["EnergyType"].isNull())
data_.backResult.energyType = backResultNode["EnergyType"].asString();
if(!backResultNode["ApprovedLoad"].isNull())
data_.backResult.approvedLoad = backResultNode["ApprovedLoad"].asString();
auto faceResultNode = dataNode["FaceResult"];
if(!faceResultNode["PlateNumber"].isNull())
data_.faceResult.plateNumber = faceResultNode["PlateNumber"].asString();
if(!faceResultNode["IssueDate"].isNull())
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
if(!faceResultNode["Model"].isNull())
data_.faceResult.model = faceResultNode["Model"].asString();
if(!faceResultNode["VehicleType"].isNull())
data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
if(!faceResultNode["Owner"].isNull())
data_.faceResult.owner = faceResultNode["Owner"].asString();
if(!faceResultNode["UseCharacter"].isNull())
data_.faceResult.useCharacter = faceResultNode["UseCharacter"].asString();
if(!faceResultNode["Address"].isNull())
data_.faceResult.address = faceResultNode["Address"].asString();
if(!faceResultNode["Model"].isNull())
data_.faceResult.model = faceResultNode["Model"].asString();
if(!faceResultNode["Vin"].isNull())
data_.faceResult.vin = faceResultNode["Vin"].asString();
if(!faceResultNode["EngineNumber"].isNull())
data_.faceResult.engineNumber = faceResultNode["EngineNumber"].asString();
if(!faceResultNode["PlateNumber"].isNull())
data_.faceResult.plateNumber = faceResultNode["PlateNumber"].asString();
if(!faceResultNode["Address"].isNull())
data_.faceResult.address = faceResultNode["Address"].asString();
if(!faceResultNode["UseCharacter"].isNull())
data_.faceResult.useCharacter = faceResultNode["UseCharacter"].asString();
if(!faceResultNode["Vin"].isNull())
data_.faceResult.vin = faceResultNode["Vin"].asString();
if(!faceResultNode["RegisterDate"].isNull())
data_.faceResult.registerDate = faceResultNode["RegisterDate"].asString();
if(!faceResultNode["IssueDate"].isNull())
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
auto backResultNode = dataNode["BackResult"];
if(!backResultNode["ApprovedPassengerCapacity"].isNull())
data_.backResult.approvedPassengerCapacity = backResultNode["ApprovedPassengerCapacity"].asString();
if(!backResultNode["ApprovedLoad"].isNull())
data_.backResult.approvedLoad = backResultNode["ApprovedLoad"].asString();
if(!backResultNode["FileNumber"].isNull())
data_.backResult.fileNumber = backResultNode["FileNumber"].asString();
if(!backResultNode["GrossMass"].isNull())
data_.backResult.grossMass = backResultNode["GrossMass"].asString();
if(!backResultNode["EnergyType"].isNull())
data_.backResult.energyType = backResultNode["EnergyType"].asString();
if(!backResultNode["InspectionRecord"].isNull())
data_.backResult.inspectionRecord = backResultNode["InspectionRecord"].asString();
if(!backResultNode["OverallDimension"].isNull())
data_.backResult.overallDimension = backResultNode["OverallDimension"].asString();
if(!backResultNode["TractionMass"].isNull())
data_.backResult.tractionMass = backResultNode["TractionMass"].asString();
if(!backResultNode["UnladenMass"].isNull())
data_.backResult.unladenMass = backResultNode["UnladenMass"].asString();
if(!backResultNode["PlateNumber"].isNull())
data_.backResult.plateNumber = backResultNode["PlateNumber"].asString();
}

View File

@@ -40,59 +40,59 @@ void RecognizeIdentityCardResult::parse(const std::string &payload)
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto frontResultNode = dataNode["FrontResult"];
if(!frontResultNode["Address"].isNull())
data_.frontResult.address = frontResultNode["Address"].asString();
if(!frontResultNode["Name"].isNull())
data_.frontResult.name = frontResultNode["Name"].asString();
if(!frontResultNode["Nationality"].isNull())
data_.frontResult.nationality = frontResultNode["Nationality"].asString();
if(!frontResultNode["IDNumber"].isNull())
data_.frontResult.iDNumber = frontResultNode["IDNumber"].asString();
if(!frontResultNode["Gender"].isNull())
data_.frontResult.gender = frontResultNode["Gender"].asString();
if(!frontResultNode["BirthDate"].isNull())
data_.frontResult.birthDate = frontResultNode["BirthDate"].asString();
auto allCardAreasNode = frontResultNode["CardAreas"]["CardArea"];
for (auto frontResultNodeCardAreasCardArea : allCardAreasNode)
{
Data::FrontResult::CardArea cardAreaObject;
if(!frontResultNodeCardAreasCardArea["X"].isNull())
cardAreaObject.x = std::stof(frontResultNodeCardAreasCardArea["X"].asString());
if(!frontResultNodeCardAreasCardArea["Y"].isNull())
cardAreaObject.y = std::stof(frontResultNodeCardAreasCardArea["Y"].asString());
data_.frontResult.cardAreas.push_back(cardAreaObject);
}
auto allFaceRectVerticesNode = frontResultNode["FaceRectVertices"]["FaceRectVertice"];
for (auto frontResultNodeFaceRectVerticesFaceRectVertice : allFaceRectVerticesNode)
{
Data::FrontResult::FaceRectVertice faceRectVerticeObject;
if(!frontResultNodeFaceRectVerticesFaceRectVertice["X"].isNull())
faceRectVerticeObject.x = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["X"].asString());
if(!frontResultNodeFaceRectVerticesFaceRectVertice["Y"].isNull())
faceRectVerticeObject.y = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["Y"].asString());
data_.frontResult.faceRectVertices.push_back(faceRectVerticeObject);
}
auto faceRectangleNode = frontResultNode["FaceRectangle"];
if(!faceRectangleNode["Angle"].isNull())
data_.frontResult.faceRectangle.angle = std::stof(faceRectangleNode["Angle"].asString());
auto centerNode = faceRectangleNode["Center"];
if(!centerNode["X"].isNull())
data_.frontResult.faceRectangle.center.x = std::stof(centerNode["X"].asString());
if(!centerNode["Y"].isNull())
data_.frontResult.faceRectangle.center.y = std::stof(centerNode["Y"].asString());
auto sizeNode = faceRectangleNode["Size"];
if(!sizeNode["Height"].isNull())
data_.frontResult.faceRectangle.size.height = std::stof(sizeNode["Height"].asString());
if(!sizeNode["Width"].isNull())
data_.frontResult.faceRectangle.size.width = std::stof(sizeNode["Width"].asString());
auto backResultNode = dataNode["BackResult"];
if(!backResultNode["StartDate"].isNull())
data_.backResult.startDate = backResultNode["StartDate"].asString();
if(!backResultNode["EndDate"].isNull())
data_.backResult.endDate = backResultNode["EndDate"].asString();
if(!backResultNode["Issue"].isNull())
data_.backResult.issue = backResultNode["Issue"].asString();
if(!backResultNode["StartDate"].isNull())
data_.backResult.startDate = backResultNode["StartDate"].asString();
auto frontResultNode = dataNode["FrontResult"];
if(!frontResultNode["BirthDate"].isNull())
data_.frontResult.birthDate = frontResultNode["BirthDate"].asString();
if(!frontResultNode["Gender"].isNull())
data_.frontResult.gender = frontResultNode["Gender"].asString();
if(!frontResultNode["Address"].isNull())
data_.frontResult.address = frontResultNode["Address"].asString();
if(!frontResultNode["Nationality"].isNull())
data_.frontResult.nationality = frontResultNode["Nationality"].asString();
if(!frontResultNode["Name"].isNull())
data_.frontResult.name = frontResultNode["Name"].asString();
if(!frontResultNode["IDNumber"].isNull())
data_.frontResult.iDNumber = frontResultNode["IDNumber"].asString();
auto allFaceRectVerticesNode = frontResultNode["FaceRectVertices"]["FaceRectVertice"];
for (auto frontResultNodeFaceRectVerticesFaceRectVertice : allFaceRectVerticesNode)
{
Data::FrontResult::FaceRectVertice faceRectVerticeObject;
if(!frontResultNodeFaceRectVerticesFaceRectVertice["Y"].isNull())
faceRectVerticeObject.y = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["Y"].asString());
if(!frontResultNodeFaceRectVerticesFaceRectVertice["X"].isNull())
faceRectVerticeObject.x = std::stof(frontResultNodeFaceRectVerticesFaceRectVertice["X"].asString());
data_.frontResult.faceRectVertices.push_back(faceRectVerticeObject);
}
auto allCardAreasNode = frontResultNode["CardAreas"]["CardArea"];
for (auto frontResultNodeCardAreasCardArea : allCardAreasNode)
{
Data::FrontResult::CardArea cardAreaObject;
if(!frontResultNodeCardAreasCardArea["Y"].isNull())
cardAreaObject.y = std::stof(frontResultNodeCardAreasCardArea["Y"].asString());
if(!frontResultNodeCardAreasCardArea["X"].isNull())
cardAreaObject.x = std::stof(frontResultNodeCardAreasCardArea["X"].asString());
data_.frontResult.cardAreas.push_back(cardAreaObject);
}
auto faceRectangleNode = frontResultNode["FaceRectangle"];
if(!faceRectangleNode["Angle"].isNull())
data_.frontResult.faceRectangle.angle = std::stof(faceRectangleNode["Angle"].asString());
auto sizeNode = faceRectangleNode["Size"];
if(!sizeNode["Width"].isNull())
data_.frontResult.faceRectangle.size.width = std::stof(sizeNode["Width"].asString());
if(!sizeNode["Height"].isNull())
data_.frontResult.faceRectangle.size.height = std::stof(sizeNode["Height"].asString());
auto centerNode = faceRectangleNode["Center"];
if(!centerNode["Y"].isNull())
data_.frontResult.faceRectangle.center.y = std::stof(centerNode["Y"].asString());
if(!centerNode["X"].isNull())
data_.frontResult.faceRectangle.center.x = std::stof(centerNode["X"].asString());
}

View File

@@ -44,18 +44,18 @@ void RecognizeQrCodeResult::parse(const std::string &payload)
for (auto dataNodeElementsElement : allElementsNode)
{
Data::Element elementObject;
if(!dataNodeElementsElement["TaskId"].isNull())
elementObject.taskId = dataNodeElementsElement["TaskId"].asString();
if(!dataNodeElementsElement["ImageURL"].isNull())
elementObject.imageURL = dataNodeElementsElement["ImageURL"].asString();
if(!dataNodeElementsElement["TaskId"].isNull())
elementObject.taskId = dataNodeElementsElement["TaskId"].asString();
auto allResultsNode = dataNodeElementsElement["Results"]["Result"];
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["Label"].isNull())
resultsObject.label = dataNodeElementsElementResultsResult["Label"].asString();
if(!dataNodeElementsElementResultsResult["Rate"].isNull())
resultsObject.rate = std::stof(dataNodeElementsElementResultsResult["Rate"].asString());
auto allQrCodesData = value["QrCodesData"]["QrCodeData"];

View File

@@ -40,103 +40,103 @@ void RecognizeVATInvoiceResult::parse(const std::string &payload)
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto contentNode = dataNode["Content"];
if(!contentNode["InvoiceCode"].isNull())
data_.content.invoiceCode = contentNode["InvoiceCode"].asString();
if(!contentNode["InvoiceNo"].isNull())
data_.content.invoiceNo = contentNode["InvoiceNo"].asString();
if(!contentNode["InvoiceDate"].isNull())
data_.content.invoiceDate = contentNode["InvoiceDate"].asString();
if(!contentNode["AntiFakeCode"].isNull())
data_.content.antiFakeCode = contentNode["AntiFakeCode"].asString();
if(!contentNode["PayerName"].isNull())
data_.content.payerName = contentNode["PayerName"].asString();
if(!contentNode["PayerRegisterNo"].isNull())
data_.content.payerRegisterNo = contentNode["PayerRegisterNo"].asString();
if(!contentNode["PayerAddress"].isNull())
data_.content.payerAddress = contentNode["PayerAddress"].asString();
if(!contentNode["PayerBankName"].isNull())
data_.content.payerBankName = contentNode["PayerBankName"].asString();
if(!contentNode["WithoutTaxAmount"].isNull())
data_.content.withoutTaxAmount = contentNode["WithoutTaxAmount"].asString();
if(!contentNode["TaxAmount"].isNull())
data_.content.taxAmount = contentNode["TaxAmount"].asString();
if(!contentNode["SumAmount"].isNull())
data_.content.sumAmount = contentNode["SumAmount"].asString();
if(!contentNode["InvoiceAmount"].isNull())
data_.content.invoiceAmount = contentNode["InvoiceAmount"].asString();
if(!contentNode["PayeeName"].isNull())
data_.content.payeeName = contentNode["PayeeName"].asString();
if(!contentNode["PayeeRegisterNo"].isNull())
data_.content.payeeRegisterNo = contentNode["PayeeRegisterNo"].asString();
if(!contentNode["PayeeAddress"].isNull())
data_.content.payeeAddress = contentNode["PayeeAddress"].asString();
if(!contentNode["PayeeBankName"].isNull())
data_.content.payeeBankName = contentNode["PayeeBankName"].asString();
if(!contentNode["Payee"].isNull())
data_.content.payee = contentNode["Payee"].asString();
if(!contentNode["Checker"].isNull())
data_.content.checker = contentNode["Checker"].asString();
if(!contentNode["Clerk"].isNull())
data_.content.clerk = contentNode["Clerk"].asString();
auto boxNode = dataNode["Box"];
auto allInvoiceCodes = boxNode["InvoiceCodes"]["InvoiceCode"];
for (auto value : allInvoiceCodes)
data_.box.invoiceCodes.push_back(value.asString());
auto allInvoiceNoes = boxNode["InvoiceNoes"]["InvoiceNo"];
for (auto value : allInvoiceNoes)
data_.box.invoiceNoes.push_back(value.asString());
auto allInvoiceDates = boxNode["InvoiceDates"]["InvoiceDate"];
for (auto value : allInvoiceDates)
data_.box.invoiceDates.push_back(value.asString());
auto allInvoiceFakeCodes = boxNode["InvoiceFakeCodes"]["InvoiceFakeCode"];
for (auto value : allInvoiceFakeCodes)
data_.box.invoiceFakeCodes.push_back(value.asString());
auto allPayerNames = boxNode["PayerNames"]["PayerName"];
for (auto value : allPayerNames)
data_.box.payerNames.push_back(value.asString());
auto allPayerRegisterNoes = boxNode["PayerRegisterNoes"]["PayerRegisterNo"];
for (auto value : allPayerRegisterNoes)
data_.box.payerRegisterNoes.push_back(value.asString());
auto allPayerAddresses = boxNode["PayerAddresses"]["PayerAddress"];
for (auto value : allPayerAddresses)
data_.box.payerAddresses.push_back(value.asString());
auto allPayerBankNames = boxNode["PayerBankNames"]["PayerBankNames"];
for (auto value : allPayerBankNames)
data_.box.payerBankNames.push_back(value.asString());
auto allWithoutTaxAmounts = boxNode["WithoutTaxAmounts"]["WithoutTaxAmount"];
for (auto value : allWithoutTaxAmounts)
data_.box.withoutTaxAmounts.push_back(value.asString());
auto allTaxAmounts = boxNode["TaxAmounts"]["TaxAmount"];
for (auto value : allTaxAmounts)
data_.box.taxAmounts.push_back(value.asString());
auto allSumAmounts = boxNode["SumAmounts"]["SumAmount"];
for (auto value : allSumAmounts)
data_.box.sumAmounts.push_back(value.asString());
auto allInvoiceAmounts = boxNode["InvoiceAmounts"]["InvoiceAmount"];
for (auto value : allInvoiceAmounts)
data_.box.invoiceAmounts.push_back(value.asString());
auto allPayeeNames = boxNode["PayeeNames"]["PayeeName"];
for (auto value : allPayeeNames)
data_.box.payeeNames.push_back(value.asString());
auto allPayeeRegisterNoes = boxNode["PayeeRegisterNoes"]["PayeeRegisterNo"];
for (auto value : allPayeeRegisterNoes)
data_.box.payeeRegisterNoes.push_back(value.asString());
auto allPayeeAddresses = boxNode["PayeeAddresses"]["PayeeAddress"];
for (auto value : allPayeeAddresses)
data_.box.payeeAddresses.push_back(value.asString());
auto allPayeeBankNames = boxNode["PayeeBankNames"]["PayeeBankName"];
for (auto value : allPayeeBankNames)
data_.box.payeeBankNames.push_back(value.asString());
auto allPayees = boxNode["Payees"]["Payee"];
for (auto value : allPayees)
data_.box.payees.push_back(value.asString());
auto allCheckers = boxNode["Checkers"]["Checker"];
for (auto value : allCheckers)
data_.box.checkers.push_back(value.asString());
auto allTaxAmounts = boxNode["TaxAmounts"]["TaxAmount"];
for (auto value : allTaxAmounts)
data_.box.taxAmounts.push_back(value.asString());
auto allSumAmounts = boxNode["SumAmounts"]["SumAmount"];
for (auto value : allSumAmounts)
data_.box.sumAmounts.push_back(value.asString());
auto allClerks = boxNode["Clerks"]["Clerk"];
for (auto value : allClerks)
data_.box.clerks.push_back(value.asString());
auto allInvoiceNoes = boxNode["InvoiceNoes"]["InvoiceNo"];
for (auto value : allInvoiceNoes)
data_.box.invoiceNoes.push_back(value.asString());
auto allInvoiceDates = boxNode["InvoiceDates"]["InvoiceDate"];
for (auto value : allInvoiceDates)
data_.box.invoiceDates.push_back(value.asString());
auto allInvoiceCodes = boxNode["InvoiceCodes"]["InvoiceCode"];
for (auto value : allInvoiceCodes)
data_.box.invoiceCodes.push_back(value.asString());
auto allInvoiceFakeCodes = boxNode["InvoiceFakeCodes"]["InvoiceFakeCode"];
for (auto value : allInvoiceFakeCodes)
data_.box.invoiceFakeCodes.push_back(value.asString());
auto allPayerNames = boxNode["PayerNames"]["PayerName"];
for (auto value : allPayerNames)
data_.box.payerNames.push_back(value.asString());
auto allPayerBankNames = boxNode["PayerBankNames"]["PayerBankNames"];
for (auto value : allPayerBankNames)
data_.box.payerBankNames.push_back(value.asString());
auto allPayees = boxNode["Payees"]["Payee"];
for (auto value : allPayees)
data_.box.payees.push_back(value.asString());
auto allPayeeNames = boxNode["PayeeNames"]["PayeeName"];
for (auto value : allPayeeNames)
data_.box.payeeNames.push_back(value.asString());
auto allInvoiceAmounts = boxNode["InvoiceAmounts"]["InvoiceAmount"];
for (auto value : allInvoiceAmounts)
data_.box.invoiceAmounts.push_back(value.asString());
auto allWithoutTaxAmounts = boxNode["WithoutTaxAmounts"]["WithoutTaxAmount"];
for (auto value : allWithoutTaxAmounts)
data_.box.withoutTaxAmounts.push_back(value.asString());
auto allPayerAddresses = boxNode["PayerAddresses"]["PayerAddress"];
for (auto value : allPayerAddresses)
data_.box.payerAddresses.push_back(value.asString());
auto allPayeeRegisterNoes = boxNode["PayeeRegisterNoes"]["PayeeRegisterNo"];
for (auto value : allPayeeRegisterNoes)
data_.box.payeeRegisterNoes.push_back(value.asString());
auto contentNode = dataNode["Content"];
if(!contentNode["PayerAddress"].isNull())
data_.content.payerAddress = contentNode["PayerAddress"].asString();
if(!contentNode["PayeeRegisterNo"].isNull())
data_.content.payeeRegisterNo = contentNode["PayeeRegisterNo"].asString();
if(!contentNode["PayeeBankName"].isNull())
data_.content.payeeBankName = contentNode["PayeeBankName"].asString();
if(!contentNode["InvoiceNo"].isNull())
data_.content.invoiceNo = contentNode["InvoiceNo"].asString();
if(!contentNode["PayerRegisterNo"].isNull())
data_.content.payerRegisterNo = contentNode["PayerRegisterNo"].asString();
if(!contentNode["Checker"].isNull())
data_.content.checker = contentNode["Checker"].asString();
if(!contentNode["TaxAmount"].isNull())
data_.content.taxAmount = contentNode["TaxAmount"].asString();
if(!contentNode["InvoiceDate"].isNull())
data_.content.invoiceDate = contentNode["InvoiceDate"].asString();
if(!contentNode["WithoutTaxAmount"].isNull())
data_.content.withoutTaxAmount = contentNode["WithoutTaxAmount"].asString();
if(!contentNode["InvoiceAmount"].isNull())
data_.content.invoiceAmount = contentNode["InvoiceAmount"].asString();
if(!contentNode["AntiFakeCode"].isNull())
data_.content.antiFakeCode = contentNode["AntiFakeCode"].asString();
if(!contentNode["PayerName"].isNull())
data_.content.payerName = contentNode["PayerName"].asString();
if(!contentNode["Payee"].isNull())
data_.content.payee = contentNode["Payee"].asString();
if(!contentNode["SumAmount"].isNull())
data_.content.sumAmount = contentNode["SumAmount"].asString();
if(!contentNode["PayerBankName"].isNull())
data_.content.payerBankName = contentNode["PayerBankName"].asString();
if(!contentNode["Clerk"].isNull())
data_.content.clerk = contentNode["Clerk"].asString();
if(!contentNode["PayeeName"].isNull())
data_.content.payeeName = contentNode["PayeeName"].asString();
if(!contentNode["PayeeAddress"].isNull())
data_.content.payeeAddress = contentNode["PayeeAddress"].asString();
if(!contentNode["InvoiceCode"].isNull())
data_.content.invoiceCode = contentNode["InvoiceCode"].asString();
}

View File

@@ -0,0 +1,84 @@
/*
* 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/RecognizeVideoCharacterRequest.h>
using AlibabaCloud::Ocr::Model::RecognizeVideoCharacterRequest;
RecognizeVideoCharacterRequest::RecognizeVideoCharacterRequest() :
RpcServiceRequest("ocr", "2019-12-30", "RecognizeVideoCharacter")
{
setMethod(HttpRequest::Method::Post);
}
RecognizeVideoCharacterRequest::~RecognizeVideoCharacterRequest()
{}
bool RecognizeVideoCharacterRequest::getFormatResultToJson()const
{
return formatResultToJson_;
}
void RecognizeVideoCharacterRequest::setFormatResultToJson(bool formatResultToJson)
{
formatResultToJson_ = formatResultToJson;
setParameter("FormatResultToJson", formatResultToJson ? "true" : "false");
}
std::string RecognizeVideoCharacterRequest::getOssFile()const
{
return ossFile_;
}
void RecognizeVideoCharacterRequest::setOssFile(const std::string& ossFile)
{
ossFile_ = ossFile;
setParameter("OssFile", ossFile);
}
std::string RecognizeVideoCharacterRequest::getRequestProxyBy()const
{
return requestProxyBy_;
}
void RecognizeVideoCharacterRequest::setRequestProxyBy(const std::string& requestProxyBy)
{
requestProxyBy_ = requestProxyBy;
setParameter("RequestProxyBy", requestProxyBy);
}
bool RecognizeVideoCharacterRequest::getAsync()const
{
return async_;
}
void RecognizeVideoCharacterRequest::setAsync(bool async)
{
async_ = async;
setBodyParameter("Async", async ? "true" : "false");
}
std::string RecognizeVideoCharacterRequest::getVideoURL()const
{
return videoURL_;
}
void RecognizeVideoCharacterRequest::setVideoURL(const std::string& videoURL)
{
videoURL_ = videoURL;
setBodyParameter("VideoURL", videoURL);
}

View File

@@ -0,0 +1,88 @@
/*
* 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/RecognizeVideoCharacterResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ocr;
using namespace AlibabaCloud::Ocr::Model;
RecognizeVideoCharacterResult::RecognizeVideoCharacterResult() :
ServiceResult()
{}
RecognizeVideoCharacterResult::RecognizeVideoCharacterResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RecognizeVideoCharacterResult::~RecognizeVideoCharacterResult()
{}
void RecognizeVideoCharacterResult::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["Width"].isNull())
data_.width = std::stol(dataNode["Width"].asString());
if(!dataNode["Height"].isNull())
data_.height = std::stol(dataNode["Height"].asString());
auto allFramesNode = dataNode["Frames"]["Frame"];
for (auto dataNodeFramesFrame : allFramesNode)
{
Data::Frame frameObject;
if(!dataNodeFramesFrame["Timestamp"].isNull())
frameObject.timestamp = std::stol(dataNodeFramesFrame["Timestamp"].asString());
auto allElementsNode = dataNodeFramesFrame["Elements"]["Element"];
for (auto dataNodeFramesFrameElementsElement : allElementsNode)
{
Data::Frame::Element elementsObject;
if(!dataNodeFramesFrameElementsElement["Score"].isNull())
elementsObject.score = std::stof(dataNodeFramesFrameElementsElement["Score"].asString());
if(!dataNodeFramesFrameElementsElement["Text"].isNull())
elementsObject.text = dataNodeFramesFrameElementsElement["Text"].asString();
auto allTextRectanglesNode = dataNodeFramesFrameElementsElement["TextRectangles"]["TextRectangle"];
for (auto dataNodeFramesFrameElementsElementTextRectanglesTextRectangle : allTextRectanglesNode)
{
Data::Frame::Element::TextRectangle textRectanglesObject;
if(!dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Angle"].isNull())
textRectanglesObject.angle = std::stol(dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Angle"].asString());
if(!dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Left"].isNull())
textRectanglesObject.left = std::stol(dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Left"].asString());
if(!dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Top"].isNull())
textRectanglesObject.top = std::stol(dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Top"].asString());
if(!dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Width"].isNull())
textRectanglesObject.width = std::stol(dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Width"].asString());
if(!dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Height"].isNull())
textRectanglesObject.height = std::stol(dataNodeFramesFrameElementsElementTextRectanglesTextRectangle["Height"].asString());
elementsObject.textRectangles.push_back(textRectanglesObject);
}
frameObject.elements.push_back(elementsObject);
}
data_.frames.push_back(frameObject);
}
}
RecognizeVideoCharacterResult::Data RecognizeVideoCharacterResult::getData()const
{
return data_;
}