summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_aruco/ar_video_widget.h
diff options
context:
space:
mode:
authorDonovan Baarda <abo@minkirri.apana.org.au>2014-06-12 14:53:43 +1000
committerDonovan Baarda <abo@minkirri.apana.org.au>2014-06-12 14:53:43 +1000
commit0669a40347ffa233bc6042b0f65d244509a61394 (patch)
tree36a4577bdaa1ed28ca1ad222a54777012dd2dda8 /ftnoir_tracker_aruco/ar_video_widget.h
parent72540e0a96a3120a5d02271e714aba29e136ab78 (diff)
parent7454496476ba17ea622781d280606161581c9544 (diff)
Merge branch 'master' of https://github.com/opentrack/opentrack into dev/ewma2
Resolved conflicts manually in files: ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
Diffstat (limited to 'ftnoir_tracker_aruco/ar_video_widget.h')
-rw-r--r--ftnoir_tracker_aruco/ar_video_widget.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h
new file mode 100644
index 00000000..e2cf4d9f
--- /dev/null
+++ b/ftnoir_tracker_aruco/ar_video_widget.h
@@ -0,0 +1,47 @@
+/* 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.
+ */
+
+#ifndef VIDEOWIDGET_H
+#define VIDEOWIDGET_H
+
+#include <QTimer>
+#include <QWidget>
+#include <QMutex>
+#include <QMutexLocker>
+#include <QLabel>
+#include <QPainter>
+#include <QPaintEvent>
+#include <QTimer>
+#include <opencv/cv.hpp>
+
+// ----------------------------------------------------------------------------
+class ArucoVideoWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ArucoVideoWidget(QWidget *parent) : QWidget(parent) {
+ connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint()));
+ timer.start(60);
+ }
+ void update_image(const cv::Mat& frame);
+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;
+};
+
+#endif // VIDEOWIDGET_H