Example #1
0
__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));
}
Example #2
0
__host__ void gridFindMaxVal_(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::maxVal<Policy>(shrinkPtr(src),
                                       dst[0],
                                       WithOutMask(),
                                       rows, cols,
                                       StreamAccessor::getStream(stream));
}
Example #3
0
__host__ void gridHistogram_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& stream = Stream::Null())
{
    CV_Assert( deviceSupports(SHARED_ATOMICS) );

    const int rows = getRows(src);
    const int cols = getCols(src);

    dst.create(1, BIN_COUNT);
    dst.setTo(0, stream);

    grid_histogram_detail::histogram<BIN_COUNT, Policy>(shrinkPtr(src),
                                                        dst[0],
                                                        WithOutMask(),
                                                        rows, cols,
                                                        StreamAccessor::getStream(stream));
}
Example #4
0
__host__ void gridMinMaxLoc_(const SrcPtr& src, GpuMat_<ResType>& valBuf, GpuMat_<int>& locBuf, Stream& stream = Stream::Null())
{
    const int rows = getRows(src);
    const int cols = getCols(src);

    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],
                                             WithOutMask(),
                                             rows, cols,
                                             StreamAccessor::getStream(stream));
}
Example #5
0
__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));
}
Example #6
0
__host__ void gridCalcSum_(const SrcPtr& src, GpuMat_<ResType>& dst, 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);

    grid_reduce_detail::sum<Policy>(shrinkPtr(src),
                                    dst[0],
                                    WithOutMask(),
                                    rows, cols,
                                    StreamAccessor::getStream(stream));
}
Example #7
0
__host__ void gridCountNonZero_(const SrcPtr& src, GpuMat_<ResType>& dst, Stream& stream = Stream::Null())
{
    dst.create(1, 1);
    dst.setTo(0, stream);

    const int rows = getRows(src);
    const int cols = getCols(src);

    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],
                                    WithOutMask(),
                                    rows, cols,
                                    StreamAccessor::getStream(stream));
}
Example #8
0
 static inline void transform(DevMem2D_<T1> src1, DevMem2D_<T2> src2, DevMem2D_<D> dst, BinOp op, cudaStream_t stream = 0)
 {
     transform_detail::transform_caller(src1, src2, dst, op, WithOutMask(), stream);
 }