fixeg gpu::Laplacian
authorVladislav Vinogradov <no@email>
Mon, 2 Apr 2012 08:20:23 +0000 (08:20 +0000)
committerVladislav Vinogradov <no@email>
Mon, 2 Apr 2012 08:20:23 +0000 (08:20 +0000)
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/src/filtering.cpp
modules/gpu/test/test_filters.cpp

index 949acba..db5aa43 100644 (file)
@@ -395,7 +395,7 @@ CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, GpuMat&
 \r
 //! applies Laplacian operator to the image\r
 //! supports only ksize = 1 and ksize = 3\r
-CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, Stream& stream = Stream::Null());\r
+CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, int borderType = BORDER_DEFAULT, Stream& stream = Stream::Null());\r
 \r
 \r
 ////////////////////////////// Arithmetics ///////////////////////////////////\r
@@ -1094,8 +1094,8 @@ public:
 \r
     bool use_local_init_data_cost;\r
 private:\r
-       GpuMat messages_buffers;\r
-        \r
+    GpuMat messages_buffers;\r
+\r
     GpuMat temp;\r
     GpuMat out;\r
 };\r
index 2349857..ebf9900 100644 (file)
@@ -87,7 +87,7 @@ void cv::gpu::Scharr(const GpuMat&, GpuMat&, int, int, int, double, int, int) {
 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
@@ -664,8 +664,8 @@ namespace cv { namespace gpu { namespace device
     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
@@ -708,14 +708,14 @@ namespace
         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
@@ -1193,7 +1193,7 @@ void cv::gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy,
     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
@@ -1206,7 +1206,7 @@ void cv::gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize, d
     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
index 6f7b8d9..99c463b 100644 (file)
@@ -334,10 +334,7 @@ TEST_P(Laplacian, Accuracy)
     cv::Mat dst_gold;\r
     cv::Laplacian(src, dst_gold, -1, ksize.width);\r
 \r
-    if (type == CV_32FC1)\r
-        EXPECT_MAT_NEAR(dst_gold, dst, 0.0);\r
-    else\r
-        EXPECT_MAT_NEAR(getInnerROI(dst_gold, cv::Size(3, 3)), getInnerROI(dst, cv::Size(3, 3)), 0.0);\r
+    EXPECT_MAT_NEAR(dst_gold, dst, 0.0);\r
 }\r
 \r
 INSTANTIATE_TEST_CASE_P(GPU_Filter, Laplacian, testing::Combine(\r