summaryrefslogtreecommitdiffhomepage
path: root/video-opencv/impl-camera.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-20 10:22:47 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-20 10:22:47 +0100
commit51005ab9e764a8197faa36781fd5dfd861e9c214 (patch)
tree0e0d3481c81b6146c436556109ad5c6694c391ec /video-opencv/impl-camera.cpp
parentf0eecc4ee2d7a340bf96571cf626bde27c91542c (diff)
video/opencv: set stride to zero when able
Diffstat (limited to 'video-opencv/impl-camera.cpp')
-rw-r--r--video-opencv/impl-camera.cpp3
1 files changed, 3 insertions, 0 deletions
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;