void cv::gpu::Scharr(const GpuMat&, GpuMat&, int, int, int, GpuMat&, double, int, int, Stream&) { throw_nogpu(); }\r
void cv::gpu::GaussianBlur(const GpuMat&, GpuMat&, Size, double, double, int, int) { throw_nogpu(); }\r
void cv::gpu::GaussianBlur(const GpuMat&, GpuMat&, Size, GpuMat&, double, double, int, int, Stream&) { throw_nogpu(); }\r
-void cv::gpu::Laplacian(const GpuMat&, GpuMat&, int, int, double, Stream&) { throw_nogpu(); }\r
+void cv::gpu::Laplacian(const GpuMat&, GpuMat&, int, int, double, int, Stream&) { throw_nogpu(); }\r
\r
#else\r
\r
namespace imgproc\r
{\r
template <typename T, typename D>\r
- void filter2D_gpu(DevMem2Db srcWhole, int ofsX, int ofsY, DevMem2Db dst, \r
- int kWidth, int kHeight, int anchorX, int anchorY, const float* kernel, \r
+ void filter2D_gpu(DevMem2Db srcWhole, int ofsX, int ofsY, DevMem2Db dst,\r
+ int kWidth, int kHeight, int anchorX, int anchorY, const float* kernel,\r
int borderMode, const float* borderValue, cudaStream_t stream);\r
}\r
}}}\r
nppFilter2D_t func;\r
};\r
\r
- typedef void (*gpuFilter2D_t)(DevMem2Db srcWhole, int ofsX, int ofsY, DevMem2Db dst, \r
- int kWidth, int kHeight, int anchorX, int anchorY, const float* kernel, \r
+ typedef void (*gpuFilter2D_t)(DevMem2Db srcWhole, int ofsX, int ofsY, DevMem2Db dst,\r
+ int kWidth, int kHeight, int anchorX, int anchorY, const float* kernel,\r
int borderMode, const float* borderValue, cudaStream_t stream);\r
\r
struct GpuFilter2D : public BaseFilter_GPU\r
{\r
GpuFilter2D(Size ksize_, Point anchor_, gpuFilter2D_t func_, const GpuMat& kernel_, int brd_type_) :\r
- BaseFilter_GPU(ksize_, anchor_), func(func_), kernel(kernel_), brd_type(brd_type_) \r
+ BaseFilter_GPU(ksize_, anchor_), func(func_), kernel(kernel_), brd_type(brd_type_)\r
{\r
}\r
\r
sepFilter2D(src, dst, ddepth, kx, ky, buf, Point(-1,-1), rowBorderType, columnBorderType, stream);\r
}\r
\r
-void cv::gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize, double scale, Stream& stream)\r
+void cv::gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize, double scale, int borderType, Stream& stream)\r
{\r
CV_Assert(ksize == 1 || ksize == 3);\r
\r
if (scale != 1)\r
kernel *= scale;\r
\r
- filter2D(src, dst, ddepth, kernel, Point(-1,-1), stream);\r
+ filter2D(src, dst, ddepth, kernel, Point(-1,-1), borderType, stream);\r
}\r
\r
////////////////////////////////////////////////////////////////////////////////////////////////////\r
\r
SURF surf;\r
vector<KeyPoint> keypoints;\r
- vector<float> descriptors;\r
+ Mat descriptors;\r
\r
surf(src, Mat(), keypoints, descriptors);\r
\r
}\r
}\r
\r
-\r
TEST(GaussianBlur)\r
{\r
for (int size = 1000; size <= 4000; size += 1000)\r
}\r
}\r
\r
+TEST(filter2D)\r
+{\r
+ for (int size = 512; size <= 2048; size *= 2)\r
+ {\r
+ Mat src;\r
+ gen(src, size, size, CV_8UC4, 0, 256);\r
+ \r
+ for (int ksize = 3; ksize <= 16; ksize += 2)\r
+ { \r
+ SUBTEST << "ksize = " << ksize << ", " << size << 'x' << size << ", 8UC4";\r
+ \r
+ Mat kernel;\r
+ gen(kernel, ksize, ksize, CV_32FC1, 0.0, 1.0);\r
+\r
+ Mat dst;\r
+ cv::filter2D(src, dst, -1, kernel);\r
+\r
+ CPU_ON;\r
+ cv::filter2D(src, dst, -1, kernel);\r
+ CPU_OFF;\r
+\r
+ gpu::GpuMat d_src(src);\r
+ gpu::GpuMat d_dst;\r
+\r
+ gpu::filter2D(d_src, d_dst, -1, kernel);\r
+\r
+ GPU_ON;\r
+ gpu::filter2D(d_src, d_dst, -1, kernel);\r
+ GPU_OFF;\r
+ }\r
+ }\r
+}\r
+\r
TEST(pyrDown)\r
{\r
for (int size = 4000; size >= 1000; size -= 1000)\r