\brief AsyncDetector::CaptureThread \param fileName \param framesQue \param stopFlag
| 251 | /// \param stopFlag |
| 252 | /// |
| 253 | void AsyncDetector::CaptureThread(std::string fileName, int startFrame, int* framesCount, float* fps, FramesQueue* framesQue, bool* stopFlag) |
| 254 | { |
| 255 | cv::VideoCapture capture; |
| 256 | if (fileName.size() == 1) |
| 257 | capture.open(atoi(fileName.c_str())); |
| 258 | else |
| 259 | capture.open(fileName); |
| 260 | |
| 261 | if (!capture.isOpened()) |
| 262 | { |
| 263 | *stopFlag = true; |
| 264 | std::cerr << "Can't open " << fileName << std::endl; |
| 265 | return; |
| 266 | } |
| 267 | *framesCount = cvRound(capture.get(cv::CAP_PROP_FRAME_COUNT)); |
| 268 | capture.set(cv::CAP_PROP_POS_FRAMES, startFrame); |
| 269 | |
| 270 | time_point_t startTimeStamp = std::chrono::system_clock::now(); |
| 271 | |
| 272 | *fps = std::max(1.f, (float)capture.get(cv::CAP_PROP_FPS)); |
| 273 | int frameHeight = cvRound(capture.get(cv::CAP_PROP_FRAME_HEIGHT)); |
| 274 | |
| 275 | // Detector |
| 276 | config_t detectorConfig; |
| 277 | |
| 278 | #ifdef _WIN32 |
| 279 | std::string pathToModel = "../../data/"; |
| 280 | #else |
| 281 | std::string pathToModel = "../data/"; |
| 282 | #endif |
| 283 | |
| 284 | #if 0 |
| 285 | detectorConfig.emplace("modelConfiguration", pathToModel + "yolov3-tiny.cfg"); |
| 286 | detectorConfig.emplace("modelBinary", pathToModel + "yolov3-tiny.weights"); |
| 287 | #else |
| 288 | detectorConfig.emplace("modelConfiguration", pathToModel + "yolov4-csp.cfg"); |
| 289 | detectorConfig.emplace("modelBinary", pathToModel + "yolov4-csp.weights"); |
| 290 | #endif |
| 291 | detectorConfig.emplace("classNames", pathToModel + "coco.names"); |
| 292 | detectorConfig.emplace("confidenceThreshold", "0.3"); |
| 293 | detectorConfig.emplace("maxCropRatio", "3.0"); |
| 294 | |
| 295 | #if 1 |
| 296 | detectorConfig.emplace("white_list", "person"); |
| 297 | detectorConfig.emplace("white_list", "car"); |
| 298 | detectorConfig.emplace("white_list", "bicycle"); |
| 299 | detectorConfig.emplace("white_list", "motorbike"); |
| 300 | detectorConfig.emplace("white_list", "bus"); |
| 301 | detectorConfig.emplace("white_list", "truck"); |
| 302 | #endif |
| 303 | |
| 304 | // Tracker |
| 305 | const int minStaticTime = 5; |
| 306 | |
| 307 | TrackerSettings trackerSettings; |
| 308 | trackerSettings.SetDistance(tracking::DistCenters); |
| 309 | trackerSettings.m_kalmanType = tracking::KalmanLinear; |
| 310 | trackerSettings.m_filterGoal = tracking::FilterRect; |
nothing calls this directly
no test coverage detected