TEST_CYCLE() cv::cuda::reduce(d_src, dst, dim, reduceOp, CV_32F);
+ dst = dst.reshape(dst.channels(), 1);
+
CUDA_SANITY_CHECK(dst);
}
else
if (dtype < 0)
dtype = src.depth();
- GpuMat dst = getOutputMat(_dst, 1, dim == 0 ? src.cols : src.rows, CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()), stream);
+ GpuMat dst = getOutputMat(_dst, dim == 0 ? 1 : src.rows, dim == 0 ? src.cols : 1, CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()), stream);
if (dim == 0)
{
{
cv::Mat src = randomMat(size, type);
- cv::cuda::GpuMat dst = createMat(cv::Size(src.rows, 1), dst_type, useRoi);
+ cv::cuda::GpuMat dst;
cv::cuda::reduce(loadMat(src, useRoi), dst, 1, reduceOp, dst_depth);
cv::Mat dst_gold;
cv::reduce(src, dst_gold, 1, reduceOp, dst_depth);
- dst_gold.cols = dst_gold.rows;
- dst_gold.rows = 1;
- dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, dst_depth < CV_32F ? 0.0 : 0.02);
}
CV_Assert( getRows(mask) == rows && getCols(mask) == cols );
- dst.create(1, rows);
+ cuda::createContinuous(rows, 1, dst.type(), dst);
grid_reduce_to_vec_detail::reduceToColumn<Reductor, Policy>(shrinkPtr(src),
dst[0],
const int rows = getRows(src);
const int cols = getCols(src);
- dst.create(1, rows);
+ cuda::createContinuous(rows, 1, dst.type(), dst);
grid_reduce_to_vec_detail::reduceToColumn<Reductor, Policy>(shrinkPtr(src),
dst[0],
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_SUM, CV_32S);
- dst_gold.cols = dst_gold.rows;
- dst_gold.rows = 1;
- dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_AVG, CV_32F);
- dst_gold.cols = dst_gold.rows;
- dst_gold.rows = 1;
- dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 1e-4);
}
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_MIN);
- dst_gold.cols = dst_gold.rows;
- dst_gold.rows = 1;
- dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}
Mat dst_gold;
cv::reduce(src, dst_gold, 1, REDUCE_MAX);
- dst_gold.cols = dst_gold.rows;
- dst_gold.rows = 1;
- dst_gold.step = dst_gold.cols * dst_gold.elemSize();
EXPECT_MAT_NEAR(dst_gold, dst, 0.0);
}