mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 19:52:50 +08:00
Added bestplate parsing and unit test
This commit is contained in:
@@ -451,6 +451,11 @@ AlprResults AlprImpl::fromJson(std::string json) {
|
|||||||
plateCandidate.matches_template = (cJSON_GetObjectItem(candidate, "matches_template")->valueint) != 0;
|
plateCandidate.matches_template = (cJSON_GetObjectItem(candidate, "matches_template")->valueint) != 0;
|
||||||
|
|
||||||
plate.topNPlates.push_back(plateCandidate);
|
plate.topNPlates.push_back(plateCandidate);
|
||||||
|
|
||||||
|
if (c == 0)
|
||||||
|
{
|
||||||
|
plate.bestPlate = plateCandidate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allResults.plates.push_back(plate);
|
allResults.plates.push_back(plate);
|
||||||
|
@@ -78,6 +78,10 @@ TEST_CASE( "JSON Serialization/Deserialization", "[json]" ) {
|
|||||||
REQUIRE( roundTrip.plates[i].regionConfidence == origResults.plates[i].regionConfidence);
|
REQUIRE( roundTrip.plates[i].regionConfidence == origResults.plates[i].regionConfidence);
|
||||||
REQUIRE( roundTrip.plates[i].requested_topn == origResults.plates[i].requested_topn);
|
REQUIRE( roundTrip.plates[i].requested_topn == origResults.plates[i].requested_topn);
|
||||||
|
|
||||||
|
REQUIRE( roundTrip.plates[i].bestPlate.characters == origResults.plates[i].bestPlate.characters);
|
||||||
|
REQUIRE( roundTrip.plates[i].bestPlate.matches_template == origResults.plates[i].bestPlate.matches_template);
|
||||||
|
REQUIRE( roundTrip.plates[i].bestPlate.overall_confidence == origResults.plates[i].bestPlate.overall_confidence);
|
||||||
|
|
||||||
REQUIRE( roundTrip.plates[i].topNPlates.size() == origResults.plates[i].topNPlates.size());
|
REQUIRE( roundTrip.plates[i].topNPlates.size() == origResults.plates[i].topNPlates.size());
|
||||||
for (int j = 0; j < roundTrip.plates[i].topNPlates.size(); j++)
|
for (int j = 0; j < roundTrip.plates[i].topNPlates.size(); j++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user