Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ac0b3f5
Added hough3d sources
Nuzhny007 Feb 3, 2018
71d3e3e
Calculate 3D hough trajectory lines
Nuzhny007 Feb 5, 2018
d34a20d
Added fps
Nuzhny007 Feb 5, 2018
7e7c301
Some warnings removing
Feb 6, 2018
a0a6b0f
Fixed warning
Feb 7, 2018
d4de8fd
Added small crops in DNN detector for High resolution videos and smal…
Nuzhny007 Mar 3, 2018
6dd26d2
Small refactoring
Nuzhny007 Mar 3, 2018
7fa074f
Some fix for single tracking
Nuzhny007 Mar 3, 2018
3a0b36a
Added openmp flags to the compiler
Nuzhny007 Mar 3, 2018
0cc1866
Draw trajectory option
Nuzhny007 Mar 3, 2018
7482d15
Update Readme
Nuzhny007 Mar 3, 2018
3a0b295
Fixed link
Nuzhny007 Mar 3, 2018
6c9081c
Hough3D disabled now in CMake
Nuzhny007 Mar 4, 2018
f4b41cb
Added Yolo (and Tiny Yolo) detector
Nuzhny007 Mar 15, 2018
3327e3b
Update Readme
Nuzhny007 Mar 15, 2018
2b6a667
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Mar 15, 2018
616d1f1
Remove unused Hybrid face detector
Nuzhny007 Mar 19, 2018
41d7bb1
Extract Capture+Detection into the separate thread
Nuzhny007 Mar 19, 2018
f8b91f8
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Mar 19, 2018
e1a4258
Fixed potential deadlock
Nuzhny007 Mar 24, 2018
955dad8
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Mar 27, 2018
f0830d3
Points visualization
Nuzhny007 Mar 27, 2018
339d9fb
Merge branch 'master' of https://github.com/Nuzhny007/Multitarget-tra…
Nuzhny007 Mar 27, 2018
96bd4cf
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Mar 27, 2018
753d9b3
Control out the frame moving
Nuzhny007 Apr 4, 2018
94ff586
Remove hough3d from master
Nuzhny007 Apr 16, 2018
42b7e70
Fixed NMS for object with different types
Nuzhny007 Apr 24, 2018
0d60256
Fix in Readme and TODO
Nuzhny007 May 3, 2018
8f18a36
OpenCV 4.0 ready
Nuzhny007 Jun 5, 2018
c25a1e4
Added YOLO v3 tiny
Nuzhny007 Jun 5, 2018
e9fe1cf
Added compute target for DNN examples (default is OpenCL_FP16)
Nuzhny007 Jun 5, 2018
03844a6
Fixed compatible bug with OpenCV version < 4.0
Nuzhny007 Jun 6, 2018
80bfd5f
Fixed project name in CMake
Nuzhny007 Jun 6, 2018
a362c85
Simple implementation of the Abandoned detection
Nuzhny007 Jun 8, 2018
9edeb47
Increased timeout
Nuzhny007 Jun 8, 2018
08c01cf
Fixed help message
Nuzhny007 Jun 8, 2018
faeec0e
Added Abandoned to the Readme
Nuzhny007 Jun 8, 2018
a4539cc
Fixed Readme
Nuzhny007 Jun 8, 2018
d190550
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Jun 10, 2018
a604bcc
Switch travis to the latest OpenCV 3.4.1 version
Nuzhny007 Jun 10, 2018
9a47d84
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Jun 10, 2018
ee97c42
Set timeouts to 60 sec
Nuzhny007 Jul 11, 2018
1d1e7e0
Fixed travis script for OpenCV 3.4.1
Nuzhny007 Jul 11, 2018
22c8892
Fixed travis for gcc6
Nuzhny007 Jul 11, 2018
23336ae
Fixed linker error
Nuzhny007 Jul 11, 2018
3fb14a6
Fixed compiler in travis
Nuzhny007 Jul 11, 2018
636abfa
Fixed travis and CMakeLists for C++14 support
Nuzhny007 Jul 11, 2018
877e85b
Capture for webcams
Nuzhny007 Jul 19, 2018
fa9b1a9
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Jul 19, 2018
f6645c8
Fix bug with ROI for local tracking
Nuzhny007 Aug 14, 2018
7b22407
Automatic inertia correction in linear Kalman filter
Nuzhny007 Aug 14, 2018
953d99a
Update TODO
Nuzhny007 Aug 22, 2018
de6a385
Yolo eample refactoring
Nuzhny007 Sep 27, 2018
ee984a4
Refactoring: split project to share library and example
Nuzhny007 Sep 27, 2018
5d026a6
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Sep 27, 2018
06cf333
Added cars counting example
Nuzhny007 Sep 27, 2018
2f42688
Fix for OpenCV 4.0
Nuzhny007 Sep 27, 2018
69729e9
Single threaded cars counting example
Nuzhny007 Sep 30, 2018
85ca6c5
Added lines class
Nuzhny007 Sep 30, 2018
bd0de92
Added API for road lines
Nuzhny007 Sep 30, 2018
61c018f
Added cars counting code
Nuzhny007 Sep 30, 2018
f9acc6f
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Sep 30, 2018
56e7382
Changed road line caption
Nuzhny007 Oct 1, 2018
c2ba725
Fixed bug with roi rect clamping
Nuzhny007 Oct 1, 2018
de3c4cd
To Linear Kalman filter added speed for rectangle size
Nuzhny007 Oct 1, 2018
4d45400
Improved quality of line intersection algorithm
Nuzhny007 Oct 1, 2018
7ba7abd
Fixed bug with Kalman width and height correction
Nuzhny007 Oct 1, 2018
efeb99a
Return MOSSE tracker
Nuzhny007 Oct 1, 2018
48868f2
Temporal correction object size when selected only points filter
Nuzhny007 Oct 1, 2018
67dc3aa
Some small improvements
Nuzhny007 Oct 1, 2018
afc3aff
Compilation on Windows MSVC 2017 with OpenCV 4.0
Nuzhny007 Oct 7, 2018
9844cca
Added new CSRT tracker from opencv_contrib
Nuzhny007 Oct 12, 2018
24ac508
Fixed some warnings
Nuzhny007 Oct 12, 2018
2573e90
Merge branch 'master' of https://github.com/Smorodov/Multitarget-tracker
Nuzhny007 Oct 12, 2018
93c8a9a
Fixed type conversion warnings
Nuzhny007 Oct 19, 2018
6dc93c2
In CMake added options for enable|disable building cars counting and …
Nuzhny007 Oct 19, 2018
b0a3f1b
Merge branch 'master' of https://github.com/Nuzhny007/Multitarget-tra…
Nuzhny007 Oct 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)

project(MultitargetTracking)
project(MTTracking)

unset(CMAKE_CXX_FLAGS CACHE)

Expand All @@ -18,14 +18,21 @@ elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4 -DGTL_STATIC" CACHE STRING COMPILE_FLAGS FORCE)
endif()


set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

FIND_PACKAGE(OpenCV)

add_subdirectory(src)
add_subdirectory(example)
add_subdirectory(cars_counting)

option(BUILD_EXAMPLES "Should compiled examples (motion detection, pedestrians, faces, DNNs etc)?" ON)
if (BUILD_EXAMPLES)
add_subdirectory(example)
endif(BUILD_EXAMPLES)

option(BUILD_CARS_COUNTING "Should compiled Cars counting example?" OFF)
if (BUILD_CARS_COUNTING)
add_subdirectory(cars_counting)
endif(BUILD_CARS_COUNTING)

2 changes: 1 addition & 1 deletion cars_counting/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.5)

project(CarsCounting)

Expand Down
43 changes: 32 additions & 11 deletions cars_counting/CarsCounting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ void CarsCounting::Process()

m_fps = std::max(1.f, (float)capture.get(cv::CAP_PROP_FPS));

m_fps = std::max(1.f, (float)capture.get(cv::CAP_PROP_FPS));

cv::Mat colorFrame;
cv::UMat grayFrame;
for (;;)
Expand Down Expand Up @@ -189,11 +191,19 @@ void CarsCounting::DrawTrack(cv::Mat frame,

if (isStatic)
{
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, cv::LINE_AA);
#else
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, CV_AA);
#endif
}
else
{
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, cv::LINE_AA);
#else
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, CV_AA);
#endif
}

if (drawTrajectory)
Expand All @@ -204,11 +214,18 @@ void CarsCounting::DrawTrack(cv::Mat frame,
{
const TrajectoryPoint& pt1 = track.m_trace.at(j);
const TrajectoryPoint& pt2 = track.m_trace.at(j + 1);

cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, cv::LINE_AA);
#else
cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, CV_AA);
#endif
if (!pt2.m_hasRaw)
{
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, cv::LINE_AA);
#else
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, CV_AA);
#endif
}
}
}
Expand All @@ -219,7 +236,11 @@ void CarsCounting::DrawTrack(cv::Mat frame,

for (auto pt : track.m_lastRegion.m_points)
{
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, cv::LINE_AA);
#else
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, CV_AA);
#endif
}
}
}
Expand Down Expand Up @@ -254,24 +275,24 @@ bool CarsCounting::InitTracker(cv::UMat frame)
settings.m_distType = tracking::DistCenters;
settings.m_kalmanType = tracking::KalmanLinear;
settings.m_filterGoal = tracking::FilterRect;
settings.m_lostTrackType = tracking::TrackKCF; // Use KCF tracker for collisions resolving
settings.m_lostTrackType = tracking::TrackerCSRT; // Use KCF tracker for collisions resolving
settings.m_matchType = tracking::MatchHungrian;
settings.m_dt = 0.5f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.5f; // Accel noise magnitude for Kalman filter
settings.m_distThres = frame.rows / 15; // Distance threshold between region and object on two frames
settings.m_distThres = frame.rows / 15.f; // Distance threshold between region and object on two frames

settings.m_useAbandonedDetection = false;
if (settings.m_useAbandonedDetection)
{
settings.m_minStaticTime = minStaticTime;
settings.m_maxStaticTime = 60;
settings.m_maximumAllowedSkippedFrames = settings.m_minStaticTime * m_fps; // Maximum allowed skipped frames
settings.m_maximumAllowedSkippedFrames = cvRound(settings.m_minStaticTime * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = 2 * settings.m_maximumAllowedSkippedFrames; // Maximum trace length
}
else
{
settings.m_maximumAllowedSkippedFrames = 2 * m_fps; // Maximum allowed skipped frames
settings.m_maxTraceLength = 4 * m_fps; // Maximum trace length
settings.m_maximumAllowedSkippedFrames = cvRound(2 * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(4 * m_fps); // Maximum trace length
}

m_tracker = std::make_unique<CTracker>(settings);
Expand Down
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.5)

project(MultitargetTracker)

Expand Down
12 changes: 10 additions & 2 deletions example/MouseExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ void MouseTracking(cv::CommandLineParser parser)

for (size_t i = 0; i < pts.size(); i++)
{
cv::circle(frame, pts[i], 3, cv::Scalar(0, 255, 0), 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::circle(frame, pts[i], 3, cv::Scalar(0, 255, 0), 1, cv::LINE_AA);
#else
cv::circle(frame, pts[i], 3, cv::Scalar(0, 255, 0), 1, CV_AA);
#endif
}

tracker.Update(regions, cv::UMat(), 100);
Expand All @@ -101,7 +105,11 @@ void MouseTracking(cv::CommandLineParser parser)
{
for (size_t j = 0; j < track->m_trace.size() - 1; j++)
{
cv::line(frame, track->m_trace[j], track->m_trace[j + 1], colors[i % colors.size()], 2, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::line(frame, track->m_trace[j], track->m_trace[j + 1], colors[i % colors.size()], 2, cv::LINE_AA);
#else
cv::line(frame, track->m_trace[j], track->m_trace[j + 1], colors[i % colors.size()], 2, CV_AA);
#endif
}
}
}
Expand Down
31 changes: 25 additions & 6 deletions example/VideoExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,19 @@ void VideoExample::DrawTrack(cv::Mat frame,

if (isStatic)
{
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, cv::LINE_AA);
#else
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(255, 0, 255), 2, CV_AA);
#endif
}
else
{
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, cv::LINE_AA);
#else
cv::rectangle(frame, ResizeRect(track.GetLastRect()), cv::Scalar(0, 255, 0), 1, CV_AA);
#endif
}

if (drawTrajectory)
Expand All @@ -337,11 +345,18 @@ void VideoExample::DrawTrack(cv::Mat frame,
{
const TrajectoryPoint& pt1 = track.m_trace.at(j);
const TrajectoryPoint& pt2 = track.m_trace.at(j + 1);

cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, cv::LINE_AA);
#else
cv::line(frame, ResizePoint(pt1.m_prediction), ResizePoint(pt2.m_prediction), cl, 1, CV_AA);
#endif
if (!pt2.m_hasRaw)
{
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, cv::LINE_AA);
#else
cv::circle(frame, ResizePoint(pt2.m_prediction), 4, cl, 1, CV_AA);
#endif
}
}
}
Expand All @@ -352,7 +367,11 @@ void VideoExample::DrawTrack(cv::Mat frame,

for (auto pt : track.m_lastRegion.m_points)
{
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, CV_AA);
#if (CV_VERSION_MAJOR >= 4)
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, cv::LINE_AA);
#else
cv::circle(frame, cv::Point(cvRound(pt.x), cvRound(pt.y)), 1, cl, -1, CV_AA);
#endif
}
}
}
42 changes: 25 additions & 17 deletions example/VideoExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,20 @@ class MotionDetectorExample : public VideoExample
settings.m_matchType = tracking::MatchHungrian;
settings.m_dt = 0.4f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.5f; // Accel noise magnitude for Kalman filter
settings.m_distThres = frame.rows / 20; // Distance threshold between region and object on two frames
settings.m_distThres = frame.rows / 20.f; // Distance threshold between region and object on two frames

settings.m_useAbandonedDetection = true;
if (settings.m_useAbandonedDetection)
{
settings.m_minStaticTime = minStaticTime;
settings.m_maxStaticTime = 60;
settings.m_maximumAllowedSkippedFrames = settings.m_minStaticTime * m_fps; // Maximum allowed skipped frames
settings.m_maximumAllowedSkippedFrames = cvRound(settings.m_minStaticTime * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = 2 * settings.m_maximumAllowedSkippedFrames; // Maximum trace length
}
else
{
settings.m_maximumAllowedSkippedFrames = 2 * m_fps; // Maximum allowed skipped frames
settings.m_maxTraceLength = 4 * m_fps; // Maximum trace length
settings.m_maximumAllowedSkippedFrames = cvRound(2 * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(4 * m_fps); // Maximum trace length
}

m_tracker = std::make_unique<CTracker>(settings);
Expand Down Expand Up @@ -235,8 +235,8 @@ class FaceDetectorExample : public VideoExample
settings.m_dt = 0.3f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.1f; // Accel noise magnitude for Kalman filter
settings.m_distThres = 0.8f; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = m_fps / 2; // Maximum allowed skipped frames
settings.m_maxTraceLength = 5 * m_fps; // Maximum trace length
settings.m_maximumAllowedSkippedFrames = cvRound(m_fps / 2); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(5 * m_fps); // Maximum trace length

m_tracker = std::make_unique<CTracker>(settings);

Expand Down Expand Up @@ -313,9 +313,9 @@ class PedestrianDetectorExample : public VideoExample
settings.m_matchType = tracking::MatchHungrian;
settings.m_dt = 0.3f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.1f; // Accel noise magnitude for Kalman filter
settings.m_distThres = frame.rows / 10; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = m_fps; // Maximum allowed skipped frames
settings.m_maxTraceLength = 5 * m_fps; // Maximum trace length
settings.m_distThres = frame.rows / 10.f; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = cvRound(m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(5 * m_fps); // Maximum trace length

m_tracker = std::make_unique<CTracker>(settings);

Expand Down Expand Up @@ -391,9 +391,9 @@ class SSDMobileNetExample : public VideoExample
settings.m_matchType = tracking::MatchHungrian;
settings.m_dt = 0.3f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.1f; // Accel noise magnitude for Kalman filter
settings.m_distThres = frame.rows / 10; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = 2 * m_fps; // Maximum allowed skipped frames
settings.m_maxTraceLength = 5 * m_fps; // Maximum trace length
settings.m_distThres = frame.rows / 10.f; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = cvRound(2 * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(5 * m_fps); // Maximum trace length

m_tracker = std::make_unique<CTracker>(settings);

Expand Down Expand Up @@ -424,7 +424,11 @@ class SSDMobileNetExample : public VideoExample
int baseLine = 0;
cv::Size labelSize = cv::getTextSize(label, cv::FONT_HERSHEY_SIMPLEX, 0.5, 1, &baseLine);
auto rect(track->GetLastRect());
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), CV_FILLED);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), cv::FILLED);
#else
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), CV_FILLED);
#endif
cv::putText(frame, label, cv::Point(rect.x, rect.y), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 0));
}
}
Expand Down Expand Up @@ -502,9 +506,9 @@ class YoloExample : public VideoExample
settings.m_matchType = tracking::MatchHungrian;
settings.m_dt = 0.3f; // Delta time for Kalman filter
settings.m_accelNoiseMag = 0.2f; // Accel noise magnitude for Kalman filter
settings.m_distThres = frame.rows / 10; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = 2 * m_fps; // Maximum allowed skipped frames
settings.m_maxTraceLength = 5 * m_fps; // Maximum trace length
settings.m_distThres = frame.rows / 10.f; // Distance threshold between region and object on two frames
settings.m_maximumAllowedSkippedFrames = cvRound(2 * m_fps); // Maximum allowed skipped frames
settings.m_maxTraceLength = cvRound(5 * m_fps); // Maximum trace length

m_tracker = std::make_unique<CTracker>(settings);

Expand Down Expand Up @@ -535,7 +539,11 @@ class YoloExample : public VideoExample
int baseLine = 0;
cv::Size labelSize = cv::getTextSize(label, cv::FONT_HERSHEY_SIMPLEX, 0.5, 1, &baseLine);
auto rect(track->GetLastRect());
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), CV_FILLED);
#if (CV_VERSION_MAJOR >= 4)
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), cv::FILLED);
#else
cv::rectangle(frame, cv::Rect(cv::Point(rect.x, rect.y - labelSize.height), cv::Size(labelSize.width, labelSize.height + baseLine)), cv::Scalar(255, 255, 255), CV_FILLED);
#endif
cv::putText(frame, label, cv::Point(rect.x, rect.y), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 0));
}
}
Expand Down
Loading