|
|
|
@ -50,31 +50,43 @@ using namespace cv::gpu; |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createFilter2D_GPU(const Ptr<BaseFilter_GPU>&, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>&, const Ptr<BaseColumnFilter_GPU>&, int, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>&, const Ptr<BaseColumnFilter_GPU>&, int, int, int, GpuMat& buf) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<BaseRowFilter_GPU> cv::gpu::getRowSumFilter_GPU(int, int, int, int) { throw_nogpu(); return Ptr<BaseRowFilter_GPU>(0); } |
|
|
|
|
Ptr<BaseColumnFilter_GPU> cv::gpu::getColumnSumFilter_GPU(int, int, int, int) { throw_nogpu(); return Ptr<BaseColumnFilter_GPU>(0); } |
|
|
|
|
Ptr<BaseFilter_GPU> cv::gpu::getBoxFilter_GPU(int, int, const Size&, Point) { throw_nogpu(); return Ptr<BaseFilter_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createBoxFilter_GPU(int, int, const Size&, const Point&) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<BaseFilter_GPU> cv::gpu::getMorphologyFilter_GPU(int, int, const Mat&, const Size&, Point) { throw_nogpu(); return Ptr<BaseFilter_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createMorphologyFilter_GPU(int, int, const Mat&, const Point&, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createMorphologyFilter_GPU(int, int, const Mat&, GpuMat&, const Point&, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<BaseFilter_GPU> cv::gpu::getLinearFilter_GPU(int, int, const Mat&, const Size&, Point) { throw_nogpu(); return Ptr<BaseFilter_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createLinearFilter_GPU(int, int, const Mat&, const Point&) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<BaseRowFilter_GPU> cv::gpu::getLinearRowFilter_GPU(int, int, const Mat&, int, int) { throw_nogpu(); return Ptr<BaseRowFilter_GPU>(0); } |
|
|
|
|
Ptr<BaseColumnFilter_GPU> cv::gpu::getLinearColumnFilter_GPU(int, int, const Mat&, int, int) { throw_nogpu(); return Ptr<BaseColumnFilter_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableLinearFilter_GPU(int, int, const Mat&, const Mat&, const Point&, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableLinearFilter_GPU(int, int, const Mat&, const Mat&, GpuMat&, const Point&, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createDerivFilter_GPU(int, int, int, int, int, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createDerivFilter_GPU(int, int, int, int, int, GpuMat&, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createGaussianFilter_GPU(int, Size, double, double, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createGaussianFilter_GPU(int, Size, GpuMat&, double, double, int, int) { throw_nogpu(); return Ptr<FilterEngine_GPU>(0); } |
|
|
|
|
Ptr<BaseFilter_GPU> cv::gpu::getMaxFilter_GPU(int, int, const Size&, Point) { throw_nogpu(); return Ptr<BaseFilter_GPU>(0); } |
|
|
|
|
Ptr<BaseFilter_GPU> cv::gpu::getMinFilter_GPU(int, int, const Size&, Point) { throw_nogpu(); return Ptr<BaseFilter_GPU>(0); } |
|
|
|
|
|
|
|
|
|
void cv::gpu::boxFilter(const GpuMat&, GpuMat&, int, Size, Point, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::erode( const GpuMat&, GpuMat&, const Mat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::dilate( const GpuMat&, GpuMat&, const Mat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::morphologyEx( const GpuMat&, GpuMat&, int, const Mat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::erode(const GpuMat&, GpuMat&, const Mat&, Point, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::erode(const GpuMat&, GpuMat&, const Mat&, GpuMat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::dilate(const GpuMat&, GpuMat&, const Mat&, Point, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::dilate(const GpuMat&, GpuMat&, const Mat&, GpuMat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::morphologyEx(const GpuMat&, GpuMat&, int, const Mat&, Point, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::morphologyEx(const GpuMat&, GpuMat&, int, const Mat&, GpuMat&, GpuMat&, Point, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::filter2D(const GpuMat&, GpuMat&, int, const Mat&, Point, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat&, GpuMat&, int, const Mat&, const Mat&, Point, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Sobel(const GpuMat&, GpuMat&, int, int, int, int, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Scharr(const GpuMat&, GpuMat&, int, int, int, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat&, GpuMat&, Size, double, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat&, GpuMat&, int, const Mat&, const Mat&, Point, int, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat&, GpuMat&, int, const Mat&, const Mat&, GpuMat&, Point, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Sobel(const GpuMat&, GpuMat&, int, int, int, int, double, int, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Sobel(const GpuMat&, GpuMat&, int, int, int, GpuMat&, int, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Scharr(const GpuMat&, GpuMat&, int, int, int, double, int, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Scharr(const GpuMat&, GpuMat&, int, int, int, GpuMat&, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat&, GpuMat&, Size, double, double, int, int) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat&, GpuMat&, Size, GpuMat&, double, double, int, int, Stream&) { throw_nogpu(); } |
|
|
|
|
void cv::gpu::Laplacian(const GpuMat&, GpuMat&, int, int, double, Stream&) { throw_nogpu(); } |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
@ -130,9 +142,8 @@ namespace |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class Filter2DEngine_GPU : public FilterEngine_GPU |
|
|
|
|
struct Filter2DEngine_GPU : public FilterEngine_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
Filter2DEngine_GPU(const Ptr<BaseFilter_GPU>& filter2D_, int srcType_, int dstType_) :
|
|
|
|
|
filter2D(filter2D_), srcType(srcType_), dstType(dstType_) |
|
|
|
|
{} |
|
|
|
@ -145,10 +156,13 @@ namespace |
|
|
|
|
|
|
|
|
|
dst.create(src_size, dstType); |
|
|
|
|
|
|
|
|
|
if (stream) |
|
|
|
|
stream.enqueueMemSet(dst, Scalar::all(0.0)); |
|
|
|
|
else |
|
|
|
|
dst.setTo(Scalar::all(0.0)); |
|
|
|
|
if (roi.size() != src_size) |
|
|
|
|
{ |
|
|
|
|
if (stream) |
|
|
|
|
stream.enqueueMemSet(dst, Scalar::all(0)); |
|
|
|
|
else |
|
|
|
|
dst.setTo(Scalar::all(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
normalizeROI(roi, filter2D->ksize, filter2D->anchor, src_size); |
|
|
|
|
|
|
|
|
@ -173,16 +187,29 @@ Ptr<FilterEngine_GPU> cv::gpu::createFilter2D_GPU(const Ptr<BaseFilter_GPU>& fil |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class SeparableFilterEngine_GPU : public FilterEngine_GPU |
|
|
|
|
struct SeparableFilterEngine_GPU : public FilterEngine_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
SeparableFilterEngine_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter_,
|
|
|
|
|
const Ptr<BaseColumnFilter_GPU>& columnFilter_, int srcType_, int bufType_, int dstType_) : |
|
|
|
|
SeparableFilterEngine_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter_, const Ptr<BaseColumnFilter_GPU>& columnFilter_,
|
|
|
|
|
int srcType_, int bufType_, int dstType_) : |
|
|
|
|
rowFilter(rowFilter_), columnFilter(columnFilter_),
|
|
|
|
|
srcType(srcType_), bufType(bufType_), dstType(dstType_) |
|
|
|
|
{ |
|
|
|
|
ksize = Size(rowFilter->ksize, columnFilter->ksize); |
|
|
|
|
anchor = Point(rowFilter->anchor, columnFilter->anchor); |
|
|
|
|
|
|
|
|
|
pbuf = &buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SeparableFilterEngine_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter_, const Ptr<BaseColumnFilter_GPU>& columnFilter_,
|
|
|
|
|
int srcType_, int bufType_, int dstType_, |
|
|
|
|
GpuMat& buf_) : |
|
|
|
|
rowFilter(rowFilter_), columnFilter(columnFilter_),
|
|
|
|
|
srcType(srcType_), bufType(bufType_), dstType(dstType_) |
|
|
|
|
{ |
|
|
|
|
ksize = Size(rowFilter->ksize, columnFilter->ksize); |
|
|
|
|
anchor = Point(rowFilter->anchor, columnFilter->anchor); |
|
|
|
|
|
|
|
|
|
pbuf = &buf_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) |
|
|
|
@ -193,37 +220,36 @@ namespace |
|
|
|
|
|
|
|
|
|
dst.create(src_size, dstType); |
|
|
|
|
|
|
|
|
|
ensureSizeIsEnough(src_size, bufType, dstBuf); |
|
|
|
|
|
|
|
|
|
if (stream) |
|
|
|
|
{ |
|
|
|
|
stream.enqueueMemSet(dst, Scalar::all(0)); |
|
|
|
|
stream.enqueueMemSet(dstBuf, Scalar::all(0)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
if (roi.size() != src_size) |
|
|
|
|
{ |
|
|
|
|
dst = Scalar(0.0); |
|
|
|
|
dstBuf = Scalar(0.0); |
|
|
|
|
if (stream) |
|
|
|
|
stream.enqueueMemSet(dst, Scalar::all(0)); |
|
|
|
|
else |
|
|
|
|
dst.setTo(Scalar::all(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ensureSizeIsEnough(src_size, bufType, *pbuf); |
|
|
|
|
|
|
|
|
|
normalizeROI(roi, ksize, anchor, src_size); |
|
|
|
|
|
|
|
|
|
GpuMat srcROI = src(roi); |
|
|
|
|
GpuMat dstROI = dst(roi); |
|
|
|
|
GpuMat dstBufROI = dstBuf(roi); |
|
|
|
|
GpuMat bufROI = (*pbuf)(roi); |
|
|
|
|
|
|
|
|
|
(*rowFilter)(srcROI, dstBufROI, stream); |
|
|
|
|
(*columnFilter)(dstBufROI, dstROI, stream); |
|
|
|
|
(*rowFilter)(srcROI, bufROI, stream); |
|
|
|
|
(*columnFilter)(bufROI, dstROI, stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ptr<BaseRowFilter_GPU> rowFilter; |
|
|
|
|
Ptr<BaseColumnFilter_GPU> columnFilter; |
|
|
|
|
|
|
|
|
|
int srcType, bufType, dstType; |
|
|
|
|
|
|
|
|
|
Size ksize; |
|
|
|
|
Point anchor; |
|
|
|
|
|
|
|
|
|
GpuMat dstBuf;
|
|
|
|
|
GpuMat buf; |
|
|
|
|
GpuMat* pbuf; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -233,14 +259,19 @@ Ptr<FilterEngine_GPU> cv::gpu::createSeparableFilter_GPU(const Ptr<BaseRowFilter |
|
|
|
|
return Ptr<FilterEngine_GPU>(new SeparableFilterEngine_GPU(rowFilter, columnFilter, srcType, bufType, dstType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,
|
|
|
|
|
const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType, GpuMat& buf) |
|
|
|
|
{ |
|
|
|
|
return Ptr<FilterEngine_GPU>(new SeparableFilterEngine_GPU(rowFilter, columnFilter, srcType, bufType, dstType, buf)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// 1D Sum Filter
|
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class NppRowSumFilter : public BaseRowFilter_GPU |
|
|
|
|
struct NppRowSumFilter : public BaseRowFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NppRowSumFilter(int ksize_, int anchor_) : BaseRowFilter_GPU(ksize_, anchor_) {} |
|
|
|
|
|
|
|
|
|
virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& s = Stream::Null()) |
|
|
|
@ -273,9 +304,8 @@ Ptr<BaseRowFilter_GPU> cv::gpu::getRowSumFilter_GPU(int srcType, int sumType, in |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class NppColumnSumFilter : public BaseColumnFilter_GPU |
|
|
|
|
struct NppColumnSumFilter : public BaseColumnFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NppColumnSumFilter(int ksize_, int anchor_) : BaseColumnFilter_GPU(ksize_, anchor_) {} |
|
|
|
|
|
|
|
|
|
virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& s = Stream::Null()) |
|
|
|
@ -314,9 +344,8 @@ namespace |
|
|
|
|
typedef NppStatus (*nppFilterBox_t)(const Npp8u * pSrc, Npp32s nSrcStep, Npp8u * pDst, Npp32s nDstStep, NppiSize oSizeROI,
|
|
|
|
|
NppiSize oMaskSize, NppiPoint oAnchor); |
|
|
|
|
|
|
|
|
|
class NPPBoxFilter : public BaseFilter_GPU |
|
|
|
|
struct NPPBoxFilter : public BaseFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NPPBoxFilter(const Size& ksize_, const Point& anchor_, nppFilterBox_t func_) : BaseFilter_GPU(ksize_, anchor_), func(func_) {} |
|
|
|
|
|
|
|
|
|
virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& s = Stream::Null()) |
|
|
|
@ -382,9 +411,8 @@ namespace |
|
|
|
|
{ |
|
|
|
|
typedef NppStatus (*nppMorfFilter_t)(const Npp8u*, Npp32s, Npp8u*, Npp32s, NppiSize, const Npp8u*, NppiSize, NppiPoint); |
|
|
|
|
|
|
|
|
|
class NPPMorphFilter : public BaseFilter_GPU |
|
|
|
|
struct NPPMorphFilter : public BaseFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NPPMorphFilter(const Size& ksize_, const Point& anchor_, const GpuMat& kernel_, nppMorfFilter_t func_) :
|
|
|
|
|
BaseFilter_GPU(ksize_, anchor_), kernel(kernel_), func(func_) {} |
|
|
|
|
|
|
|
|
@ -436,27 +464,64 @@ Ptr<BaseFilter_GPU> cv::gpu::getMorphologyFilter_GPU(int op, int type, const Mat |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class MorphologyFilterEngine_GPU : public Filter2DEngine_GPU |
|
|
|
|
struct MorphologyFilterEngine_GPU : public FilterEngine_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
MorphologyFilterEngine_GPU(const Ptr<BaseFilter_GPU>& filter2D_, int type, int iters_) :
|
|
|
|
|
Filter2DEngine_GPU(filter2D_, type, type), iters(iters_) {} |
|
|
|
|
MorphologyFilterEngine_GPU(const Ptr<BaseFilter_GPU>& filter2D_, int type_, int iters_) :
|
|
|
|
|
filter2D(filter2D_), type(type_), iters(iters_) |
|
|
|
|
{ |
|
|
|
|
pbuf = &buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MorphologyFilterEngine_GPU(const Ptr<BaseFilter_GPU>& filter2D_, int type_, int iters_, GpuMat& buf_) :
|
|
|
|
|
filter2D(filter2D_), type(type_), iters(iters_) |
|
|
|
|
{ |
|
|
|
|
pbuf = &buf_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(src.type() == type); |
|
|
|
|
|
|
|
|
|
Size src_size = src.size(); |
|
|
|
|
|
|
|
|
|
dst.create(src_size, type); |
|
|
|
|
|
|
|
|
|
if (roi.size() != src_size) |
|
|
|
|
{ |
|
|
|
|
if (stream) |
|
|
|
|
stream.enqueueMemSet(dst, Scalar::all(0)); |
|
|
|
|
else |
|
|
|
|
dst.setTo(Scalar::all(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
normalizeROI(roi, filter2D->ksize, filter2D->anchor, src_size); |
|
|
|
|
|
|
|
|
|
if (iters > 1) |
|
|
|
|
morfBuf.create(src.size(), src.type()); |
|
|
|
|
pbuf->create(src_size, type); |
|
|
|
|
|
|
|
|
|
GpuMat srcROI = src(roi); |
|
|
|
|
GpuMat dstROI = dst(roi); |
|
|
|
|
|
|
|
|
|
(*filter2D)(srcROI, dstROI, stream); |
|
|
|
|
|
|
|
|
|
Filter2DEngine_GPU::apply(src, dst, roi, stream); |
|
|
|
|
for(int i = 1; i < iters; ++i) |
|
|
|
|
{ |
|
|
|
|
dst.swap(morfBuf); |
|
|
|
|
Filter2DEngine_GPU::apply(morfBuf, dst, roi, stream); |
|
|
|
|
dst.swap((*pbuf)); |
|
|
|
|
|
|
|
|
|
dstROI = dst(roi); |
|
|
|
|
GpuMat bufROI = (*pbuf)(roi); |
|
|
|
|
|
|
|
|
|
(*filter2D)(bufROI, dstROI, stream); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ptr<BaseFilter_GPU> filter2D; |
|
|
|
|
|
|
|
|
|
int type; |
|
|
|
|
int iters; |
|
|
|
|
GpuMat morfBuf; |
|
|
|
|
|
|
|
|
|
GpuMat buf; |
|
|
|
|
GpuMat* pbuf; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -471,9 +536,20 @@ Ptr<FilterEngine_GPU> cv::gpu::createMorphologyFilter_GPU(int op, int type, cons |
|
|
|
|
return Ptr<FilterEngine_GPU>(new MorphologyFilterEngine_GPU(filter2D, type, iterations)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createMorphologyFilter_GPU(int op, int type, const Mat& kernel, GpuMat& buf, const Point& anchor, int iterations) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(iterations > 0); |
|
|
|
|
|
|
|
|
|
Size ksize = kernel.size(); |
|
|
|
|
|
|
|
|
|
Ptr<BaseFilter_GPU> filter2D = getMorphologyFilter_GPU(op, type, kernel, ksize, anchor); |
|
|
|
|
|
|
|
|
|
return Ptr<FilterEngine_GPU>(new MorphologyFilterEngine_GPU(filter2D, type, iterations, buf)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
void morphOp(int op, const GpuMat& src, GpuMat& dst, const Mat& _kernel, Point anchor, int iterations, Stream& stream) |
|
|
|
|
void morphOp(int op, const GpuMat& src, GpuMat& dst, const Mat& _kernel, GpuMat& buf, Point anchor, int iterations, Stream& stream = Stream::Null()) |
|
|
|
|
{ |
|
|
|
|
Mat kernel; |
|
|
|
|
Size ksize = _kernel.data ? _kernel.size() : Size(3, 3); |
|
|
|
@ -507,54 +583,76 @@ namespace |
|
|
|
|
else |
|
|
|
|
kernel = _kernel; |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> f = createMorphologyFilter_GPU(op, src.type(), kernel, anchor, iterations); |
|
|
|
|
Ptr<FilterEngine_GPU> f = createMorphologyFilter_GPU(op, src.type(), kernel, buf, anchor, iterations); |
|
|
|
|
|
|
|
|
|
f->apply(src, dst, Rect(0,0,-1,-1), stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void morphOp(int op, const GpuMat& src, GpuMat& dst, const Mat& _kernel, Point anchor, int iterations) |
|
|
|
|
{ |
|
|
|
|
GpuMat buf; |
|
|
|
|
morphOp(op, src, dst, _kernel, buf, anchor, iterations); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations) |
|
|
|
|
{ |
|
|
|
|
morphOp(MORPH_ERODE, src, dst, kernel, anchor, iterations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations, Stream& stream) |
|
|
|
|
void cv::gpu::erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor, int iterations, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
morphOp(MORPH_ERODE, src, dst, kernel, anchor, iterations, stream); |
|
|
|
|
morphOp(MORPH_ERODE, src, dst, kernel, buf, anchor, iterations, stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations, Stream& stream) |
|
|
|
|
void cv::gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations) |
|
|
|
|
{ |
|
|
|
|
morphOp(MORPH_DILATE, src, dst, kernel, anchor, iterations, stream); |
|
|
|
|
morphOp(MORPH_DILATE, src, dst, kernel, anchor, iterations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor, int iterations, Stream& stream) |
|
|
|
|
void cv::gpu::dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor, int iterations, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
morphOp(MORPH_DILATE, src, dst, kernel, buf, anchor, iterations, stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor, int iterations) |
|
|
|
|
{ |
|
|
|
|
GpuMat buf1; |
|
|
|
|
GpuMat buf2; |
|
|
|
|
morphologyEx(src, dst, op, kernel, buf1, buf2, anchor, iterations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, GpuMat& buf1, GpuMat& buf2, Point anchor, int iterations, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
GpuMat temp; |
|
|
|
|
switch( op ) |
|
|
|
|
{ |
|
|
|
|
case MORPH_ERODE: erode( src, dst, kernel, anchor, iterations, stream); break; |
|
|
|
|
case MORPH_DILATE: dilate( src, dst, kernel, anchor, iterations, stream); break; |
|
|
|
|
case MORPH_ERODE: erode(src, dst, kernel, buf1, anchor, iterations, stream); break; |
|
|
|
|
case MORPH_DILATE: dilate(src, dst, kernel, buf1, anchor, iterations, stream); break; |
|
|
|
|
case MORPH_OPEN: |
|
|
|
|
erode( src, temp, kernel, anchor, iterations, stream); |
|
|
|
|
dilate( temp, dst, kernel, anchor, iterations, stream); |
|
|
|
|
erode(src, buf2, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
dilate(buf2, dst, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
break; |
|
|
|
|
case CV_MOP_CLOSE: |
|
|
|
|
dilate( src, temp, kernel, anchor, iterations, stream); |
|
|
|
|
erode( temp, dst, kernel, anchor, iterations, stream); |
|
|
|
|
dilate(src, buf2, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
erode(buf2, dst, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
break; |
|
|
|
|
case CV_MOP_GRADIENT: |
|
|
|
|
erode( src, temp, kernel, anchor, iterations, stream); |
|
|
|
|
dilate( src, dst, kernel, anchor, iterations, stream); |
|
|
|
|
subtract(dst, temp, dst, stream); |
|
|
|
|
erode(src, buf2, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
dilate(src, dst, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
subtract(dst, buf2, dst, stream); |
|
|
|
|
break; |
|
|
|
|
case CV_MOP_TOPHAT: |
|
|
|
|
erode( src, dst, kernel, anchor, iterations, stream); |
|
|
|
|
dilate( dst, temp, kernel, anchor, iterations, stream); |
|
|
|
|
subtract(src, temp, dst, stream); |
|
|
|
|
erode(src, dst, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
dilate(dst, buf2, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
subtract(src, buf2, dst, stream); |
|
|
|
|
break; |
|
|
|
|
case CV_MOP_BLACKHAT: |
|
|
|
|
dilate( src, dst, kernel, anchor, iterations, stream); |
|
|
|
|
erode( dst, temp, kernel, anchor, iterations, stream); |
|
|
|
|
subtract(temp, src, dst, stream); |
|
|
|
|
dilate(src, dst, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
erode(dst, buf2, kernel, buf1, anchor, iterations, stream); |
|
|
|
|
subtract(buf2, src, dst, stream); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
CV_Error( CV_StsBadArg, "unknown morphological operation" ); |
|
|
|
|
CV_Error(CV_StsBadArg, "unknown morphological operation"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -566,9 +664,8 @@ namespace |
|
|
|
|
typedef NppStatus (*nppFilter2D_t)(const Npp8u * pSrc, Npp32s nSrcStep, Npp8u * pDst, Npp32s nDstStep, NppiSize oSizeROI,
|
|
|
|
|
const Npp32s * pKernel, NppiSize oKernelSize, NppiPoint oAnchor, Npp32s nDivisor); |
|
|
|
|
|
|
|
|
|
class NPPLinearFilter : public BaseFilter_GPU |
|
|
|
|
struct NPPLinearFilter : public BaseFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NPPLinearFilter(const Size& ksize_, const Point& anchor_, const GpuMat& kernel_, Npp32s nDivisor_, nppFilter2D_t func_) :
|
|
|
|
|
BaseFilter_GPU(ksize_, anchor_), kernel(kernel_), nDivisor(nDivisor_), func(func_) {} |
|
|
|
|
|
|
|
|
@ -654,9 +751,8 @@ namespace |
|
|
|
|
|
|
|
|
|
typedef void (*gpuFilter1D_t)(const DevMem2D& src, const DevMem2D& dst, const float kernel[], int ksize, int anchor, int brd_type, cudaStream_t stream); |
|
|
|
|
|
|
|
|
|
class NppLinearRowFilter : public BaseRowFilter_GPU |
|
|
|
|
struct NppLinearRowFilter : public BaseRowFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NppLinearRowFilter(int ksize_, int anchor_, const GpuMat& kernel_, Npp32s nDivisor_, nppFilter1D_t func_) :
|
|
|
|
|
BaseRowFilter_GPU(ksize_, anchor_), kernel(kernel_), nDivisor(nDivisor_), func(func_) {} |
|
|
|
|
|
|
|
|
@ -682,9 +778,8 @@ namespace |
|
|
|
|
nppFilter1D_t func; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class GpuLinearRowFilter : public BaseRowFilter_GPU |
|
|
|
|
struct GpuLinearRowFilter : public BaseRowFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
GpuLinearRowFilter(int ksize_, int anchor_, const Mat& kernel_, gpuFilter1D_t func_, int brd_type_) :
|
|
|
|
|
BaseRowFilter_GPU(ksize_, anchor_), kernel(kernel_), func(func_), brd_type(brd_type_) {} |
|
|
|
|
|
|
|
|
@ -769,9 +864,8 @@ Ptr<BaseRowFilter_GPU> cv::gpu::getLinearRowFilter_GPU(int srcType, int bufType, |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
class NppLinearColumnFilter : public BaseColumnFilter_GPU |
|
|
|
|
struct NppLinearColumnFilter : public BaseColumnFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NppLinearColumnFilter(int ksize_, int anchor_, const GpuMat& kernel_, Npp32s nDivisor_, nppFilter1D_t func_) :
|
|
|
|
|
BaseColumnFilter_GPU(ksize_, anchor_), kernel(kernel_), nDivisor(nDivisor_), func(func_) {} |
|
|
|
|
|
|
|
|
@ -797,9 +891,8 @@ namespace |
|
|
|
|
nppFilter1D_t func; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class GpuLinearColumnFilter : public BaseColumnFilter_GPU |
|
|
|
|
struct GpuLinearColumnFilter : public BaseColumnFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
GpuLinearColumnFilter(int ksize_, int anchor_, const Mat& kernel_, gpuFilter1D_t func_, int brd_type_) :
|
|
|
|
|
BaseColumnFilter_GPU(ksize_, anchor_), kernel(kernel_), func(func_), brd_type(brd_type_) {} |
|
|
|
|
|
|
|
|
@ -898,8 +991,24 @@ Ptr<FilterEngine_GPU> cv::gpu::createSeparableLinearFilter_GPU(int srcType, int |
|
|
|
|
return createSeparableFilter_GPU(rowFilter, columnFilter, srcType, bufType, dstType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, Point anchor, int rowBorderType, int columnBorderType, |
|
|
|
|
Stream& stream) |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel, const Mat& columnKernel, GpuMat& buf,
|
|
|
|
|
const Point& anchor, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
if (columnBorderType < 0) |
|
|
|
|
columnBorderType = rowBorderType; |
|
|
|
|
|
|
|
|
|
int cn = CV_MAT_CN(srcType); |
|
|
|
|
int bdepth = CV_32F; |
|
|
|
|
int bufType = CV_MAKETYPE(bdepth, cn); |
|
|
|
|
|
|
|
|
|
Ptr<BaseRowFilter_GPU> rowFilter = getLinearRowFilter_GPU(srcType, bufType, rowKernel, anchor.x, rowBorderType); |
|
|
|
|
Ptr<BaseColumnFilter_GPU> columnFilter = getLinearColumnFilter_GPU(bufType, dstType, columnKernel, anchor.y, columnBorderType); |
|
|
|
|
|
|
|
|
|
return createSeparableFilter_GPU(rowFilter, columnFilter, srcType, bufType, dstType, buf); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,
|
|
|
|
|
Point anchor, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
if( ddepth < 0 ) |
|
|
|
|
ddepth = src.depth(); |
|
|
|
@ -907,6 +1016,19 @@ void cv::gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& |
|
|
|
|
dst.create(src.size(), CV_MAKETYPE(ddepth, src.channels())); |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> f = createSeparableLinearFilter_GPU(src.type(), dst.type(), kernelX, kernelY, anchor, rowBorderType, columnBorderType); |
|
|
|
|
f->apply(src, dst, Rect(0, 0, src.cols, src.rows)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, GpuMat& buf,
|
|
|
|
|
Point anchor, int rowBorderType, int columnBorderType, |
|
|
|
|
Stream& stream) |
|
|
|
|
{ |
|
|
|
|
if( ddepth < 0 ) |
|
|
|
|
ddepth = src.depth(); |
|
|
|
|
|
|
|
|
|
dst.create(src.size(), CV_MAKETYPE(ddepth, src.channels())); |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> f = createSeparableLinearFilter_GPU(src.type(), dst.type(), kernelX, kernelY, buf, anchor, rowBorderType, columnBorderType); |
|
|
|
|
f->apply(src, dst, Rect(0, 0, src.cols, src.rows), stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -920,7 +1042,20 @@ Ptr<FilterEngine_GPU> cv::gpu::createDerivFilter_GPU(int srcType, int dstType, i |
|
|
|
|
return createSeparableLinearFilter_GPU(srcType, dstType, kx, ky, Point(-1,-1), rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize, double scale, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, GpuMat& buf, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
Mat kx, ky; |
|
|
|
|
getDerivKernels(kx, ky, dx, dy, ksize, false, CV_32F); |
|
|
|
|
return createSeparableLinearFilter_GPU(srcType, dstType, kx, ky, buf, Point(-1,-1), rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize, double scale, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
GpuMat buf; |
|
|
|
|
Sobel(src, dst, ddepth, dx, dy, buf, ksize, scale, rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, int ksize, double scale, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
Mat kx, ky; |
|
|
|
|
getDerivKernels(kx, ky, dx, dy, ksize, false, CV_32F); |
|
|
|
@ -935,10 +1070,16 @@ void cv::gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, |
|
|
|
|
ky *= scale; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sepFilter2D(src, dst, ddepth, kx, ky, Point(-1,-1), rowBorderType, columnBorderType, stream); |
|
|
|
|
sepFilter2D(src, dst, ddepth, kx, ky, buf, Point(-1,-1), rowBorderType, columnBorderType, stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
GpuMat buf; |
|
|
|
|
Scharr(src, dst, ddepth, dx, dy, buf, scale, rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
void cv::gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, double scale, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
Mat kx, ky; |
|
|
|
|
getDerivKernels(kx, ky, dx, dy, -1, false, CV_32F); |
|
|
|
@ -953,7 +1094,7 @@ void cv::gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, |
|
|
|
|
ky *= scale; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sepFilter2D(src, dst, ddepth, kx, ky, Point(-1,-1), rowBorderType, columnBorderType, stream); |
|
|
|
|
sepFilter2D(src, dst, ddepth, kx, ky, buf, Point(-1,-1), rowBorderType, columnBorderType, stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize, double scale, Stream& stream) |
|
|
|
@ -1003,7 +1144,35 @@ Ptr<FilterEngine_GPU> cv::gpu::createGaussianFilter_GPU(int type, Size ksize, do |
|
|
|
|
return createSeparableLinearFilter_GPU(type, type, kx, ky, Point(-1,-1), rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
Ptr<FilterEngine_GPU> cv::gpu::createGaussianFilter_GPU(int type, Size ksize, GpuMat& buf, double sigma1, double sigma2, int rowBorderType, int columnBorderType) |
|
|
|
|
{
|
|
|
|
|
int depth = CV_MAT_DEPTH(type); |
|
|
|
|
|
|
|
|
|
if (sigma2 <= 0) |
|
|
|
|
sigma2 = sigma1; |
|
|
|
|
|
|
|
|
|
// automatic detection of kernel size from sigma
|
|
|
|
|
if (ksize.width <= 0 && sigma1 > 0) |
|
|
|
|
ksize.width = cvRound(sigma1 * (depth == CV_8U ? 3 : 4)*2 + 1) | 1; |
|
|
|
|
if (ksize.height <= 0 && sigma2 > 0) |
|
|
|
|
ksize.height = cvRound(sigma2 * (depth == CV_8U ? 3 : 4)*2 + 1) | 1; |
|
|
|
|
|
|
|
|
|
CV_Assert( ksize.width > 0 && ksize.width % 2 == 1 && ksize.height > 0 && ksize.height % 2 == 1 ); |
|
|
|
|
|
|
|
|
|
sigma1 = std::max(sigma1, 0.0); |
|
|
|
|
sigma2 = std::max(sigma2, 0.0); |
|
|
|
|
|
|
|
|
|
Mat kx = getGaussianKernel( ksize.width, sigma1, std::max(depth, CV_32F) ); |
|
|
|
|
Mat ky; |
|
|
|
|
if( ksize.height == ksize.width && std::abs(sigma1 - sigma2) < DBL_EPSILON ) |
|
|
|
|
ky = kx; |
|
|
|
|
else |
|
|
|
|
ky = getGaussianKernel( ksize.height, sigma2, std::max(depth, CV_32F) ); |
|
|
|
|
|
|
|
|
|
return createSeparableLinearFilter_GPU(type, type, kx, ky, buf, Point(-1,-1), rowBorderType, columnBorderType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2, int rowBorderType, int columnBorderType) |
|
|
|
|
{ |
|
|
|
|
if (ksize.width == 1 && ksize.height == 1) |
|
|
|
|
{ |
|
|
|
@ -1014,6 +1183,20 @@ void cv::gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double si |
|
|
|
|
dst.create(src.size(), src.type()); |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> f = createGaussianFilter_GPU(src.type(), ksize, sigma1, sigma2, rowBorderType, columnBorderType); |
|
|
|
|
f->apply(src, dst, Rect(0, 0, src.cols, src.rows)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cv::gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, GpuMat& buf, double sigma1, double sigma2, int rowBorderType, int columnBorderType, Stream& stream) |
|
|
|
|
{ |
|
|
|
|
if (ksize.width == 1 && ksize.height == 1) |
|
|
|
|
{ |
|
|
|
|
src.copyTo(dst); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dst.create(src.size(), src.type()); |
|
|
|
|
|
|
|
|
|
Ptr<FilterEngine_GPU> f = createGaussianFilter_GPU(src.type(), ksize, buf, sigma1, sigma2, rowBorderType, columnBorderType); |
|
|
|
|
f->apply(src, dst, Rect(0, 0, src.cols, src.rows), stream); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1025,9 +1208,8 @@ namespace |
|
|
|
|
typedef NppStatus (*nppFilterRank_t)(const Npp8u * pSrc, Npp32s nSrcStep, Npp8u * pDst, Npp32s nDstStep, NppiSize oSizeROI,
|
|
|
|
|
NppiSize oMaskSize, NppiPoint oAnchor); |
|
|
|
|
|
|
|
|
|
class NPPRankFilter : public BaseFilter_GPU |
|
|
|
|
struct NPPRankFilter : public BaseFilter_GPU |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
NPPRankFilter(const Size& ksize_, const Point& anchor_, nppFilterRank_t func_) : BaseFilter_GPU(ksize_, anchor_), func(func_) {} |
|
|
|
|
|
|
|
|
|
virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& s = Stream::Null()) |
|
|
|
|