From 4e5f82c3fb9015ea00cb0ff8be4a70fc8b8063fa Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sun, 5 Oct 2014 16:44:58 -0400 Subject: [PATCH] Fixed UUID str output bug for alprd --- src/daemon.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/daemon.cpp b/src/daemon.cpp index 356b27b..82f672f 100644 --- a/src/daemon.cpp +++ b/src/daemon.cpp @@ -266,14 +266,15 @@ void streamRecognitionThread(void* arg) { long epoch_time = getEpochTime(); - std::stringstream uuid; - uuid << tdata->site_id << "-cam" << tdata->camera_id << "-" << epoch_time; - + std::stringstream uuid_ss; + uuid_ss << tdata->site_id << "-cam" << tdata->camera_id << "-" << epoch_time; + std::string uuid = uuid_ss.str(); + // Save the image to disk (using the UUID) if (tdata->output_images) { std::stringstream ss; - ss << tdata->output_image_folder << "/" << uuid.str() << ".jpg"; + ss << tdata->output_image_folder << "/" << uuid << ".jpg"; cv::imwrite(ss.str(), latestFrame); } @@ -283,7 +284,7 @@ void streamRecognitionThread(void* arg) std::string json = alpr.toJson(results, totalProcessingTime, epoch_time); cJSON *root = cJSON_Parse(json.c_str()); - cJSON_AddStringToObject(root, "uuid", uuid.str().c_str()); + cJSON_AddStringToObject(root, "uuid", uuid.c_str()); cJSON_AddNumberToObject(root, "camera_id", tdata->camera_id); cJSON_AddStringToObject(root, "site_id", tdata->site_id.c_str()); cJSON_AddNumberToObject(root, "img_width", latestFrame.cols);