diff --git a/src/main.cpp b/src/main.cpp index 29997de..553e329 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -296,11 +296,13 @@ bool detectandshow( Alpr* alpr, cv::Mat frame, std::string region, bool writeJso for (int i = 0; i < results.plates.size(); i++) { std::cout << "plate" << i << ": " << results.plates[i].topNPlates.size() << " results"; - if (measureProcessingTime) - std::cout << " -- Processing Time = " << results.plates[i].processing_time_ms << "ms."; - std::cout << std::endl; - + if (measureProcessingTime) + std::cout << " -- Processing Time = " << results.plates[i].processing_time_ms << "ms."; + std::cout << std::endl; + if (results.plates[i].regionConfidence > 0) + std::cout << "State ID: " << results.plates[i].region << " (" << results.plates[i].regionConfidence << "% confidence)" << std::endl; + for (int k = 0; k < results.plates[i].topNPlates.size(); k++) { std::cout << " - " << results.plates[i].topNPlates[k].characters << "\t confidence: " << results.plates[i].topNPlates[k].overall_confidence; diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 0df2488..372cffd 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -139,11 +139,11 @@ AlprFullDetails AlprImpl::recognizeFullDetails(cv::Mat img, std::vectorrecognize(&pipeline_data); - if (plateResult.regionConfidence > 0) + stateIdentifier->recognize(&pipeline_data); + if (pipeline_data.region_confidence > 0) { - plateResult.region = statecode; + plateResult.region = pipeline_data.region_code; + plateResult.regionConfidence = (int) pipeline_data.region_confidence; } } diff --git a/src/openalpr/featurematcher.cpp b/src/openalpr/featurematcher.cpp index 18c7cad..feeb8e6 100644 --- a/src/openalpr/featurematcher.cpp +++ b/src/openalpr/featurematcher.cpp @@ -288,6 +288,7 @@ RecognitionResult FeatureMatcher::recognize( const Mat& queryImg, bool drawOnIma RecognitionResult result; result.haswinner = false; + result.confidence = 0; Mat queryDescriptors; vector queryKeypoints; diff --git a/src/openalpr/pipeline_data.cpp b/src/openalpr/pipeline_data.cpp index 5d7ce38..cc3cfe5 100644 --- a/src/openalpr/pipeline_data.cpp +++ b/src/openalpr/pipeline_data.cpp @@ -11,6 +11,8 @@ PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config this->regionOfInterest = regionOfInterest; this->config = config; + this->region_confidence = 0; + plate_inverted = false; }