summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ftnoir_tracker_ht/video_widget.cpp9
-rw-r--r--ftnoir_tracker_ht/video_widget.h10
-rw-r--r--ftnoir_tracker_pt/video_widget.cpp4
-rw-r--r--ftnoir_tracker_pt/video_widget.h10
4 files changed, 17 insertions, 16 deletions
diff --git a/ftnoir_tracker_ht/video_widget.cpp b/ftnoir_tracker_ht/video_widget.cpp
index 01f2516a..1504822d 100644
--- a/ftnoir_tracker_ht/video_widget.cpp
+++ b/ftnoir_tracker_ht/video_widget.cpp
@@ -14,13 +14,10 @@ using namespace std;
void VideoWidget::update_image(unsigned char *frame, int width, int height)
{
QMutexLocker((QMutex*)&mtx);
- QImage qframe = QImage(frame, width, height, 3 * width, QImage::Format_RGB888).rgbSwapped().mirrored();
+ QImage qframe = QImage(frame, width, height, 3 * width, QImage::Format_RGB888).rgbSwapped();
if (qframe.size() == size() || (qframe.width() <= this->width() && qframe.height() <= this->height()))
- qframe = qframe.mirrored();
+ qframe = qframe;
else
- qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation).mirrored();
- QPainter painter(&qframe);
- painter.setPen(Qt::blue);
- painter.setBrush(Qt::blue);
+ qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
pixmap = QPixmap::fromImage(qframe);
}
diff --git a/ftnoir_tracker_ht/video_widget.h b/ftnoir_tracker_ht/video_widget.h
index 51acc35e..9d8ab489 100644
--- a/ftnoir_tracker_ht/video_widget.h
+++ b/ftnoir_tracker_ht/video_widget.h
@@ -15,20 +15,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(unsigned char* frame, int width, int height);
protected slots:
void paintEvent( QPaintEvent* e ) {
- setPixmap(pixmap);
- QLabel::paintEvent(e);
+ QMutexLocker((QMutex*)&mtx);
+ QPainter painter(this);
+ painter.drawPixmap(e->rect(), pixmap);
}
private:
QMutex mtx;
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: