Browse Source

Merge branch 'master' of http://39.100.237.43:3000/kangjiaqi/USB_UVC_DETECT

kappo 2 months ago
parent
commit
01a91033af
3 changed files with 46 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 40 0
      ImageTest/ImageTest.h
  3. 4 0
      MppDecoder/MppManager.cpp

+ 2 - 0
.gitignore

@@ -4065,3 +4065,5 @@ build/CMakeFiles/CMakeError.log
 build/CMakeFiles/UVC_Demo.dir/GrpcTransfer/ImageService.grpc.pb.cc.o
 build/CMakeFiles/UVC_Demo.dir/GrpcTransfer/ImageService.pb.cc.o
 build/output.png
+build/CMakeFiles/UVC_Demo.dir/AIManager/PPYOLOE.cpp.o
+build/CMakeFiles/UVC_Demo.dir/AIManager/PPYOLOE.cpp.o

+ 40 - 0
ImageTest/ImageTest.h

@@ -3,6 +3,8 @@
 
 #include <opencv4/opencv2/opencv.hpp>
 #include <string>
+#include <sys/time.h>
+#include <chrono>
 
 namespace ImageTest
 {
@@ -13,5 +15,43 @@ namespace ImageTest
         cv::imwrite(filename, image);
     }
 
+    class HighResolutionTimer
+    {
+    public:
+        // 开始计时
+        void start()
+        {
+            start_time = std::chrono::high_resolution_clock::now();
+        }
+
+        // 停止计时
+        void stop()
+        {
+            end_time = std::chrono::high_resolution_clock::now();
+        }
+
+        // 获取经过的时间(以秒为单位)
+        double elapsed() const
+        {
+            return std::chrono::duration<double>(end_time - start_time).count();
+        }
+
+        // 获取经过的时间(以毫秒为单位)
+        double elapsed_milliseconds() const
+        {
+            return std::chrono::duration<double, std::milli>(end_time - start_time).count();
+        }
+
+        // 获取经过的时间(以微秒为单位)
+        double elapsed_microseconds() const
+        {
+            return std::chrono::duration<double, std::micro>(end_time - start_time).count();
+        }
+
+    private:
+        std::chrono::high_resolution_clock::time_point start_time;
+        std::chrono::high_resolution_clock::time_point end_time;
+    };
+
 }
 #endif // IMAGE_TEST_H

+ 4 - 0
MppDecoder/MppManager.cpp

@@ -35,6 +35,10 @@ void MppManager::decodeThread()
     m_threadSwitch = true;
     int index = decoder.getDecodeIndex();
     DataManager::getInstance().addDataPipe<DataPackagePtr>("resized" + std::to_string(index));
+
+    // test
+    ImageTest::HighResolutionTimer timer;
+
     while (m_threadSwitch)
     {
         DataPackagePtr dataPackage = nullptr;