1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Fix bugs found by valgrind

This commit is contained in:
Dmitry Kurtaev
2018-04-17 17:53:51 +03:00
parent e0fef2bca1
commit 66ce8cd7ea
3 changed files with 10 additions and 5 deletions
@@ -120,7 +120,7 @@ static inline Mat getPlane(const Mat &m, int n, int cn)
return Mat(m.dims - 2, sz, m.type(), (void*)m.ptr<float>(n, cn));
}
static inline MatShape shape(const int* dims, const int n = 4)
static inline MatShape shape(const int* dims, const int n)
{
MatShape shape;
shape.assign(dims, dims + n);
@@ -132,6 +132,11 @@ static inline MatShape shape(const Mat& mat)
return shape(mat.size.p, mat.dims);
}
static inline MatShape shape(const MatSize& sz)
{
return shape(sz.p, sz[-1]);
}
static inline MatShape shape(const UMat& mat)
{
return shape(mat.size.p, mat.dims);
@@ -142,7 +147,7 @@ namespace {inline bool is_neg(int i) { return i < 0; }}
static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1)
{
int dims[] = {a0, a1, a2, a3};
MatShape s = shape(dims);
MatShape s = shape(dims, 4);
s.erase(std::remove_if(s.begin(), s.end(), is_neg), s.end());
return s;
}