mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 04:40:51 +08:00
Added attributes to JSON
This commit is contained in:
@@ -84,6 +84,10 @@ AlprFullDetails AlprImpl::recognizeFullDetails(cv::Mat img, std::vector<cv::Rect
|
|||||||
|
|
||||||
AlprFullDetails response;
|
AlprFullDetails response;
|
||||||
|
|
||||||
|
response.results.epoch_time = getEpochTime();
|
||||||
|
response.results.img_width = img.cols;
|
||||||
|
response.results.img_height = img.rows;
|
||||||
|
|
||||||
if (!img.data)
|
if (!img.data)
|
||||||
{
|
{
|
||||||
// Invalid image
|
// Invalid image
|
||||||
@@ -196,11 +200,12 @@ AlprFullDetails AlprImpl::recognizeFullDetails(cv::Mat img, std::vector<cv::Rect
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timespec endTime;
|
||||||
|
getTime(&endTime);
|
||||||
|
response.results.total_processing_time_ms = diffclock(startTime, endTime);
|
||||||
|
|
||||||
if (config->debugTiming)
|
if (config->debugTiming)
|
||||||
{
|
{
|
||||||
timespec endTime;
|
|
||||||
getTime(&endTime);
|
|
||||||
cout << "Total Time to process image: " << diffclock(startTime, endTime) << "ms." << endl;
|
cout << "Total Time to process image: " << diffclock(startTime, endTime) << "ms." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,11 +299,10 @@ string AlprImpl::toJson( const AlprResults results )
|
|||||||
|
|
||||||
cJSON_AddNumberToObject(root,"epoch_time", results.epoch_time );
|
cJSON_AddNumberToObject(root,"epoch_time", results.epoch_time );
|
||||||
cJSON_AddNumberToObject(root,"version", 2 );
|
cJSON_AddNumberToObject(root,"version", 2 );
|
||||||
|
cJSON_AddNumberToObject(root,"img_width", results.img_width );
|
||||||
if (results.total_processing_time_ms >= 0)
|
cJSON_AddNumberToObject(root,"img_height", results.img_height );
|
||||||
{
|
|
||||||
cJSON_AddNumberToObject(root,"processing_time_ms", results.total_processing_time_ms );
|
cJSON_AddNumberToObject(root,"processing_time_ms", results.total_processing_time_ms );
|
||||||
}
|
|
||||||
|
|
||||||
cJSON_AddItemToObject(root, "results", jsonResults=cJSON_CreateArray());
|
cJSON_AddItemToObject(root, "results", jsonResults=cJSON_CreateArray());
|
||||||
for (uint i = 0; i < results.plates.size(); i++)
|
for (uint i = 0; i < results.plates.size(); i++)
|
||||||
|
Reference in New Issue
Block a user