From 1d62a025b3c3a43a274af20e7388f70858a06c00 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Thu, 25 May 2017 19:10:21 +0300 Subject: [PATCH] Moved size restrictions for OpenVX processed images to corresponding cpp files --- modules/core/include/opencv2/core/openvx/ovx_defs.hpp | 9 --------- modules/core/src/stat.cpp | 3 +++ modules/features2d/src/fast.cpp | 3 +++ modules/imgproc/src/accum.cpp | 3 +++ modules/imgproc/src/canny.cpp | 3 +++ modules/imgproc/src/deriv.cpp | 3 +++ modules/imgproc/src/histogram.cpp | 3 +++ modules/imgproc/src/smooth.cpp | 9 +++++++++ 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/modules/core/include/opencv2/core/openvx/ovx_defs.hpp b/modules/core/include/opencv2/core/openvx/ovx_defs.hpp index 089ccf8767..a29db1b8ff 100644 --- a/modules/core/include/opencv2/core/openvx/ovx_defs.hpp +++ b/modules/core/include/opencv2/core/openvx/ovx_defs.hpp @@ -26,15 +26,6 @@ namespace ovx{ CV_EXPORTS_W ivx::Context& getOpenVXContext(); template inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 1280 * 720; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 320 * 240; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 640 * 480; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 2048 * 1536; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 320 * 240; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 640 * 480; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 120 * 60; } -template <> inline bool skipSmallImages(int w, int h) { return w*h < 800 * 600; } }} #define CV_OVX_RUN(condition, func, ...) \ diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 3bf753bbeb..6559b5ce29 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2300,6 +2300,9 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* #endif #ifdef HAVE_OPENVX +namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; } +} static bool openvx_minMaxIdx(Mat &src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, Mat &mask) { int stype = src.type(); diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cpp index 551be5af0f..5b36023564 100644 --- a/modules/features2d/src/fast.cpp +++ b/modules/features2d/src/fast.cpp @@ -338,6 +338,9 @@ static bool ocl_FAST( InputArray _img, std::vector& keypoints, #ifdef HAVE_OPENVX +namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 800 * 600; } +} static bool openvx_FAST(InputArray _img, std::vector& keypoints, int _threshold, bool nonmaxSuppression, int type) { diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index 771a82c101..941c100814 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -1942,6 +1942,9 @@ enum VX_ACCUMULATE_WEIGHTED_OP = 2 }; +namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 120 * 60; } +} static bool openvx_accumulate(InputArray _src, InputOutputArray _dst, InputArray _mask, double _weight, int opType) { Mat srcMat = _src.getMat(), dstMat = _dst.getMat(); diff --git a/modules/imgproc/src/canny.cpp b/modules/imgproc/src/canny.cpp index 214d4e9c0c..fe38308127 100644 --- a/modules/imgproc/src/canny.cpp +++ b/modules/imgproc/src/canny.cpp @@ -778,6 +778,9 @@ private: }; #ifdef HAVE_OPENVX +namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 640 * 480; } +} static bool openvx_canny(const Mat& src, Mat& dst, int loVal, int hiVal, int kSize, bool useL2) { using namespace ivx; diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index bcea1b8b1f..383ccf1a7f 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -184,6 +184,9 @@ cv::Ptr cv::createDerivFilter(int srcType, int dstType, #ifdef HAVE_OPENVX namespace cv { + namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 320 * 240; } + } static bool openvx_sobel(InputArray _src, OutputArray _dst, int dx, int dy, int ksize, double scale, double delta, int borderType) diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index cd86da48f2..49aaf9b5a3 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1267,6 +1267,9 @@ private: #ifdef HAVE_OPENVX namespace cv { + namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 2048 * 1536; } + } static bool openvx_calchist(const Mat& image, OutputArray _hist, const int histSize, const float* _range) { diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 2b695a4dc3..f8867b78bc 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -1639,6 +1639,9 @@ cv::Ptr cv::createBoxFilter( int srcType, int dstType, Size ks #ifdef HAVE_OPENVX namespace cv { + namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 640 * 480; } + } static bool openvx_boxfilter(InputArray _src, OutputArray _dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType) @@ -2172,6 +2175,9 @@ static bool ocl_GaussianBlur_8UC1(InputArray _src, OutputArray _dst, Size ksize, #ifdef HAVE_OPENVX +namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 320 * 240; } +} static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize, double sigma1, double sigma2, int borderType) { @@ -3302,6 +3308,9 @@ static bool ocl_medianFilter(InputArray _src, OutputArray _dst, int m) #ifdef HAVE_OPENVX namespace cv { + namespace ovx { + template <> inline bool skipSmallImages(int w, int h) { return w*h < 1280 * 720; } + } static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize) { if (_src.type() != CV_8UC1 || _dst.type() != CV_8U