mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 07:16:56 +08:00
Added epoch_time as an optional value for json serializing
This commit is contained in:
@@ -281,12 +281,15 @@ std::vector<AlprResult> AlprImpl::recognize(cv::Mat img, std::vector<cv::Rect> r
|
||||
return rectRegions;
|
||||
}
|
||||
|
||||
string AlprImpl::toJson(const vector< AlprResult > results, double processing_time_ms)
|
||||
string AlprImpl::toJson(const vector<AlprResult > results, double processing_time_ms, long epoch_time)
|
||||
{
|
||||
cJSON *root, *jsonResults;
|
||||
root = cJSON_CreateObject();
|
||||
|
||||
cJSON_AddNumberToObject(root,"epoch_time", getEpochTime() );
|
||||
if (epoch_time <= 0)
|
||||
epoch_time = getEpochTime();
|
||||
|
||||
cJSON_AddNumberToObject(root,"epoch_time", epoch_time );
|
||||
if (processing_time_ms >= 0)
|
||||
{
|
||||
cJSON_AddNumberToObject(root,"processing_time_ms", processing_time_ms );
|
||||
|
@@ -79,7 +79,7 @@ class AlprImpl
|
||||
void setTopN(int topn);
|
||||
void setDefaultRegion(std::string region);
|
||||
|
||||
std::string toJson(const std::vector<AlprResult> results, double processing_time_ms = -1);
|
||||
std::string toJson(const std::vector<AlprResult> results, double processing_time_ms = -1, long epoch_time = -1);
|
||||
static std::string getVersion();
|
||||
|
||||
Config* config;
|
||||
|
Reference in New Issue
Block a user