Skip to content

Commit

Permalink
Collect points for all types of detectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhny007 committed Dec 23, 2017
1 parent 9cc647f commit 18093ca
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
22 changes: 22 additions & 0 deletions Detector/BaseDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ class BaseDetector
return m_regions;
}

virtual void CollectPoints(CRegion& region)
{
const int yStep = 5;
const int xStep = 5;

for (int y = region.m_rect.y, yStop = region.m_rect.y + region.m_rect.height; y < yStop; y += yStep)
{
for (int x = region.m_rect.x, xStop = region.m_rect.x + region.m_rect.width; x < xStop; x += xStep)
{
if (region.m_rect.contains(cv::Point(x, y)))
{
region.m_points.push_back(cv::Point2f(static_cast<float>(x), static_cast<float>(y)));
}
}
}

if (region.m_points.empty())
{
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));
}
}

virtual void CalcMotionMap(cv::Mat frame)
{
if (m_motionMap.size() != frame.size())
Expand Down
8 changes: 8 additions & 0 deletions Detector/DNNDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ void DNNDetector::Detect(cv::UMat& colorFrame)
[](const CRegion& reg) -> cv::Rect { return reg.m_rect; },
[](const CRegion& reg) -> float { return reg.m_confidence; },
0, 0.f);

if (m_collectPoints)
{
for (auto& region : m_regions)
{
CollectPoints(region);
}
}
}

///
Expand Down
8 changes: 8 additions & 0 deletions Detector/FaceDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,12 @@ void FaceDetector::Detect(cv::UMat& gray)
{
m_regions.push_back(rect);
}

if (m_collectPoints)
{
for (auto& region : m_regions)
{
CollectPoints(region);
}
}
}
8 changes: 8 additions & 0 deletions Detector/PedestrianDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,12 @@ void PedestrianDetector::Detect(cv::UMat& gray)

m_regions.push_back(rect);
}

if (m_collectPoints)
{
for (auto& region : m_regions)
{
CollectPoints(region);
}
}
}
7 changes: 3 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
1. Collect points for all types of detectors
2. External API for the detectors options: for Background subtractors, confidenceThreshold for DNNDetector etc.
3. New Multitarget tracking algorithm based on Discrete-Continuous Energy Minimization: https://bitbucket.org/amilan/dctracking
4. Deep SORT: https://github.com/nwojke/deep_sort
1. External API for the detectors options: for Background subtractors, confidenceThreshold for DNNDetector etc.
2. New Multitarget tracking algorithm based on Discrete-Continuous Energy Minimization: https://bitbucket.org/amilan/dctracking
3. Deep SORT: https://github.com/nwojke/deep_sort

0 comments on commit 18093ca

Please sign in to comment.