From 23c313138b5bda4a513f696de1f95dba33dc2832 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 5 Oct 2015 21:23:28 -0400 Subject: [PATCH] Fixes issue #206 JSON garbage results --- src/openalpr/alpr_impl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 65df105..35d65f1 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -114,9 +114,7 @@ namespace alpr AlprFullDetails response; - response.results.epoch_time = getEpochTimeMs(); - response.results.img_width = img.cols; - response.results.img_height = img.rows; + int64_t start_time = getEpochTimeMs(); // Fix regions of interest in case they extend beyond the bounds of the image for (unsigned int i = 0; i < regionsOfInterest.size(); i++) @@ -159,6 +157,10 @@ namespace alpr config->setCountry(config->loaded_countries[i]); AlprFullDetails sub_results = analyzeSingleCountry(img, grayImg, warpedRegionsOfInterest); + sub_results.results.epoch_time = start_time; + sub_results.results.img_width = img.cols; + sub_results.results.img_height = img.rows; + aggregator.addResults(sub_results); } response = aggregator.getAggregateResults(); @@ -226,7 +228,7 @@ namespace alpr AlprFullDetails AlprImpl::analyzeSingleCountry(cv::Mat colorImg, cv::Mat grayImg, std::vector warpedRegionsOfInterest) { AlprFullDetails response; - + AlprRecognizers country_recognizers = recognizers[config->country]; timespec startTime; getTimeMonotonic(&startTime);