__host__ void gridPyrUp(const SrcPtr& src, GpuMat_<DstType>& dst, Stream& stream = Stream::Null()) { const int rows = getRows(src); const int cols = getCols(src); dst.create(rows * 2, cols * 2); pyramids_detail::pyrUp(shrinkPtr(src), shrinkPtr(dst), rows, cols, dst.rows, dst.cols, StreamAccessor::getStream(stream)); }
__host__ void gridTransform_(const SrcPtr& src, GpuMat_<DstType>& dst, const UnOp& op, Stream& stream = Stream::Null()) { const int rows = getRows(src); const int cols = getCols(src); dst.create(rows, cols); grid_transform_detail::transform<Policy>(shrinkPtr(src), shrinkPtr(dst), op, WithOutMask(), rows, cols, StreamAccessor::getStream(stream)); }
__host__ void gridTransform_(const SrcPtr1& src1, const SrcPtr2& src2, GpuMat_<DstType>& dst, const BinOp& op, const MaskPtr& mask, Stream& stream = Stream::Null()) { const int rows = getRows(src1); const int cols = getCols(src1); CV_Assert( getRows(src2) == rows && getCols(src2) == cols ); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); dst.create(rows, cols); grid_transform_detail::transform<Policy>(shrinkPtr(src1), shrinkPtr(src2), shrinkPtr(dst), op, shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ RemapPtr1Sz<typename PtrTraits<SrcPtr>::ptr_type, typename PtrTraits<MapPtr>::ptr_type> remapPtr(const SrcPtr& src, const MapPtr& map) { const int rows = getRows(map); const int cols = getCols(map); RemapPtr1Sz<typename PtrTraits<SrcPtr>::ptr_type, typename PtrTraits<MapPtr>::ptr_type> r; r.src = shrinkPtr(src); r.map = shrinkPtr(map); r.rows = rows; r.cols = cols; return r; }
__host__ ZipPtrSz< tuple<typename PtrTraits<Ptr0>::ptr_type, typename PtrTraits<Ptr1>::ptr_type> > zipPtr(const Ptr0& ptr0, const Ptr1& ptr1) { const int rows = getRows(ptr0); const int cols = getCols(ptr0); CV_Assert( getRows(ptr1) == rows && getCols(ptr1) == cols ); ZipPtrSz< tuple<typename PtrTraits<Ptr0>::ptr_type, typename PtrTraits<Ptr1>::ptr_type> > z(make_tuple(shrinkPtr(ptr0), shrinkPtr(ptr1))); z.rows = rows; z.cols = cols; return z; }
__host__ RemapPtr2Sz<typename PtrTraits<SrcPtr>::ptr_type, typename PtrTraits<MapXPtr>::ptr_type, typename PtrTraits<MapYPtr>::ptr_type> remapPtr(const SrcPtr& src, const MapXPtr& mapx, const MapYPtr& mapy) { const int rows = getRows(mapx); const int cols = getCols(mapx); CV_Assert( getRows(mapy) == rows && getCols(mapy) == cols ); RemapPtr2Sz<typename PtrTraits<SrcPtr>::ptr_type, typename PtrTraits<MapXPtr>::ptr_type, typename PtrTraits<MapYPtr>::ptr_type> r; r.src = shrinkPtr(src); r.mapx = shrinkPtr(mapx); r.mapy = shrinkPtr(mapy); r.rows = rows; r.cols = cols; return r; }
__host__ void gridFindMaxVal_(const SrcPtr& src, GpuMat_<ResType>& dst, const MaskPtr& mask, Stream& stream = Stream::Null()) { dst.create(1, 1); dst.setTo(Scalar::all(-std::numeric_limits<ResType>::max()), stream); const int rows = getRows(src); const int cols = getCols(src); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); grid_reduce_detail::maxVal<Policy>(shrinkPtr(src), dst[0], shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ BinaryTransformPtrSz<typename PtrTraits<Src1Ptr>::ptr_type, typename PtrTraits<Src2Ptr>::ptr_type, Op> transformPtr(const Src1Ptr& src1, const Src2Ptr& src2, const Op& op) { const int rows = getRows(src1); const int cols = getCols(src1); CV_Assert( getRows(src2) == rows && getCols(src2) == cols ); BinaryTransformPtrSz<typename PtrTraits<Src1Ptr>::ptr_type, typename PtrTraits<Src2Ptr>::ptr_type, Op> ptr; ptr.src1 = shrinkPtr(src1); ptr.src2 = shrinkPtr(src2); ptr.op = op; ptr.rows = rows; ptr.cols = cols; return ptr; }
__host__ void gridTransform_(const SrcPtr& src, const tuple< GpuMat_<D0>&, GpuMat_<D1>& >& dst, const OpTuple& op, Stream& stream = Stream::Null()) { CV_StaticAssert( tuple_size<OpTuple>::value == 2, "" ); const int rows = getRows(src); const int cols = getCols(src); get<0>(dst).create(rows, cols); get<1>(dst).create(rows, cols); grid_transform_detail::transform_tuple<Policy>(shrinkPtr(src), shrinkPtr(zipPtr(get<0>(dst), get<1>(dst))), op, WithOutMask(), rows, cols, StreamAccessor::getStream(stream)); }
__host__ BrdBase<BrdWrap, typename PtrTraits<SrcPtr>::ptr_type> brdWrap(const SrcPtr& src) { BrdBase<BrdWrap, typename PtrTraits<SrcPtr>::ptr_type> b; b.src = shrinkPtr(src); b.rows = getRows(src); b.cols = getCols(src); return b; }
__host__ DerivXPtrSz<typename PtrTraits<SrcPtr>::ptr_type> derivXPtr(const SrcPtr& src) { DerivXPtrSz<typename PtrTraits<SrcPtr>::ptr_type> s; s.src = shrinkPtr(src); s.rows = getRows(src); s.cols = getCols(src); return s; }
__host__ LaplacianPtrSz<ksize, typename PtrTraits<SrcPtr>::ptr_type> laplacianPtr(const SrcPtr& src) { LaplacianPtrSz<ksize, typename PtrTraits<SrcPtr>::ptr_type> ptr; ptr.src = shrinkPtr(src); ptr.rows = getRows(src); ptr.cols = getCols(src); return ptr; }
__host__ void gridHistogram_(const SrcPtr& src, GpuMat_<ResType>& dst, const MaskPtr& mask, Stream& stream = Stream::Null()) { CV_Assert( deviceSupports(SHARED_ATOMICS) ); const int rows = getRows(src); const int cols = getCols(src); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); dst.create(1, BIN_COUNT); dst.setTo(0, stream); grid_histogram_detail::histogram<BIN_COUNT, Policy>(shrinkPtr(src), dst[0], shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ BrdConstant<typename PtrTraits<SrcPtr>::ptr_type> brdConstant(const SrcPtr& src, typename PtrTraits<SrcPtr>::value_type val) { BrdConstant<typename PtrTraits<SrcPtr>::ptr_type> b; b.src = shrinkPtr(src); b.rows = getRows(src); b.cols = getCols(src); b.val = val; return b; }
__host__ void gridMinMaxLoc_(const SrcPtr& src, GpuMat_<ResType>& valBuf, GpuMat_<int>& locBuf, const MaskPtr& mask, Stream& stream = Stream::Null()) { const int rows = getRows(src); const int cols = getCols(src); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); dim3 grid, block; grid_minmaxloc_detail::getLaunchCfg<Policy>(rows, cols, block, grid); valBuf.create(2, grid.x * grid.y); locBuf.create(2, grid.x * grid.y); grid_minmaxloc_detail::minMaxLoc<Policy>(shrinkPtr(src), valBuf[0], valBuf[1], locBuf[0], locBuf[1], shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ UnaryTransformPtrSz<typename PtrTraits<SrcPtr>::ptr_type, Op> transformPtr(const SrcPtr& src, const Op& op) { UnaryTransformPtrSz<typename PtrTraits<SrcPtr>::ptr_type, Op> ptr; ptr.src = shrinkPtr(src); ptr.op = op; ptr.rows = getRows(src); ptr.cols = getCols(src); return ptr; }
__host__ SingleMaskChannelsSz<typename PtrTraits<MaskPtr>::ptr_type> singleMaskChannels(const MaskPtr& mask, int channels) { SingleMaskChannelsSz<typename PtrTraits<MaskPtr>::ptr_type> ptr; ptr.mask = shrinkPtr(mask); ptr.channels = channels; ptr.rows = getRows(mask); ptr.cols = getCols(mask) * channels; return ptr; }
__host__ ResizePtrSz<typename PtrTraits<SrcPtr>::ptr_type> resizePtr(const SrcPtr& src, float fx, float fy) { ResizePtrSz<typename PtrTraits<SrcPtr>::ptr_type> r; r.src = shrinkPtr(src); r.fx = 1.0f / fx; r.fy = 1.0f / fy; r.rows = cv::saturate_cast<int>(getRows(src) * fy); r.cols = cv::saturate_cast<int>(getCols(src) * fx); return r; }
__host__ void gridCalcSum_(const SrcPtr& src, GpuMat_<ResType>& dst, const MaskPtr& mask, Stream& stream = Stream::Null()) { typedef typename PtrTraits<SrcPtr>::value_type src_type; CV_StaticAssert( unsigned(VecTraits<src_type>::cn) == unsigned(VecTraits<ResType>::cn), "" ); dst.create(1, 1); dst.setTo(0, stream); const int rows = getRows(src); const int cols = getCols(src); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); grid_reduce_detail::sum<Policy>(shrinkPtr(src), dst[0], shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ void gridCountNonZero_(const SrcPtr& src, GpuMat_<ResType>& dst, const MaskPtr& mask, Stream& stream = Stream::Null()) { dst.create(1, 1); dst.setTo(0, stream); const int rows = getRows(src); const int cols = getCols(src); CV_Assert( getRows(mask) == rows && getCols(mask) == cols ); typedef typename PtrTraits<SrcPtr>::value_type src_type; not_equal_to<src_type> ne_op; const src_type zero = VecTraits<src_type>::all(0); grid_reduce_detail::sum<Policy>(shrinkPtr(transformPtr(src, bind2nd(ne_op, zero))), dst[0], shrinkPtr(mask), rows, cols, StreamAccessor::getStream(stream)); }
__host__ void gridFindMinVal_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& stream = Stream::Null()) { dst.create(1, 1); dst.setTo(Scalar::all(std::numeric_limits<ResType>::max()), stream); const int rows = getRows(src); const int cols = getCols(src); grid_reduce_detail::minVal<Policy>(shrinkPtr(src), dst[0], WithOutMask(), rows, cols, StreamAccessor::getStream(stream)); }