From 51005ab9e764a8197faa36781fd5dfd861e9c214 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 20 Mar 2019 10:22:47 +0100 Subject: video/opencv: set stride to zero when able --- video-opencv/impl-camera.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'video-opencv/impl-camera.cpp') diff --git a/video-opencv/impl-camera.cpp b/video-opencv/impl-camera.cpp index 0c42e30a..dddd463f 100644 --- a/video-opencv/impl-camera.cpp +++ b/video-opencv/impl-camera.cpp @@ -69,6 +69,9 @@ bool cam::get_frame_() frame_.width = mat.cols; frame_.height = mat.rows; frame_.stride = mat.step.p[0]; + if (mat.step.p[0] == (unsigned)frame_.width * mat.elemSize()) + frame_.stride = cv::Mat::AUTO_STEP; + frame_.channels = mat.channels(); return true; -- cgit v1.2.3