|
|
@ -43,8 +43,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
#pragma once |
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
|
|
#ifndef __OPENCV_CUDEV_GRID_GLOB_REDUCE_HPP__ |
|
|
|
#ifndef __OPENCV_CUDEV_GRID_REDUCE_HPP__ |
|
|
|
#define __OPENCV_CUDEV_GRID_GLOB_REDUCE_HPP__ |
|
|
|
#define __OPENCV_CUDEV_GRID_REDUCE_HPP__ |
|
|
|
|
|
|
|
|
|
|
|
#include <limits> |
|
|
|
#include <limits> |
|
|
|
#include "../common.hpp" |
|
|
|
#include "../common.hpp" |
|
|
@ -52,7 +52,7 @@ |
|
|
|
#include "../ptr2d/gpumat.hpp" |
|
|
|
#include "../ptr2d/gpumat.hpp" |
|
|
|
#include "../ptr2d/mask.hpp" |
|
|
|
#include "../ptr2d/mask.hpp" |
|
|
|
#include "../ptr2d/transform.hpp" |
|
|
|
#include "../ptr2d/transform.hpp" |
|
|
|
#include "detail/glob_reduce.hpp" |
|
|
|
#include "detail/reduce.hpp" |
|
|
|
|
|
|
|
|
|
|
|
namespace cv { namespace cudev { |
|
|
|
namespace cv { namespace cudev { |
|
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ __host__ void gridCalcSum_(const SrcPtr& src, GpuMat_<ResType>& dst, const MaskP |
|
|
|
|
|
|
|
|
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::sum<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::sum<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
shrinkPtr(mask), |
|
|
|
shrinkPtr(mask), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -83,7 +83,7 @@ __host__ void gridCalcSum_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& str |
|
|
|
const int rows = getRows(src); |
|
|
|
const int rows = getRows(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::sum<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::sum<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
WithOutMask(), |
|
|
|
WithOutMask(), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -101,7 +101,7 @@ __host__ void gridFindMinVal_(const SrcPtr& src, GpuMat_<ResType>& dst, const Ma |
|
|
|
|
|
|
|
|
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::minVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::minVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
shrinkPtr(mask), |
|
|
|
shrinkPtr(mask), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -117,7 +117,7 @@ __host__ void gridFindMinVal_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& |
|
|
|
const int rows = getRows(src); |
|
|
|
const int rows = getRows(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::minVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::minVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
WithOutMask(), |
|
|
|
WithOutMask(), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -135,7 +135,7 @@ __host__ void gridFindMaxVal_(const SrcPtr& src, GpuMat_<ResType>& dst, const Ma |
|
|
|
|
|
|
|
|
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::maxVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::maxVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
shrinkPtr(mask), |
|
|
|
shrinkPtr(mask), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -151,7 +151,7 @@ __host__ void gridFindMaxVal_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& |
|
|
|
const int rows = getRows(src); |
|
|
|
const int rows = getRows(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::maxVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::maxVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
WithOutMask(), |
|
|
|
WithOutMask(), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -170,7 +170,7 @@ __host__ void gridFindMinMaxVal_(const SrcPtr& src, GpuMat_<ResType>& dst, const |
|
|
|
|
|
|
|
|
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::minMaxVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::minMaxVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
shrinkPtr(mask), |
|
|
|
shrinkPtr(mask), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -187,7 +187,7 @@ __host__ void gridFindMinMaxVal_(const SrcPtr& src, GpuMat_<ResType>& dst, Strea |
|
|
|
const int rows = getRows(src); |
|
|
|
const int rows = getRows(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
const int cols = getCols(src); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::minMaxVal<Policy>(shrinkPtr(src), |
|
|
|
grid_reduce_detail::minMaxVal<Policy>(shrinkPtr(src), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
WithOutMask(), |
|
|
|
WithOutMask(), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -209,7 +209,7 @@ __host__ void gridCountNonZero_(const SrcPtr& src, GpuMat_<ResType>& dst, const |
|
|
|
not_equal_to<src_type> ne_op; |
|
|
|
not_equal_to<src_type> ne_op; |
|
|
|
const src_type zero = VecTraits<src_type>::all(0); |
|
|
|
const src_type zero = VecTraits<src_type>::all(0); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::sum<Policy>(shrinkPtr(transformPtr(src, bind2nd(ne_op, zero))), |
|
|
|
grid_reduce_detail::sum<Policy>(shrinkPtr(transformPtr(src, bind2nd(ne_op, zero))), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
shrinkPtr(mask), |
|
|
|
shrinkPtr(mask), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |
|
|
@ -229,7 +229,7 @@ __host__ void gridCountNonZero_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream |
|
|
|
not_equal_to<src_type> ne_op; |
|
|
|
not_equal_to<src_type> ne_op; |
|
|
|
const src_type zero = VecTraits<src_type>::all(0); |
|
|
|
const src_type zero = VecTraits<src_type>::all(0); |
|
|
|
|
|
|
|
|
|
|
|
grid_glob_reduce_detail::sum<Policy>(shrinkPtr(transformPtr(src, bind2nd(ne_op, zero))), |
|
|
|
grid_reduce_detail::sum<Policy>(shrinkPtr(transformPtr(src, bind2nd(ne_op, zero))), |
|
|
|
dst[0], |
|
|
|
dst[0], |
|
|
|
WithOutMask(), |
|
|
|
WithOutMask(), |
|
|
|
rows, cols, |
|
|
|
rows, cols, |