diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-15 02:04:11 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-15 02:04:11 +0200 |
commit | 51fb3e42f915c3b538c423cfb9e5dfae11778717 (patch) | |
tree | 053a64cd587d7cc1fb1fc426da5ab3a3cf4d6b9d /ftnoir_tracker_pt/video_widget.cpp | |
parent | 463737c1b50246c56a67c35c1116732006348593 (diff) | |
parent | b948329c7ae6ab2ff546cba43cdc4aca9b743cfd (diff) |
Merge branch 'master' of github.com:opentrack/opentrack
Conflicts:
facetracknoir/tracker.cpp
ftnoir_filter_accela/ftnoir_filter_accela.cpp
ftnoir_filter_accela/ftnoir_filter_accela.h
ftnoir_filter_base/ftnoir_filter_base.h
ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
Diffstat (limited to 'ftnoir_tracker_pt/video_widget.cpp')
-rw-r--r-- | ftnoir_tracker_pt/video_widget.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/ftnoir_tracker_pt/video_widget.cpp b/ftnoir_tracker_pt/video_widget.cpp index a13542ba..2b554aba 100644 --- a/ftnoir_tracker_pt/video_widget.cpp +++ b/ftnoir_tracker_pt/video_widget.cpp @@ -1,52 +1,52 @@ -/* 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.
- */
-
-#include "video_widget.h"
-
-#include <QDebug>
-
-using namespace cv;
-using namespace std;
-
-void VideoWidget::update_image(Mat frame, std::auto_ptr< vector<Vec2f> >)
-{
- QMutexLocker foo(&mtx);
-
- if (frame.channels() != 3 && frame.channels() != 1)
- return;
-
- int width = frame.cols, height = frame.rows;
- unsigned char* src = frame.data;
-
- QImage qframe(width, height, QImage::Format_RGB888);
- if (frame.channels() == 3)
- {
- uchar* data = qframe.bits();
- const int pitch = qframe.bytesPerLine();
- for (int y = 0; y < height; y++)
- for (int x = 0; x < width; x++)
- {
- const int pos = 3 * (y*width + x);
- data[y * pitch + x * 3 + 0] = src[pos + 2];
- data[y * pitch + x * 3 + 1] = src[pos + 1];
- data[y * pitch + x * 3 + 2] = src[pos + 0];
- }
- } else {
- uchar* data = qframe.bits();
- const int pitch = qframe.bytesPerLine();
- for (int y = 0; y < height; y++)
- for (int x = 0; x < width; x++)
- {
- const int pos = (y*width + x);
- data[y * pitch + x * 3 + 0] = src[pos];
- data[y * pitch + x * 3 + 1] = src[pos];
- data[y * pitch + x * 3 + 2] = src[pos];
- }
- }
- qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
- pixmap = QPixmap::fromImage(qframe);
-}
+/* 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. + */ + +#include "video_widget.h" + +#include <QDebug> + +using namespace cv; +using namespace std; + +void VideoWidget::update_image(Mat frame, std::auto_ptr< vector<Vec2f> >) +{ + QMutexLocker foo(&mtx); + + if (frame.channels() != 3 && frame.channels() != 1) + return; + + int width = frame.cols, height = frame.rows; + unsigned char* src = frame.data; + + QImage qframe(width, height, QImage::Format_RGB888); + if (frame.channels() == 3) + { + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + { + const int pos = 3 * (y*width + x); + data[y * pitch + x * 3 + 0] = src[pos + 2]; + data[y * pitch + x * 3 + 1] = src[pos + 1]; + data[y * pitch + x * 3 + 2] = src[pos + 0]; + } + } else { + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + { + const int pos = (y*width + x); + data[y * pitch + x * 3 + 0] = src[pos]; + data[y * pitch + x * 3 + 1] = src[pos]; + data[y * pitch + x * 3 + 2] = src[pos]; + } + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe); +} |