summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-09-26 19:42:36 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-09-26 21:10:13 +0200
commitf837647d6159941526ac479050bf317ae13a41a1 (patch)
tree0f711ed525fc83075f58deee5788cfc1bd3da59a
parent69d068a7da4f46eab4e2437b5dbf237b1c1d7bed (diff)
video/widget, tracker/pt: skip widget processing in more cases
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp6
-rw-r--r--video/video-widget.hpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index dabd48b4..2911a217 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -71,10 +71,10 @@ void Tracker_PT::run()
{
const bool preview_visible = check_is_visible();
- if (preview_visible)
+ if (preview_visible && !widget->fresh())
preview_frame->set_last_frame(*frame);
- point_extractor->extract_points(*frame, *preview_frame, preview_visible, points);
+ point_extractor->extract_points(*frame, *preview_frame, preview_visible && !widget->fresh(), points);
point_count.store(points.size(), std::memory_order_relaxed);
const bool success = points.size() >= PointModel::N_POINTS;
@@ -99,7 +99,7 @@ void Tracker_PT::run()
X_CM = point_tracker.pose();
}
- if (preview_visible)
+ if (preview_visible && !widget->fresh())
{
const f fx = pt_camera_info::get_focal_length(info.fov, info.res_x, info.res_y);
Affine X_MH(mat33::eye(), vec3(s.t_MH_x, s.t_MH_y, s.t_MH_z));
diff --git a/video/video-widget.hpp b/video/video-widget.hpp
index bb218c69..4f54b2b9 100644
--- a/video/video-widget.hpp
+++ b/video/video-widget.hpp
@@ -29,12 +29,12 @@ struct OTR_VIDEO_EXPORT video_widget : QWidget
void resizeEvent(QResizeEvent*) override;
void paintEvent(QPaintEvent*) override;
void draw_image();
+ bool fresh() const;
protected:
mutable QMutex mtx { QMutex::NonRecursive };
QImage texture;
std::vector<unsigned char> vec;
- bool fresh() const;
void set_fresh(bool x);
void set_image(const unsigned char* src, int width, int height, int stride, QImage::Format fmt);