mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #11406 from alalek:core_matsize_dims
This commit is contained in:
@@ -161,14 +161,14 @@ public:
|
||||
|
||||
for (int i = 0; i < outputs.size(); ++i)
|
||||
{
|
||||
CV_Assert(sliceRanges[i].size() <= inpShape[-1]);
|
||||
CV_Assert(sliceRanges[i].size() <= inpShape.dims());
|
||||
// Clamp.
|
||||
for (int j = 0; j < sliceRanges[i].size(); ++j)
|
||||
{
|
||||
sliceRanges[i][j] = clamp(sliceRanges[i][j], inpShape[j]);
|
||||
}
|
||||
// Fill the rest of ranges.
|
||||
for (int j = sliceRanges[i].size(); j < inpShape[-1]; ++j)
|
||||
for (int j = sliceRanges[i].size(); j < inpShape.dims(); ++j)
|
||||
{
|
||||
sliceRanges[i].push_back(Range::all());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <opencv2/dnn/shape_utils.hpp>
|
||||
#include "op_halide.hpp"
|
||||
|
||||
#ifdef HAVE_HALIDE
|
||||
@@ -36,7 +37,7 @@ static MatShape getBufferShape(const MatShape& shape)
|
||||
|
||||
static MatShape getBufferShape(const MatSize& size)
|
||||
{
|
||||
return getBufferShape(MatShape(size.p, size.p + size[-1]));
|
||||
return getBufferShape(shape(size));
|
||||
}
|
||||
|
||||
Halide::Buffer<float> wrapToHalideBuffer(const Mat& mat)
|
||||
@@ -160,7 +161,7 @@ void HalideBackendWrapper::setHostDirty()
|
||||
|
||||
void getCanonicalSize(const MatSize& size, int* w, int* h, int* c, int* n)
|
||||
{
|
||||
getCanonicalSize(MatShape(size.p, size.p + size[-1]), w, h, c, n);
|
||||
getCanonicalSize(shape(size), w, h, c, n);
|
||||
}
|
||||
|
||||
void getCanonicalSize(const MatShape& shape, int* width, int* height,
|
||||
|
||||
Reference in New Issue
Block a user