1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2021-02-06 00:43:06 +00:00
23 changed files with 202 additions and 82 deletions
@@ -205,21 +205,33 @@ static inline std::ostream& operator<<(std::ostream &out, const MatShape& shape)
return out;
}
inline int clamp(int ax, int dims)
/// @brief Converts axis from `[-dims; dims)` (similar to Python's slice notation) to `[0; dims)` range.
static inline
int normalize_axis(int axis, int dims)
{
return ax < 0 ? ax + dims : ax;
CV_Check(axis, axis >= -dims && axis < dims, "");
axis = (axis < 0) ? (dims + axis) : axis;
CV_DbgCheck(axis, axis >= 0 && axis < dims, "");
return axis;
}
inline int clamp(int ax, const MatShape& shape)
static inline
int normalize_axis(int axis, const MatShape& shape)
{
return clamp(ax, (int)shape.size());
return normalize_axis(axis, (int)shape.size());
}
inline Range clamp(const Range& r, int axisSize)
static inline
Range normalize_axis_range(const Range& r, int axisSize)
{
Range clamped(std::max(r.start, 0),
if (r == Range::all())
return Range(0, axisSize);
CV_CheckGE(r.start, 0, "");
Range clamped(r.start,
r.end > 0 ? std::min(r.end, axisSize) : axisSize + r.end + 1);
CV_Assert_N(clamped.start < clamped.end, clamped.end <= axisSize);
CV_DbgCheckGE(clamped.start, 0, "");
CV_CheckLT(clamped.start, clamped.end, "");
CV_CheckLE(clamped.end, axisSize, "");
return clamped;
}
+1 -1
View File
@@ -6,7 +6,7 @@
#define OPENCV_DNN_VERSION_HPP
/// Use with major OpenCV version only.
#define OPENCV_DNN_API_VERSION 20201117
#define OPENCV_DNN_API_VERSION 20210205
#if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_INLINE_NS
#define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION)