From 1a9d8e9447b2dd2449babfab8838c0210021e4cc Mon Sep 17 00:00:00 2001 From: elenagvo Date: Thu, 2 Nov 2017 17:05:17 +0300 Subject: [PATCH] test for GaussianBlur with border --- modules/imgproc/test/test_filter.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/imgproc/test/test_filter.cpp b/modules/imgproc/test/test_filter.cpp index c995feb..e7e05f8 100644 --- a/modules/imgproc/test/test_filter.cpp +++ b/modules/imgproc/test/test_filter.cpp @@ -1982,6 +1982,27 @@ TEST(Imgproc_Blur, borderTypes) EXPECT_DOUBLE_EQ(0.0, cvtest::norm(expected_dst, dst, NORM_INF)); } +TEST(Imgproc_GaussianBlur, borderTypes) +{ + Size kernelSize(3, 3); + + Mat src_16(16, 16, CV_8UC1, cv::Scalar::all(42)), dst_16; + Mat src_roi_16 = src_16(Rect(1, 1, 14, 14)); + src_roi_16.setTo(cv::Scalar::all(3)); + + cv::GaussianBlur(src_roi_16, dst_16, kernelSize, 0, 0, BORDER_REPLICATE); + + EXPECT_EQ(20, dst_16.at(0, 0)); + + Mat src(3, 12, CV_8UC1, cv::Scalar::all(42)), dst; + Mat src_roi = src(Rect(1, 1, 10, 1)); + src_roi.setTo(cv::Scalar::all(2)); + + cv::GaussianBlur(src_roi, dst, kernelSize, 0, 0, BORDER_REPLICATE); + + EXPECT_EQ(27, dst.at(0, 0)); +} + TEST(Imgproc_Morphology, iterated) { RNG& rng = theRNG(); -- 2.7.4