diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-27 12:09:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-27 12:09:05 +0200 |
commit | e70bef88fdb5ffdf1c2dcf99ac9e22181d18f5ac (patch) | |
tree | 07c97a3c2f5059503c83775e10028481da89b7e3 /ftnoir_tracker_pt | |
parent | c7c3bfc9a1558864b06319918900090c7564c6d2 (diff) |
Implement video widgets properly, so they're fast enough
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r-- | ftnoir_tracker_pt/video_widget.cpp | 4 | ||||
-rw-r--r-- | ftnoir_tracker_pt/video_widget.h | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/ftnoir_tracker_pt/video_widget.cpp b/ftnoir_tracker_pt/video_widget.cpp index fe2b2e34..7ca1892a 100644 --- a/ftnoir_tracker_pt/video_widget.cpp +++ b/ftnoir_tracker_pt/video_widget.cpp @@ -32,8 +32,8 @@ void VideoWidget::update_image(Mat frame, std::auto_ptr< vector<Vec2f> > points) else
qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
QPainter painter(&qframe);
- painter.setPen(Qt::blue);
- painter.setBrush(Qt::blue);
+ painter.setPen(Qt::red);
+ painter.setBrush(Qt::red);
if (points.get() != NULL) {
const int crosshair_radius = 10;
for (vector<Vec2f>::iterator iter = points->begin();
diff --git a/ftnoir_tracker_pt/video_widget.h b/ftnoir_tracker_pt/video_widget.h index a68d8028..eb63a15e 100644 --- a/ftnoir_tracker_pt/video_widget.h +++ b/ftnoir_tracker_pt/video_widget.h @@ -16,20 +16,22 @@ #include <QMutexLocker>
#include <QLabel>
#include <QPainter>
+#include <QPaintEvent>
// ----------------------------------------------------------------------------
-class VideoWidget : public QLabel
+class VideoWidget : public QWidget
{
Q_OBJECT
public:
- VideoWidget(QWidget *parent) : QLabel(parent), mtx() {
+ VideoWidget(QWidget *parent) : QWidget(parent), mtx() {
}
void update_image(cv::Mat frame, std::auto_ptr< std::vector<cv::Vec2f> > points);
protected slots:
void paintEvent( QPaintEvent* e ) {
- setPixmap(pixmap);
- QLabel::paintEvent(e);
+ QMutexLocker((QMutex*)&mtx);
+ QPainter painter(this);
+ painter.drawPixmap(e->rect(), pixmap);
}
private:
|