AlexeyAB
2018-01-17 54f83e153549dd1a63bcc8fa5e55fb171621a989
src/yolo_console_dll.cpp
@@ -13,6 +13,7 @@
#define OPENCV
#endif
// To use tracking - uncomment the following line. Tracking is supported only by OpenCV 3.x
//#define TRACK_OPTFLOW
#include "yolo_v2_class.hpp"  // imported functions from DLL
@@ -107,7 +108,7 @@
   auto obj_names = objects_names_from_file(names_file);
   std::string out_videofile = "result.avi";
   bool const save_output_videofile = true;
   bool const save_output_videofile = false;
#ifdef TRACK_OPTFLOW
   Tracker_optflow tracker_flow;
   detector.wait_stream = true;
@@ -181,7 +182,6 @@
                           new_track_optflow_queue = track_optflow_queue;
                     }
                     track_optflow_queue = new_track_optflow_queue;
                     new_track_optflow_queue.swap(std::queue<cv::Mat>());
                     passed_flow_frames = 0;
                  }
#endif
@@ -194,7 +194,7 @@
                     auto current_image = det_image;
                     consumed = true;
                     while (current_image.use_count() > 0) {
                        auto result = detector.detect_resized(*current_image, frame_size, 0.24, false);  // true
                        auto result = detector.detect_resized(*current_image, frame_size, 0.20, false);  // true
                        ++fps_det_counter;
                        std::unique_lock<std::mutex> lock(mtx);
                        thread_result_vec = result;
@@ -236,11 +236,13 @@
                  }
               }
#ifndef TRACK_OPTFLOW
               // wait detection result for video-file only (not for net-cam)
               //if (protocol != "rtsp://" && protocol != "http://" && protocol != "https:/") {
               // std::unique_lock<std::mutex> lock(mtx);
               // while (!consumed) cv_detected.wait(lock);
               //}
               if (protocol != "rtsp://" && protocol != "http://" && protocol != "https:/") {
                  std::unique_lock<std::mutex> lock(mtx);
                  while (!consumed) cv_detected.wait(lock);
               }
#endif
            }
            if (t_cap.joinable()) t_cap.join();
            if (t_detect.joinable()) t_detect.join();