File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,28 @@ class BaseDetector
3131 return m_regions;
3232 }
3333
34+ virtual void CollectPoints (CRegion& region)
35+ {
36+ const int yStep = 5 ;
37+ const int xStep = 5 ;
38+
39+ for (int y = region.m_rect .y , yStop = region.m_rect .y + region.m_rect .height ; y < yStop; y += yStep)
40+ {
41+ for (int x = region.m_rect .x , xStop = region.m_rect .x + region.m_rect .width ; x < xStop; x += xStep)
42+ {
43+ if (region.m_rect .contains (cv::Point (x, y)))
44+ {
45+ region.m_points .push_back (cv::Point2f (static_cast <float >(x), static_cast <float >(y)));
46+ }
47+ }
48+ }
49+
50+ if (region.m_points .empty ())
51+ {
52+ region.m_points .push_back (cv::Point2f (region.m_rect .x + 0 .5f * region.m_rect .width , region.m_rect .y + 0 .5f * region.m_rect .height ));
53+ }
54+ }
55+
3456 virtual void CalcMotionMap (cv::Mat frame)
3557 {
3658 if (m_motionMap.size () != frame.size ())
Original file line number Diff line number Diff line change @@ -88,6 +88,14 @@ void DNNDetector::Detect(cv::UMat& colorFrame)
8888 [](const CRegion& reg) -> cv::Rect { return reg.m_rect ; },
8989 [](const CRegion& reg) -> float { return reg.m_confidence ; },
9090 0 , 0 .f );
91+
92+ if (m_collectPoints)
93+ {
94+ for (auto & region : m_regions)
95+ {
96+ CollectPoints (region);
97+ }
98+ }
9199}
92100
93101// /
Original file line number Diff line number Diff line change @@ -57,4 +57,12 @@ void FaceDetector::Detect(cv::UMat& gray)
5757 {
5858 m_regions.push_back (rect);
5959 }
60+
61+ if (m_collectPoints)
62+ {
63+ for (auto & region : m_regions)
64+ {
65+ CollectPoints (region);
66+ }
67+ }
6068}
Original file line number Diff line number Diff line change @@ -84,4 +84,12 @@ void PedestrianDetector::Detect(cv::UMat& gray)
8484
8585 m_regions.push_back (rect);
8686 }
87+
88+ if (m_collectPoints)
89+ {
90+ for (auto & region : m_regions)
91+ {
92+ CollectPoints (region);
93+ }
94+ }
8795}
Original file line number Diff line number Diff line change 1- 1. Collect points for all types of detectors
2- 2. External API for the detectors options: for Background subtractors, confidenceThreshold for DNNDetector etc.
3- 3. New Multitarget tracking algorithm based on Discrete-Continuous Energy Minimization: https://bitbucket.org/amilan/dctracking
4- 4. Deep SORT: https://github.com/nwojke/deep_sort
1+ 1. External API for the detectors options: for Background subtractors, confidenceThreshold for DNNDetector etc.
2+ 2. New Multitarget tracking algorithm based on Discrete-Continuous Energy Minimization: https://bitbucket.org/amilan/dctracking
3+ 3. Deep SORT: https://github.com/nwojke/deep_sort
You can’t perform that action at this time.
0 commit comments