Fixed UUID str output bug for alprd

This commit is contained in:
Matt Hill
2014-10-05 16:44:58 -04:00
parent fa96f53dbf
commit 4e5f82c3fb

View File

@@ -266,14 +266,15 @@ void streamRecognitionThread(void* arg)
{ {
long epoch_time = getEpochTime(); long epoch_time = getEpochTime();
std::stringstream uuid; std::stringstream uuid_ss;
uuid << tdata->site_id << "-cam" << tdata->camera_id << "-" << epoch_time; 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) // Save the image to disk (using the UUID)
if (tdata->output_images) if (tdata->output_images)
{ {
std::stringstream ss; std::stringstream ss;
ss << tdata->output_image_folder << "/" << uuid.str() << ".jpg"; ss << tdata->output_image_folder << "/" << uuid << ".jpg";
cv::imwrite(ss.str(), latestFrame); cv::imwrite(ss.str(), latestFrame);
} }
@@ -283,7 +284,7 @@ void streamRecognitionThread(void* arg)
std::string json = alpr.toJson(results, totalProcessingTime, epoch_time); std::string json = alpr.toJson(results, totalProcessingTime, epoch_time);
cJSON *root = cJSON_Parse(json.c_str()); 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_AddNumberToObject(root, "camera_id", tdata->camera_id);
cJSON_AddStringToObject(root, "site_id", tdata->site_id.c_str()); cJSON_AddStringToObject(root, "site_id", tdata->site_id.c_str());
cJSON_AddNumberToObject(root, "img_width", latestFrame.cols); cJSON_AddNumberToObject(root, "img_width", latestFrame.cols);