From 8e10c57c7e053d8789747cf1e2c5fa78f2f65cc7 Mon Sep 17 00:00:00 2001
From: Scheaven <xuepengqiang>
Date: 星期三, 11 八月 2021 20:17:55 +0800
Subject: [PATCH] add t

---
 demo.cpp |   46 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/demo.cpp b/demo.cpp
index 4b0ceb1..0c8c106 100644
--- a/demo.cpp
+++ b/demo.cpp
@@ -9,6 +9,36 @@
 using namespace std;
 using namespace cv;
 void* handle;
+bool do_frame(Mat frame, TImage *img, void *sr, void* handle, int cam_id)
+{
+    if(!frame.empty())
+    {
+        img->width = frame.cols;
+        img->height = frame.rows;
+        img->channel = frame.channels();
+        img->data = frame.data;
+        const char * img_time = fa_getSysTime();
+        const char* mode = "video";
+//        printf("===%s\n",img_time);
+        std::cout<< "===%s锛�" << img_time << std::endl;
+
+        sr = get_result2(handle, img, cam_id, img_time, mode);
+        TResult * t_result = (TResult*) sr;
+        cout << "=======t_result->count==" << t_result->count  << endl;
+        for (int i=0; i<t_result->count; i++)
+        {
+            cout << "====1111111111===confidence:" << t_result->targets[i].confidence << endl;
+            cout << "====1111111111===attri:" << t_result->targets[i].attribute << endl;
+        }
+
+        return true;
+    }else{
+        cout << "-----------------------over--" << endl;
+        release(handle);
+        release_result(sr);
+        return false;
+    }
+}
 
 int main(int argc, char *argv[])
 {
@@ -38,18 +68,10 @@
         cap >> frame;
         if(!frame.empty())
         {
-            img->width = frame.cols;
-            img->height = frame.rows;
-            img->channel = frame.channels();
-            img->data = frame.data;
-            sr = get_result(handle, img, 0);
-            TResult * t_result = (TResult*) sr;
-            cout << "t_result->count==" << t_result->count  << endl;
-            for (int i=0; i<t_result->count; i++)
-            {
-                cout << "confidence:" << t_result->targets[i].confidence << endl;
-                // draw_SDK_result(frame, t_result->targets[i]);
-            }
+            // std::clock_t t_strat2 = std::clock();
+            if(!do_frame(frame, img, sr, handle, i))
+                return 0;
+            cout << "-------------" << endl;
         }else{
             cout << "------------over--" << endl;
             release(handle);

--
Gitblit v1.8.0