Skip to content

Commit 010900d

Browse files
committed
Update to cvnp d2b808a0b6faeb025647973cb966e728e816d6d2
- Fixes #99
1 parent 08ffed9 commit 010900d

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

subprojects/robotpy-cscore/cscore/cvnp/cvnp.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,7 @@ namespace cvnp
181181

182182
bool is_array_contiguous(const pybind11::array& a)
183183
{
184-
pybind11::ssize_t expected_stride = a.itemsize();
185-
for (int i = a.ndim() - 1; i >=0; --i)
186-
{
187-
pybind11::ssize_t current_stride = a.strides()[i];
188-
if (current_stride != expected_stride)
189-
return false;
190-
expected_stride = expected_stride * a.shape()[i];
191-
}
192-
return true;
184+
return a.flags() & pybind11::array::c_style;
193185
}
194186

195187

subprojects/robotpy-cscore/cscore/cvnp/cvnp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ namespace cvnp
4949
return pybind11::array(
5050
pybind11::dtype::of<_Tp>()
5151
, std::vector<std::size_t> {_rows, _cols}
52+
, std::vector<std::size_t>{_cols * sizeof(_Tp), sizeof(_Tp)} // Strides
5253
, m.val
5354
);
5455
}

0 commit comments

Comments
 (0)