Update RecognizeCharacter.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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"];
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
84
ocr/src/model/RecognizeVideoCharacterRequest.cc
Normal file
84
ocr/src/model/RecognizeVideoCharacterRequest.cc
Normal 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);
|
||||
}
|
||||
|
||||
88
ocr/src/model/RecognizeVideoCharacterResult.cc
Normal file
88
ocr/src/model/RecognizeVideoCharacterResult.cc
Normal 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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user