summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp2
-rw-r--r--tracker-pt/module/point_extractor.cpp12
-rw-r--r--tracker-pt/module/point_extractor.h4
-rw-r--r--tracker-pt/pt-api.hpp2
-rw-r--r--tracker-wii/wii_point_extractor.cpp7
-rw-r--r--tracker-wii/wii_point_extractor.h5
6 files changed, 22 insertions, 10 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index 255330c4..570d76c4 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -74,7 +74,7 @@ void Tracker_PT::run()
if (preview_visible)
*preview_frame = *frame;
- point_extractor->extract_points(*frame, *preview_frame, points);
+ point_extractor->extract_points(*frame, *preview_frame, preview_visible, points);
point_count.store(points.size(), std::memory_order_relaxed);
const bool success = points.size() >= PointModel::N_POINTS;
diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp
index 5e57ef34..2f84bf86 100644
--- a/tracker-pt/module/point_extractor.cpp
+++ b/tracker-pt/module/point_extractor.cpp
@@ -282,7 +282,10 @@ static void draw_blobs(cv::Mat& preview_frame, const blob* blobs, unsigned nblob
}
}
-void PointExtractor::extract_points(const pt_frame& frame_, pt_preview& preview_frame_, std::vector<vec2>& points)
+void PointExtractor::extract_points(const pt_frame& frame_,
+ pt_preview& preview_frame_,
+ bool preview_visible,
+ std::vector<vec2>& points)
{
const cv::Mat& frame = frame_.as_const<Frame>()->mat;
@@ -402,9 +405,10 @@ end:
b.pos[1] = pos[1] + rect.y;
}
- draw_blobs(preview_frame_.as<Frame>()->mat,
- blobs.data(), blobs.size(),
- frame_gray.size());
+ if (preview_visible)
+ draw_blobs(preview_frame_.as<Frame>()->mat,
+ blobs.data(), blobs.size(),
+ frame_gray.size());
// End of mean shift code. At this point, blob positions are updated with hopefully less noisy less biased values.
diff --git a/tracker-pt/module/point_extractor.h b/tracker-pt/module/point_extractor.h
index 9c97b6ce..ab906414 100644
--- a/tracker-pt/module/point_extractor.h
+++ b/tracker-pt/module/point_extractor.h
@@ -33,7 +33,9 @@ class PointExtractor final : public pt_point_extractor
public:
// extracts points from frame and draws some processing info into frame, if draw_output is set
// dt: time since last call in seconds
- void extract_points(const pt_frame& frame, pt_preview& preview_frame, std::vector<vec2>& points) override;
+ void extract_points(const pt_frame& frame,
+ pt_preview& preview_frame, bool preview_visible,
+ std::vector<vec2>& points) override;
PointExtractor(const QString& module_name);
private:
static constexpr int max_blobs = 16;
diff --git a/tracker-pt/pt-api.hpp b/tracker-pt/pt-api.hpp
index ded5ef57..07a49c45 100644
--- a/tracker-pt/pt-api.hpp
+++ b/tracker-pt/pt-api.hpp
@@ -97,7 +97,7 @@ struct pt_point_extractor : pt_pixel_pos_mixin
pt_point_extractor();
virtual ~pt_point_extractor();
- virtual void extract_points(const pt_frame& image, pt_preview& preview_frame, std::vector<vec2>& points) = 0;
+ virtual void extract_points(const pt_frame& image, pt_preview& preview_frame, bool preview_visible, std::vector<vec2>& points) = 0;
static f threshold_radius_value(int w, int h, int threshold);
};
diff --git a/tracker-wii/wii_point_extractor.cpp b/tracker-wii/wii_point_extractor.cpp
index 393dc1c9..5e860c14 100644
--- a/tracker-wii/wii_point_extractor.cpp
+++ b/tracker-wii/wii_point_extractor.cpp
@@ -100,12 +100,15 @@ void WIIPointExtractor::draw_bg(cv::Mat& preview_frame, const struct wii_info& w
1);
}
-void WIIPointExtractor::extract_points(const pt_frame& frame_, pt_preview& preview_frame_, std::vector<vec2>& points)
+void WIIPointExtractor::extract_points(const pt_frame& frame_,
+ pt_preview& preview_frame_,
+ bool preview_visible,
+ std::vector<vec2>& points)
{
const struct wii_info& wii = frame_.as_const<WIIFrame>()->wii;
cv::Mat& preview_frame = *preview_frame_.as<WIIPreview>();
- if (wii.status == wii_cam_data_change)
+ if (preview_visible && wii.status == wii_cam_data_change)
{
draw_bg(preview_frame, wii);
draw_points(preview_frame, wii, points);
diff --git a/tracker-wii/wii_point_extractor.h b/tracker-wii/wii_point_extractor.h
index 4208f1b2..4a6f038b 100644
--- a/tracker-wii/wii_point_extractor.h
+++ b/tracker-wii/wii_point_extractor.h
@@ -23,7 +23,10 @@ class WIIPointExtractor final : public pt_point_extractor
public:
// extracts points from frame and draws some processing info into frame, if draw_output is set
// dt: time since last call in seconds
- void extract_points(const pt_frame& frame, pt_preview& preview_frame, std::vector<vec2>& points) override;
+ void extract_points(const pt_frame& frame,
+ pt_preview& preview_frame,
+ bool preview_visible,
+ std::vector<vec2>& points) override;
WIIPointExtractor(const QString& module_name);
private: