diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-06 03:50:52 -0700 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-06 03:50:52 -0700 |
commit | db59542cbb2fc3c2ac1b40928d514113bced8b0b (patch) | |
tree | 88b9c5efe598aed10bb82c54bfcc04a638866f0d /ftnoir_tracker_pt/pt_video_widget.h | |
parent | b2167e6cba93106e3e6fa4a8337ebadbf049c1f8 (diff) |
rename case
Diffstat (limited to 'ftnoir_tracker_pt/pt_video_widget.h')
-rw-r--r-- | ftnoir_tracker_pt/pt_video_widget.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h new file mode 100644 index 00000000..25d593c3 --- /dev/null +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2012 Patrick Ruoff
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+#pragma once
+
+#include "frame_observer.h"
+#include <QObject>
+#include <QTime>
+#include <QDialog>
+#include <opencv2/opencv.hpp>
+#ifndef OPENTRACK_API
+# include <QGLWidget>
+# include <boost/shared_ptr.hpp>
+#else
+# include "FTNoIR_Tracker_PT/boost-compat.h"
+# if defined(_WIN32)
+# include <dshow.h>
+# endif
+#endif
+#include <QPainter>
+#include <QPaintEvent>
+#include <QTimer>
+
+class PTVideoWidget : public QWidget, public FrameObserver
+{
+ Q_OBJECT
+
+public:
+ PTVideoWidget(QWidget *parent, FrameProvider* provider) :
+ QWidget(parent),
+ /* to avoid linker errors */ FrameObserver(provider),
+ freshp(false)
+ {
+ connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint()));
+ timer.start(40);
+ }
+ void update_image(const cv::Mat &frame);
+ void update_frame_and_points() {}
+protected slots:
+ void paintEvent( QPaintEvent* e ) {
+ QMutexLocker foo(&mtx);
+ QPainter painter(this);
+ painter.drawImage(e->rect(), texture);
+ }
+ void update_and_repaint();
+private:
+ QMutex mtx;
+ QImage texture;
+ QTimer timer;
+ cv::Mat _frame;
+ bool freshp;
+};
+
+// ----------------------------------------------------------------------------
+// A VideoWidget embedded in a dialog frame
+class VideoWidgetDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ VideoWidgetDialog(QWidget *parent, FrameProvider* provider);
+ virtual ~VideoWidgetDialog() {}
+
+ PTVideoWidget* get_video_widget() { return video_widget; }
+
+private:
+ PTVideoWidget* video_widget;
+};
|