From 167e1517c64974ca0a7de6ea07de53df57e2b4b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Nov 2013 17:20:44 +0100 Subject: (hopefully) fix pitch issues on Mac Signed-off-by: Stanislaw Halik --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'FTNoIR_Tracker_PT') 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(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); -- cgit v1.2.3