summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-11-07 17:20:44 +0100
committerStanislaw Halik <sthalik@misaki.pl>2013-11-07 17:20:44 +0100
commit167e1517c64974ca0a7de6ea07de53df57e2b4b7 (patch)
treeed1ea05803b2ba274643a6f6aab2dc77d60978c3
parenta22928d2ab49770ee778125ae4d4cf9c60cc81da (diff)
(hopefully) fix pitch issues on Mac
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
-rw-r--r--FTNoIR_Tracker_PT/pt_video_widget.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp
index 35a2c42b..122ab4fd 100644
--- a/FTNoIR_Tracker_PT/pt_video_widget.cpp
+++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp
@@ -50,10 +50,11 @@ void PTVideoWidget::update_and_repaint()
for (int y = 0; y < _frame.rows; y++)
for (int x = 0; x < _frame.cols; x++)
{
- const int pos = 3 * (y*_frame.cols + x);
- data[y * pitch + x * 3 + 0] = _frame.data[pos + 2];
- data[y * pitch + x * 3 + 1] = _frame.data[pos + 1];
- data[y * pitch + x * 3 + 2] = _frame.data[pos + 0];
+ const auto& elt = _frame.at<Vec3b>(y, x);
+ const CvScalar elt2 = elt;
+ data[y * pitch + x * 3 + 0] = elt2.val[2];
+ data[y * pitch + x * 3 + 1] = elt2.val[1];
+ data[y * pitch + x * 3 + 2] = elt2.val[0];
}
qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
pixmap = QPixmap::fromImage(qframe);