From 20c08eab7355112ffee6389861dcd64e4f4faf65 Mon Sep 17 00:00:00 2001 From: elenagvo Date: Fri, 17 Nov 2017 15:13:04 +0300 Subject: [PATCH 1/3] change border type for medianBlur to BORDER_ISOLATED --- modules/imgproc/src/smooth.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 1332fb668d..c9c24a292a 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -3162,7 +3162,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) } else { - cv::copyMakeBorder( src0, src, 0, 0, ksize/2, ksize/2, BORDER_REPLICATE ); + cv::copyMakeBorder( src0, src, 0, 0, ksize/2, ksize/2, BORDER_REPLICATE|BORDER_ISOLATED); int cn = src0.channels(); CV_Assert( src.depth() == CV_8U && (cn == 1 || cn == 3 || cn == 4) ); From 3a09da71d89060205cf0b7d4b29f243fbf5a421f Mon Sep 17 00:00:00 2001 From: elenagvo Date: Fri, 17 Nov 2017 16:21:35 +0300 Subject: [PATCH 2/3] add HAL for medianBlur --- modules/imgproc/src/hal_replacement.hpp | 15 +++++++++++++++ modules/imgproc/src/smooth.cpp | 3 +++ 2 files changed, 18 insertions(+) diff --git a/modules/imgproc/src/hal_replacement.hpp b/modules/imgproc/src/hal_replacement.hpp index 5c7e7726fb..90e09e1e24 100644 --- a/modules/imgproc/src/hal_replacement.hpp +++ b/modules/imgproc/src/hal_replacement.hpp @@ -615,6 +615,21 @@ inline int hal_ni_integral(int depth, int sdepth, int sqdepth, const uchar * src #define cv_hal_integral hal_ni_integral //! @endcond +/** + @brief Calculate medianBlur filter + @param depth Depths of source and destination image + @param src_data,src_step Source image + @param dst_data,dst_step Destination image + @param width,height Source image dimensions + @param cn Number of channels + @param ksize Size of kernel +*/ +inline int hal_ni_medianBlur(int depth, const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int cn, int ksize) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } + +//! @cond IGNORED +#define cv_hal_medianBlur hal_ni_medianBlur +//! @endcond + //! @} #if defined __GNUC__ diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index c9c24a292a..bb3eac24f3 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -3123,6 +3123,9 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) _dst.create( src0.size(), src0.type() ); Mat dst = _dst.getMat(); + CALL_HAL(medianBlur, cv_hal_medianBlur, src0.depth(), src0.data, src0.step, dst.data, dst.step, src0.cols, src0.rows, + src0.channels(), ksize); + CV_OVX_RUN(true, openvx_medianFilter(_src0, _dst, ksize)) From 5d0a8d2aaf163bddfc127374d1f777afa21231ac Mon Sep 17 00:00:00 2001 From: elenagvo Date: Thu, 23 Nov 2017 13:30:00 +0300 Subject: [PATCH 3/3] fix the parameters order --- modules/imgproc/src/hal_replacement.hpp | 4 ++-- modules/imgproc/src/smooth.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/imgproc/src/hal_replacement.hpp b/modules/imgproc/src/hal_replacement.hpp index 90e09e1e24..f43fc70ee0 100644 --- a/modules/imgproc/src/hal_replacement.hpp +++ b/modules/imgproc/src/hal_replacement.hpp @@ -617,14 +617,14 @@ inline int hal_ni_integral(int depth, int sdepth, int sqdepth, const uchar * src /** @brief Calculate medianBlur filter - @param depth Depths of source and destination image @param src_data,src_step Source image @param dst_data,dst_step Destination image @param width,height Source image dimensions + @param depth Depths of source and destination image @param cn Number of channels @param ksize Size of kernel */ -inline int hal_ni_medianBlur(int depth, const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int cn, int ksize) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +inline int hal_ni_medianBlur(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, int ksize) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } //! @cond IGNORED #define cv_hal_medianBlur hal_ni_medianBlur diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index bb3eac24f3..c44e2acb9f 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -3123,7 +3123,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) _dst.create( src0.size(), src0.type() ); Mat dst = _dst.getMat(); - CALL_HAL(medianBlur, cv_hal_medianBlur, src0.depth(), src0.data, src0.step, dst.data, dst.step, src0.cols, src0.rows, + CALL_HAL(medianBlur, cv_hal_medianBlur, src0.data, src0.step, dst.data, dst.step, src0.cols, src0.rows, src0.depth(), src0.channels(), ksize); CV_OVX_RUN(true,