summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy/tracker-easy.cpp
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-13 12:24:17 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-24 18:46:12 +0200
commit4af0298b4844727e87964697357af088b63921d1 (patch)
tree03c49473e6a8e65ee3e8ac9cc4b79766444bf412 /tracker-easy/tracker-easy.cpp
parent547f3314f2a4e75a5d2c540a5f1221e9c59277ae (diff)
Easy Tracker: Deleting legacy point extractor. Various clean-up. Head center preview now working.
Diffstat (limited to 'tracker-easy/tracker-easy.cpp')
-rw-r--r--tracker-easy/tracker-easy.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index 425979ef..5fd1952c 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -27,7 +27,7 @@
using namespace options;
-EasyTracker::EasyTracker(pointer<pt_runtime_traits> const& traits) :
+EasyTracker::EasyTracker(pointer<IEasyTrackerTraits> const& traits) :
traits { traits },
s { traits->get_module_name() },
point_extractor { traits->make_point_extractor() },
@@ -130,9 +130,9 @@ void EasyTracker::run()
iPreview = iMatFrame;
}
- iImagePoints.clear();
- point_extractor->extract_points(iMatFrame, iPreview.iFrameRgb, points, iImagePoints);
- point_count.store(points.size(), std::memory_order_relaxed);
+ iPoints.clear();
+ point_extractor->extract_points(iMatFrame, (preview_visible?&iPreview.iFrameRgb:nullptr), iPoints);
+ point_count.store(iPoints.size(), std::memory_order_relaxed);
if (preview_visible)
@@ -146,7 +146,7 @@ void EasyTracker::run()
cv::destroyWindow("Preview");
}
- const bool success = points.size() >= KPointCount || iImagePoints.size() >= KPointCount;
+ const bool success = iPoints.size() >= KPointCount;
int topPointIndex = -1;
@@ -177,9 +177,9 @@ void EasyTracker::run()
int minY = std::numeric_limits<int>::max();
for (int i = 0; i < 3; i++)
{
- if (iImagePoints[i][1]<minY)
+ if (iPoints[i][1]<minY)
{
- minY = iImagePoints[i][1];
+ minY = iPoints[i][1];
topPointIndex = i;
}
}
@@ -191,9 +191,9 @@ void EasyTracker::run()
for (int i = 0; i < 3; i++)
{
// Excluding top most point
- if (i!=topPointIndex && iImagePoints[i][0] > maxX)
+ if (i!=topPointIndex && iPoints[i][0] > maxX)
{
- maxX = iImagePoints[i][0];
+ maxX = iPoints[i][0];
rightPointIndex = i;
}
}
@@ -211,9 +211,9 @@ void EasyTracker::run()
}
//
- trackedPoints.push_back(cv::Point2f(iImagePoints[rightPointIndex][0], iImagePoints[rightPointIndex][1]));
- trackedPoints.push_back(cv::Point2f(iImagePoints[leftPointIndex][0], iImagePoints[leftPointIndex][1]));
- trackedPoints.push_back(cv::Point2f(iImagePoints[topPointIndex][0], iImagePoints[topPointIndex][1]));
+ trackedPoints.push_back(cv::Point2f(iPoints[rightPointIndex][0], iPoints[rightPointIndex][1]));
+ trackedPoints.push_back(cv::Point2f(iPoints[leftPointIndex][0], iPoints[leftPointIndex][1]));
+ trackedPoints.push_back(cv::Point2f(iPoints[topPointIndex][0], iPoints[topPointIndex][1]));
std::cout << "Object: " << objectPoints << "\n";
std::cout << "Points: " << trackedPoints << "\n";
@@ -304,10 +304,7 @@ void EasyTracker::run()
if (topPointIndex != -1)
{
// Render a cross to indicate which point is the head
- if (points.size() >= 3)
- {
- iPreview.draw_head_center(points[topPointIndex][0], points[topPointIndex][1]);
- }
+ iPreview.draw_head_center(iPoints[topPointIndex][0], iPoints[topPointIndex][1]);
}
widget->update_image(iPreview.get_bitmap());