Commit 1d62a025 authored by Vitaly Tuzov's avatar Vitaly Tuzov

Moved size restrictions for OpenVX processed images to corresponding cpp files

parent 9dc36a1e
...@@ -26,15 +26,6 @@ namespace ovx{ ...@@ -26,15 +26,6 @@ namespace ovx{
CV_EXPORTS_W ivx::Context& getOpenVXContext(); CV_EXPORTS_W ivx::Context& getOpenVXContext();
template <int kernel_id> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; } template <int kernel_id> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; }
template <> inline bool skipSmallImages<VX_KERNEL_MINMAXLOC>(int w, int h) { return w*h < 3840 * 2160; }
template <> inline bool skipSmallImages<VX_KERNEL_MEDIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
template <> inline bool skipSmallImages<VX_KERNEL_GAUSSIAN_3x3>(int w, int h) { return w*h < 320 * 240; }
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 640 * 480; }
template <> inline bool skipSmallImages<VX_KERNEL_HISTOGRAM>(int w, int h) { return w*h < 2048 * 1536; }
template <> inline bool skipSmallImages<VX_KERNEL_SOBEL_3x3>(int w, int h) { return w*h < 320 * 240; }
template <> inline bool skipSmallImages<VX_KERNEL_CANNY_EDGE_DETECTOR>(int w, int h) { return w*h < 640 * 480; }
template <> inline bool skipSmallImages<VX_KERNEL_ACCUMULATE>(int w, int h) { return w*h < 120 * 60; }
template <> inline bool skipSmallImages<VX_KERNEL_FAST_CORNERS>(int w, int h) { return w*h < 800 * 600; }
}} }}
#define CV_OVX_RUN(condition, func, ...) \ #define CV_OVX_RUN(condition, func, ...) \
......
...@@ -2300,6 +2300,9 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* ...@@ -2300,6 +2300,9 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
#endif #endif
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_MINMAXLOC>(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) static bool openvx_minMaxIdx(Mat &src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, Mat &mask)
{ {
int stype = src.type(); int stype = src.type();
......
...@@ -338,6 +338,9 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints, ...@@ -338,6 +338,9 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_FAST_CORNERS>(int w, int h) { return w*h < 800 * 600; }
}
static bool openvx_FAST(InputArray _img, std::vector<KeyPoint>& keypoints, static bool openvx_FAST(InputArray _img, std::vector<KeyPoint>& keypoints,
int _threshold, bool nonmaxSuppression, int type) int _threshold, bool nonmaxSuppression, int type)
{ {
......
...@@ -1942,6 +1942,9 @@ enum ...@@ -1942,6 +1942,9 @@ enum
VX_ACCUMULATE_WEIGHTED_OP = 2 VX_ACCUMULATE_WEIGHTED_OP = 2
}; };
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_ACCUMULATE>(int w, int h) { return w*h < 120 * 60; }
}
static bool openvx_accumulate(InputArray _src, InputOutputArray _dst, InputArray _mask, double _weight, int opType) static bool openvx_accumulate(InputArray _src, InputOutputArray _dst, InputArray _mask, double _weight, int opType)
{ {
Mat srcMat = _src.getMat(), dstMat = _dst.getMat(); Mat srcMat = _src.getMat(), dstMat = _dst.getMat();
......
...@@ -778,6 +778,9 @@ private: ...@@ -778,6 +778,9 @@ private:
}; };
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_CANNY_EDGE_DETECTOR>(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) static bool openvx_canny(const Mat& src, Mat& dst, int loVal, int hiVal, int kSize, bool useL2)
{ {
using namespace ivx; using namespace ivx;
......
...@@ -184,6 +184,9 @@ cv::Ptr<cv::FilterEngine> cv::createDerivFilter(int srcType, int dstType, ...@@ -184,6 +184,9 @@ cv::Ptr<cv::FilterEngine> cv::createDerivFilter(int srcType, int dstType,
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace cv namespace cv
{ {
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_SOBEL_3x3>(int w, int h) { return w*h < 320 * 240; }
}
static bool openvx_sobel(InputArray _src, OutputArray _dst, static bool openvx_sobel(InputArray _src, OutputArray _dst,
int dx, int dy, int ksize, int dx, int dy, int ksize,
double scale, double delta, int borderType) double scale, double delta, int borderType)
......
...@@ -1267,6 +1267,9 @@ private: ...@@ -1267,6 +1267,9 @@ private:
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace cv namespace cv
{ {
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_HISTOGRAM>(int w, int h) { return w*h < 2048 * 1536; }
}
static bool openvx_calchist(const Mat& image, OutputArray _hist, const int histSize, static bool openvx_calchist(const Mat& image, OutputArray _hist, const int histSize,
const float* _range) const float* _range)
{ {
......
...@@ -1639,6 +1639,9 @@ cv::Ptr<cv::FilterEngine> cv::createBoxFilter( int srcType, int dstType, Size ks ...@@ -1639,6 +1639,9 @@ cv::Ptr<cv::FilterEngine> cv::createBoxFilter( int srcType, int dstType, Size ks
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace cv namespace cv
{ {
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 640 * 480; }
}
static bool openvx_boxfilter(InputArray _src, OutputArray _dst, int ddepth, static bool openvx_boxfilter(InputArray _src, OutputArray _dst, int ddepth,
Size ksize, Point anchor, Size ksize, Point anchor,
bool normalize, int borderType) bool normalize, int borderType)
...@@ -2172,6 +2175,9 @@ static bool ocl_GaussianBlur_8UC1(InputArray _src, OutputArray _dst, Size ksize, ...@@ -2172,6 +2175,9 @@ static bool ocl_GaussianBlur_8UC1(InputArray _src, OutputArray _dst, Size ksize,
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_GAUSSIAN_3x3>(int w, int h) { return w*h < 320 * 240; }
}
static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize, static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
double sigma1, double sigma2, int borderType) double sigma1, double sigma2, int borderType)
{ {
...@@ -3302,6 +3308,9 @@ static bool ocl_medianFilter(InputArray _src, OutputArray _dst, int m) ...@@ -3302,6 +3308,9 @@ static bool ocl_medianFilter(InputArray _src, OutputArray _dst, int m)
#ifdef HAVE_OPENVX #ifdef HAVE_OPENVX
namespace cv namespace cv
{ {
namespace ovx {
template <> inline bool skipSmallImages<VX_KERNEL_MEDIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
}
static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize) static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize)
{ {
if (_src.type() != CV_8UC1 || _dst.type() != CV_8U if (_src.type() != CV_8UC1 || _dst.type() != CV_8U
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment