Update RecognizeDriverLicense RecognizeLicensePlate.
This commit is contained in:
@@ -34,6 +34,13 @@ namespace AlibabaCloud
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
struct BackResult
|
||||
{
|
||||
std::string cardNumber;
|
||||
std::string record;
|
||||
std::string archiveNumber;
|
||||
std::string name;
|
||||
};
|
||||
struct FaceResult
|
||||
{
|
||||
std::string startDate;
|
||||
@@ -42,13 +49,10 @@ namespace AlibabaCloud
|
||||
std::string vehicleType;
|
||||
std::string issueDate;
|
||||
std::string gender;
|
||||
std::string issueUnit;
|
||||
std::string endDate;
|
||||
std::string name;
|
||||
};
|
||||
struct BackResult
|
||||
{
|
||||
std::string archiveNumber;
|
||||
};
|
||||
FaceResult faceResult;
|
||||
BackResult backResult;
|
||||
};
|
||||
@@ -57,12 +61,16 @@ namespace AlibabaCloud
|
||||
RecognizeDriverLicenseResult();
|
||||
explicit RecognizeDriverLicenseResult(const std::string &payload);
|
||||
~RecognizeDriverLicenseResult();
|
||||
std::string getMessage()const;
|
||||
Data getData()const;
|
||||
std::string getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
Data data_;
|
||||
std::string code_;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,9 +43,15 @@ namespace AlibabaCloud
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
struct PositionsItem
|
||||
{
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
std::string plateNumber;
|
||||
float confidence;
|
||||
std::string plateType;
|
||||
std::vector<Plate::PositionsItem> positions;
|
||||
float plateTypeConfidence;
|
||||
Roi roi;
|
||||
};
|
||||
@@ -56,12 +62,16 @@ namespace AlibabaCloud
|
||||
RecognizeLicensePlateResult();
|
||||
explicit RecognizeLicensePlateResult(const std::string &payload);
|
||||
~RecognizeLicensePlateResult();
|
||||
std::string getMessage()const;
|
||||
Data getData()const;
|
||||
std::string getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
Data data_;
|
||||
std::string code_;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,31 +40,53 @@ void RecognizeDriverLicenseResult::parse(const std::string &payload)
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto faceResultNode = dataNode["FaceResult"];
|
||||
if(!faceResultNode["Name"].isNull())
|
||||
data_.faceResult.name = faceResultNode["Name"].asString();
|
||||
if(!faceResultNode["LicenseNumber"].isNull())
|
||||
data_.faceResult.licenseNumber = faceResultNode["LicenseNumber"].asString();
|
||||
if(!faceResultNode["VehicleType"].isNull())
|
||||
data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
|
||||
if(!faceResultNode["StartDate"].isNull())
|
||||
data_.faceResult.startDate = faceResultNode["StartDate"].asString();
|
||||
if(!faceResultNode["EndDate"].isNull())
|
||||
data_.faceResult.endDate = faceResultNode["EndDate"].asString();
|
||||
if(!faceResultNode["IssueDate"].isNull())
|
||||
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
|
||||
if(!faceResultNode["Address"].isNull())
|
||||
data_.faceResult.address = faceResultNode["Address"].asString();
|
||||
if(!faceResultNode["Gender"].isNull())
|
||||
data_.faceResult.gender = faceResultNode["Gender"].asString();
|
||||
auto backResultNode = dataNode["BackResult"];
|
||||
if(!backResultNode["ArchiveNumber"].isNull())
|
||||
data_.backResult.archiveNumber = backResultNode["ArchiveNumber"].asString();
|
||||
if(!backResultNode["Name"].isNull())
|
||||
data_.backResult.name = backResultNode["Name"].asString();
|
||||
if(!backResultNode["CardNumber"].isNull())
|
||||
data_.backResult.cardNumber = backResultNode["CardNumber"].asString();
|
||||
if(!backResultNode["Record"].isNull())
|
||||
data_.backResult.record = backResultNode["Record"].asString();
|
||||
auto faceResultNode = dataNode["FaceResult"];
|
||||
if(!faceResultNode["VehicleType"].isNull())
|
||||
data_.faceResult.vehicleType = faceResultNode["VehicleType"].asString();
|
||||
if(!faceResultNode["IssueDate"].isNull())
|
||||
data_.faceResult.issueDate = faceResultNode["IssueDate"].asString();
|
||||
if(!faceResultNode["EndDate"].isNull())
|
||||
data_.faceResult.endDate = faceResultNode["EndDate"].asString();
|
||||
if(!faceResultNode["Gender"].isNull())
|
||||
data_.faceResult.gender = faceResultNode["Gender"].asString();
|
||||
if(!faceResultNode["Address"].isNull())
|
||||
data_.faceResult.address = faceResultNode["Address"].asString();
|
||||
if(!faceResultNode["StartDate"].isNull())
|
||||
data_.faceResult.startDate = faceResultNode["StartDate"].asString();
|
||||
if(!faceResultNode["LicenseNumber"].isNull())
|
||||
data_.faceResult.licenseNumber = faceResultNode["LicenseNumber"].asString();
|
||||
if(!faceResultNode["Name"].isNull())
|
||||
data_.faceResult.name = faceResultNode["Name"].asString();
|
||||
if(!faceResultNode["IssueUnit"].isNull())
|
||||
data_.faceResult.issueUnit = faceResultNode["IssueUnit"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string RecognizeDriverLicenseResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
RecognizeDriverLicenseResult::Data RecognizeDriverLicenseResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string RecognizeDriverLicenseResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,30 +44,54 @@ void RecognizeLicensePlateResult::parse(const std::string &payload)
|
||||
for (auto dataNodePlatesPlate : allPlatesNode)
|
||||
{
|
||||
Data::Plate plateObject;
|
||||
if(!dataNodePlatesPlate["PlateTypeConfidence"].isNull())
|
||||
plateObject.plateTypeConfidence = std::stof(dataNodePlatesPlate["PlateTypeConfidence"].asString());
|
||||
if(!dataNodePlatesPlate["PlateType"].isNull())
|
||||
plateObject.plateType = dataNodePlatesPlate["PlateType"].asString();
|
||||
if(!dataNodePlatesPlate["Confidence"].isNull())
|
||||
plateObject.confidence = std::stof(dataNodePlatesPlate["Confidence"].asString());
|
||||
if(!dataNodePlatesPlate["PlateNumber"].isNull())
|
||||
plateObject.plateNumber = dataNodePlatesPlate["PlateNumber"].asString();
|
||||
if(!dataNodePlatesPlate["PlateType"].isNull())
|
||||
plateObject.plateType = dataNodePlatesPlate["PlateType"].asString();
|
||||
if(!dataNodePlatesPlate["PlateTypeConfidence"].isNull())
|
||||
plateObject.plateTypeConfidence = std::stof(dataNodePlatesPlate["PlateTypeConfidence"].asString());
|
||||
auto allPositionsNode = dataNodePlatesPlate["Positions"]["positionsItem"];
|
||||
for (auto dataNodePlatesPlatePositionspositionsItem : allPositionsNode)
|
||||
{
|
||||
Data::Plate::PositionsItem positionsObject;
|
||||
if(!dataNodePlatesPlatePositionspositionsItem["X"].isNull())
|
||||
positionsObject.x = std::stol(dataNodePlatesPlatePositionspositionsItem["X"].asString());
|
||||
if(!dataNodePlatesPlatePositionspositionsItem["Y"].isNull())
|
||||
positionsObject.y = std::stol(dataNodePlatesPlatePositionspositionsItem["Y"].asString());
|
||||
plateObject.positions.push_back(positionsObject);
|
||||
}
|
||||
auto roiNode = value["Roi"];
|
||||
if(!roiNode["H"].isNull())
|
||||
plateObject.roi.h = std::stoi(roiNode["H"].asString());
|
||||
if(!roiNode["W"].isNull())
|
||||
plateObject.roi.w = std::stoi(roiNode["W"].asString());
|
||||
if(!roiNode["X"].isNull())
|
||||
plateObject.roi.x = std::stoi(roiNode["X"].asString());
|
||||
if(!roiNode["H"].isNull())
|
||||
plateObject.roi.h = std::stoi(roiNode["H"].asString());
|
||||
if(!roiNode["Y"].isNull())
|
||||
plateObject.roi.y = std::stoi(roiNode["Y"].asString());
|
||||
if(!roiNode["X"].isNull())
|
||||
plateObject.roi.x = std::stoi(roiNode["X"].asString());
|
||||
data_.plates.push_back(plateObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string RecognizeLicensePlateResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
RecognizeLicensePlateResult::Data RecognizeLicensePlateResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string RecognizeLicensePlateResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user