Remove C API from OpenCL module

pull/803/head
Andrey Kamaev 12 years ago
parent 4296b456e5
commit 8406312571
  1. 14
      cmake/OpenCVDetectOpenCL.cmake
  2. 3
      modules/core/include/opencv2/core/base.hpp
  3. 1
      modules/nonfree/CMakeLists.txt
  4. 2
      modules/nonfree/src/surf.ocl.cpp
  5. 7
      modules/ocl/include/opencv2/ocl.hpp
  6. 8
      modules/ocl/include/opencv2/ocl/matrix_operations.hpp
  7. 2
      modules/ocl/perf/main.cpp
  8. 6
      modules/ocl/perf/perf_haar.cpp
  9. 4
      modules/ocl/perf/perf_imgproc.cpp
  10. 11
      modules/ocl/perf/precomp.cpp
  11. 4
      modules/ocl/perf/precomp.hpp
  12. 44
      modules/ocl/src/arithm.cpp
  13. 2
      modules/ocl/src/blend.cpp
  14. 38
      modules/ocl/src/brute_force_matcher.cpp
  15. 2
      modules/ocl/src/color.cpp
  16. 16
      modules/ocl/src/error.cpp
  17. 2
      modules/ocl/src/fft.cpp
  18. 22
      modules/ocl/src/filtering.cpp
  19. 2
      modules/ocl/src/gemm.cpp
  20. 3
      modules/ocl/src/haar.cpp
  21. 6
      modules/ocl/src/hog.cpp
  22. 2
      modules/ocl/src/hough.cpp
  23. 55
      modules/ocl/src/imgproc.cpp
  24. 2
      modules/ocl/src/initialization.cpp
  25. 4
      modules/ocl/src/match_template.cpp
  26. 51
      modules/ocl/src/matrix_operations.cpp
  27. 10
      modules/ocl/src/moments.cpp
  28. 18
      modules/ocl/src/pyrlk.cpp
  29. 3
      modules/ocl/src/safe_call.hpp
  30. 4
      modules/ocl/src/split_merge.cpp
  31. 3
      modules/ocl/src/stereobm.cpp
  32. 2
      modules/ocl/test/test_haar.cpp
  33. 8
      modules/ocl/test/test_imgproc.cpp
  34. 5
      modules/ocl/test/test_moments.cpp
  35. 4
      modules/ocl/test/utility.hpp
  36. 7
      samples/ocl/facedetect.cpp
  37. 2
      samples/ocl/hog.cpp
  38. 2
      samples/ocl/squares.cpp
  39. 4
      samples/ocl/surf_matcher.cpp

@ -13,6 +13,13 @@ else(APPLE)
DOC "OpenCL root directory" DOC "OpenCL root directory"
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
find_path(OPENCL_INCLUDE_DIR
NAMES OpenCL/cl.h CL/cl.h
HINTS ${OPENCL_ROOT_DIR}
PATH_SUFFIXES include include/nvidia-current
DOC "OpenCL include directory"
NO_DEFAULT_PATH)
find_path(OPENCL_INCLUDE_DIR find_path(OPENCL_INCLUDE_DIR
NAMES OpenCL/cl.h CL/cl.h NAMES OpenCL/cl.h CL/cl.h
HINTS ${OPENCL_ROOT_DIR} HINTS ${OPENCL_ROOT_DIR}
@ -25,6 +32,13 @@ else(APPLE)
set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86) set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86)
endif() endif()
find_library(OPENCL_LIBRARY
NAMES OpenCL
HINTS ${OPENCL_ROOT_DIR}
PATH_SUFFIXES ${OPENCL_POSSIBLE_LIB_SUFFIXES}
DOC "OpenCL library"
NO_DEFAULT_PATH)
find_library(OPENCL_LIBRARY find_library(OPENCL_LIBRARY
NAMES OpenCL NAMES OpenCL
HINTS ${OPENCL_ROOT_DIR} HINTS ${OPENCL_ROOT_DIR}

@ -109,7 +109,8 @@ enum {
GpuNotSupported= -216, GpuNotSupported= -216,
GpuApiCallError= -217, GpuApiCallError= -217,
OpenGlNotSupported= -218, OpenGlNotSupported= -218,
OpenGlApiCallError= -219 OpenGlApiCallError= -219,
OpenCLApiCallError= -220
}; };
} //Error } //Error

@ -3,5 +3,4 @@ if(BUILD_ANDROID_PACKAGE)
endif() endif()
set(the_description "Functionality with possible limitations on the use") set(the_description "Functionality with possible limitations on the use")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl) ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl)

@ -182,7 +182,7 @@ public:
if (use_mask) if (use_mask)
{ {
CV_Error(CV_StsBadFunc, "Masked SURF detector is not implemented yet"); CV_Error(Error::StsBadFunc, "Masked SURF detector is not implemented yet");
//!FIXME //!FIXME
// temp fix for missing min overload // temp fix for missing min overload
//oclMat temp(mask.size(), mask.type()); //oclMat temp(mask.size(), mask.type());

@ -131,9 +131,6 @@ namespace cv
//getDevice also need to be called before this function //getDevice also need to be called before this function
CV_EXPORTS void setDeviceEx(Info &oclinfo, void *ctx, void *qu, int devnum = 0); CV_EXPORTS void setDeviceEx(Info &oclinfo, void *ctx, void *qu, int devnum = 0);
//////////////////////////////// Error handling ////////////////////////
CV_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func);
//////////////////////////////// OpenCL context //////////////////////// //////////////////////////////// OpenCL context ////////////////////////
//This is a global singleton class used to represent a OpenCL context. //This is a global singleton class used to represent a OpenCL context.
class CV_EXPORTS Context class CV_EXPORTS Context
@ -811,7 +808,8 @@ namespace cv
///////////////////////////////////////////CascadeClassifier////////////////////////////////////////////////////////////////// ///////////////////////////////////////////CascadeClassifier//////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CV_EXPORTS_W OclCascadeClassifier : public cv::CascadeClassifier #if 0
class CV_EXPORTS OclCascadeClassifier : public cv::CascadeClassifier
{ {
public: public:
OclCascadeClassifier() {}; OclCascadeClassifier() {};
@ -820,6 +818,7 @@ namespace cv
CvSeq* oclHaarDetectObjects(oclMat &gimg, CvMemStorage *storage, double scaleFactor, CvSeq* oclHaarDetectObjects(oclMat &gimg, CvMemStorage *storage, double scaleFactor,
int minNeighbors, int flags, CvSize minSize = cvSize(0, 0), CvSize maxSize = cvSize(0, 0)); int minNeighbors, int flags, CvSize minSize = cvSize(0, 0), CvSize maxSize = cvSize(0, 0));
}; };
#endif

@ -459,28 +459,28 @@ namespace cv
inline uchar *oclMat::ptr(int y) inline uchar *oclMat::ptr(int y)
{ {
CV_DbgAssert( (unsigned)y < (unsigned)rows ); CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(CV_GpuNotSupported, "This function hasn't been supported yet.\n"); CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return data + step * y; return data + step * y;
} }
inline const uchar *oclMat::ptr(int y) const inline const uchar *oclMat::ptr(int y) const
{ {
CV_DbgAssert( (unsigned)y < (unsigned)rows ); CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(CV_GpuNotSupported, "This function hasn't been supported yet.\n"); CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return data + step * y; return data + step * y;
} }
template<typename _Tp> inline _Tp *oclMat::ptr(int y) template<typename _Tp> inline _Tp *oclMat::ptr(int y)
{ {
CV_DbgAssert( (unsigned)y < (unsigned)rows ); CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(CV_GpuNotSupported, "This function hasn't been supported yet.\n"); CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return (_Tp *)(data + step * y); return (_Tp *)(data + step * y);
} }
template<typename _Tp> inline const _Tp *oclMat::ptr(int y) const template<typename _Tp> inline const _Tp *oclMat::ptr(int y) const
{ {
CV_DbgAssert( (unsigned)y < (unsigned)rows ); CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(CV_GpuNotSupported, "This function hasn't been supported yet.\n"); CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return (const _Tp *)(data + step * y); return (const _Tp *)(data + step * y);
} }

@ -63,8 +63,6 @@ int main(int argc, const char *argv[])
} }
} }
redirectError(cvErrorCallback);
const char *keys = const char *keys =
"{ h help | false | print help message }" "{ h help | false | print help message }"
"{ f filter | | filter for test }" "{ f filter | | filter for test }"

@ -44,6 +44,8 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#if 0
///////////// Haar //////////////////////// ///////////// Haar ////////////////////////
namespace cv namespace cv
{ {
@ -135,4 +137,6 @@ TEST(Haar)
faceCascade.detectMultiScale(d_img, faces, faceCascade.detectMultiScale(d_img, faces,
1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30)); 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
GPU_FULL_OFF; GPU_FULL_OFF;
} }
#endif

@ -746,12 +746,12 @@ void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, int sp,
if (src_roi.empty()) if (src_roi.empty())
{ {
CV_Error(CV_StsBadArg, "The input image is empty"); CV_Error(Error::StsBadArg, "The input image is empty");
} }
if (src_roi.depth() != CV_8U || src_roi.channels() != 4) if (src_roi.depth() != CV_8U || src_roi.channels() != 4)
{ {
CV_Error(CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported"); CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported");
} }
CV_Assert((src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) && CV_Assert((src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) &&

@ -349,14 +349,3 @@ string abspath(const string &relpath)
{ {
return TestSystem::instance().workingDir() + relpath; return TestSystem::instance().workingDir() + relpath;
} }
int CV_CDECL cvErrorCallback(int /*status*/, const char * /*func_name*/,
const char *err_msg, const char * /*file_name*/,
int /*line*/, void * /*userdata*/)
{
TestSystem::instance().printError(err_msg);
return 0;
}

@ -55,6 +55,8 @@
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/ocl.hpp" #include "opencv2/ocl.hpp"
#include "opencv2/core/utility.hpp"
#define Min_Size 1000 #define Min_Size 1000
#define Max_Size 4000 #define Max_Size 4000
#define Multiple 2 #define Multiple 2
@ -65,7 +67,7 @@ using namespace cv;
void gen(Mat &mat, int rows, int cols, int type, Scalar low, Scalar high); void gen(Mat &mat, int rows, int cols, int type, Scalar low, Scalar high);
string abspath(const string &relpath); string abspath(const string &relpath);
int CV_CDECL cvErrorCallback(int, const char *, const char *, const char *, int, void *);
typedef struct typedef struct
{ {
short x; short x;

@ -133,7 +133,7 @@ void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -196,7 +196,7 @@ static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst,
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -290,7 +290,7 @@ void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst,
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -362,7 +362,7 @@ static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, String kernelN
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -433,7 +433,7 @@ static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &ds
}; };
ArithmeticFuncS func = tab[src1.depth()]; ArithmeticFuncS func = tab[src1.depth()];
if(func == 0) if(func == 0)
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::error(Error::StsBadArg, "Unsupported arithmetic operation", "", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
@ -465,7 +465,7 @@ void cv::ocl::divide(double scalar, const oclMat &src, oclMat &dst)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE)) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE))
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -557,7 +557,7 @@ void cv::ocl::compare(const oclMat &src1, const oclMat &src2, oclMat &dst , int
kernelString = &arithm_compare_ne; kernelString = &arithm_compare_ne;
break; break;
default: default:
CV_Error(CV_StsBadArg, "Unknown comparison method"); CV_Error(Error::StsBadArg, "Unknown comparison method");
} }
compare_run(src1, src2, dst, kernelName, kernelString); compare_run(src1, src2, dst, kernelName, kernelString);
} }
@ -628,7 +628,7 @@ Scalar cv::ocl::sum(const oclMat &src)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
static sumFunc functab[2] = static sumFunc functab[2] =
{ {
@ -645,7 +645,7 @@ Scalar cv::ocl::absSum(const oclMat &src)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
static sumFunc functab[2] = static sumFunc functab[2] =
{ {
@ -662,7 +662,7 @@ Scalar cv::ocl::sqrSum(const oclMat &src)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
static sumFunc functab[2] = static sumFunc functab[2] =
{ {
@ -811,7 +811,7 @@ void cv::ocl::minMax(const oclMat &src, double *minVal, double *maxVal, const oc
CV_Assert(src.oclchannels() == 1); CV_Assert(src.oclchannels() == 1);
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
static minMaxFunc functab[8] = static minMaxFunc functab[8] =
{ {
@ -895,7 +895,7 @@ static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, String kern
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -944,7 +944,7 @@ static void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, String kern
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1124,7 +1124,7 @@ static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, String kernel
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
if(!clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
//int channels = dst.oclchannels(); //int channels = dst.oclchannels();
@ -1165,7 +1165,7 @@ static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1213,7 +1213,7 @@ static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1277,7 +1277,7 @@ static void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, o
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1332,7 +1332,7 @@ static void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &d
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1514,7 +1514,7 @@ void cv::ocl::minMaxLoc(const oclMat &src, double *minVal, double *maxVal,
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
static minMaxLocFunc functab[2] = static minMaxLocFunc functab[2] =
{ {
@ -1561,7 +1561,7 @@ int cv::ocl::countNonZero(const oclMat &src)
size_t groupnum = src.clCxt->computeUnits(); size_t groupnum = src.clCxt->computeUnits();
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
CV_Assert(groupnum != 0); CV_Assert(groupnum != 0);
groupnum = groupnum * 2; groupnum = groupnum * 2;
@ -1834,7 +1834,7 @@ static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst,
}; };
BitwiseFuncS func = tab[src1.depth()]; BitwiseFuncS func = tab[src1.depth()];
if(func == 0) if(func == 0)
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::error(Error::StsBadArg, "Unsupported arithmetic operation", "", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
@ -2037,7 +2037,7 @@ static void transpose_run(const oclMat &src, oclMat &dst, String kernelName)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }

@ -62,7 +62,7 @@ void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &
oclMat &result) oclMat &result)
{ {
cv::ocl::Context *ctx = img1.clCxt; cv::ocl::Context *ctx = img1.clCxt;
assert(ctx == img2.clCxt && ctx == weights1.clCxt && ctx == weights2.clCxt); CV_Assert(ctx == img2.clCxt && ctx == weights1.clCxt && ctx == weights2.clCxt);
int channels = img1.oclchannels(); int channels = img1.oclchannels();
int depth = img1.depth(); int depth = img1.depth();
int rows = img1.rows; int rows = img1.rows;

@ -64,7 +64,7 @@ template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ >
void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
const oclMat &trainIdx, const oclMat &distance, int distType) const oclMat &trainIdx, const oclMat &distance, int distType)
{ {
assert(query.type() == CV_32F); CV_Assert(query.type() == CV_32F);
cv::ocl::Context *ctx = query.clCxt; cv::ocl::Context *ctx = query.clCxt;
size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1};
size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1};
@ -106,7 +106,7 @@ template < int BLOCK_SIZE/*, typename Mask*/ >
void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
const oclMat &trainIdx, const oclMat &distance, int distType) const oclMat &trainIdx, const oclMat &distance, int distType)
{ {
assert(query.type() == CV_32F); CV_Assert(query.type() == CV_32F);
cv::ocl::Context *ctx = query.clCxt; cv::ocl::Context *ctx = query.clCxt;
size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1};
size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1};
@ -147,7 +147,7 @@ template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ >
void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/,
const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType)
{ {
assert(query.type() == CV_32F); CV_Assert(query.type() == CV_32F);
cv::ocl::Context *ctx = query.clCxt; cv::ocl::Context *ctx = query.clCxt;
size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1};
size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1};
@ -188,7 +188,7 @@ template < int BLOCK_SIZE/*, typename Mask*/ >
void radius_match(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, void radius_match(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/,
const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType)
{ {
assert(query.type() == CV_32F); CV_Assert(query.type() == CV_32F);
cv::ocl::Context *ctx = query.clCxt; cv::ocl::Context *ctx = query.clCxt;
size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1};
size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1};
@ -533,14 +533,13 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchSingle(const oclMat &query, const
// match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int
int callType = query.depth(); int callType = query.depth();
char cvFuncName[] = "singleMatch";
if (callType != 5) if (callType != 5)
CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::StsUnsupportedFormat, "BruteForceMatch OpenCL only support float type query!\n");
if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0
|| callType != 2 || callType != 4))) || callType != 2 || callType != 4)))
{ {
CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::BadDepth, "BruteForceMatch OpenCL only support float type query!\n");
} }
CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
@ -550,8 +549,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchSingle(const oclMat &query, const
distance.create(1, query.rows, CV_32F); distance.create(1, query.rows, CV_32F);
matchDispatcher(query, train, mask, trainIdx, distance, distType); matchDispatcher(query, train, mask, trainIdx, distance, distType);
exit:
return;
} }
void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector<DMatch> &matches) void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector<DMatch> &matches)
@ -597,7 +594,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons
void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &query, const oclMat &train, std::vector<DMatch> &matches, const oclMat &mask) void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &query, const oclMat &train, std::vector<DMatch> &matches, const oclMat &mask)
{ {
assert(mask.empty()); // mask is not supported at the moment CV_Assert(mask.empty()); // mask is not supported at the moment
oclMat trainIdx, distance; oclMat trainIdx, distance;
matchSingle(query, train, trainIdx, distance, mask); matchSingle(query, train, trainIdx, distance, mask);
matchDownload(trainIdx, distance, matches); matchDownload(trainIdx, distance, matches);
@ -655,14 +652,13 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &query, c
// match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int
int callType = query.depth(); int callType = query.depth();
char cvFuncName[] = "matchCollection";
if (callType != 5) if (callType != 5)
CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::StsUnsupportedFormat, "BruteForceMatch OpenCL only support float type query!\n");
if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0
|| callType != 2 || callType != 4))) || callType != 2 || callType != 4)))
{ {
CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::BadDepth, "BruteForceMatch OpenCL only support float type query!\n");
} }
CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
@ -672,8 +668,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &query, c
distance.create(1, query.rows, CV_32F); distance.create(1, query.rows, CV_32F);
matchDispatcher(query, (const oclMat *)trainCollection.ptr(), trainCollection.cols, masks, trainIdx, imgIdx, distance, distType); matchDispatcher(query, (const oclMat *)trainCollection.ptr(), trainCollection.cols, masks, trainIdx, imgIdx, distance, distType);
exit:
return;
} }
void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance, std::vector<DMatch> &matches) void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &trainIdx, const oclMat &imgIdx, const oclMat &distance, std::vector<DMatch> &matches)
@ -745,14 +739,13 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatchSingle(const oclMat &query, co
// match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int
int callType = query.depth(); int callType = query.depth();
char cvFuncName[] = "knnMatchSingle";
if (callType != 5) if (callType != 5)
CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::StsUnsupportedFormat, "BruteForceMatch OpenCL only support float type query!\n");
if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0
|| callType != 2 || callType != 4))) || callType != 2 || callType != 4)))
{ {
CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::BadDepth, "BruteForceMatch OpenCL only support float type query!\n");
} }
CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
@ -773,8 +766,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatchSingle(const oclMat &query, co
trainIdx.setTo(Scalar::all(-1)); trainIdx.setTo(Scalar::all(-1));
kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType); kmatchDispatcher(query, train, k, mask, trainIdx, distance, allDist, distType);
exit:
return;
} }
void cv::ocl::BruteForceMatcher_OCL_base::knnMatchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector< std::vector<DMatch> > &matches, bool compactResult) void cv::ocl::BruteForceMatcher_OCL_base::knnMatchDownload(const oclMat &trainIdx, const oclMat &distance, std::vector< std::vector<DMatch> > &matches, bool compactResult)
@ -1020,14 +1011,13 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &query,
// match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int // match1 doesn't support signed char type, match2 only support float, hamming support uchar, ushort and int
int callType = query.depth(); int callType = query.depth();
char cvFuncName[] = "radiusMatchSingle";
if (callType != 5) if (callType != 5)
CV_ERROR(CV_UNSUPPORTED_FORMAT_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::StsUnsupportedFormat, "BruteForceMatch OpenCL only support float type query!\n");
if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0 if ((distType == 0 && callType == 1 ) || (distType == 1 && callType != 5) || (distType == 2 && (callType != 0
|| callType != 2 || callType != 4))) || callType != 2 || callType != 4)))
{ {
CV_ERROR(CV_UNSUPPORTED_DEPTH_ERR, "BruteForceMatch OpenCL only support float type query!\n"); CV_Error(Error::BadDepth, "BruteForceMatch OpenCL only support float type query!\n");
} }
CV_Assert(query.channels() == 1 && query.depth() < CV_64F); CV_Assert(query.channels() == 1 && query.depth() < CV_64F);
@ -1044,8 +1034,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &query,
nMatches.setTo(Scalar::all(0)); nMatches.setTo(Scalar::all(0));
matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType); matchDispatcher(query, train, maxDistance, mask, trainIdx, distance, nMatches, distType);
exit:
return;
} }
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchDownload(const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchDownload(const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches,

@ -268,7 +268,7 @@ void cvtColor_caller(const oclMat &src, oclMat &dst, int code, int dcn)
case COLOR_HLS2BGR: case COLOR_HLS2RGB: case COLOR_HLS2BGR_FULL: case COLOR_HLS2RGB_FULL: case COLOR_HLS2BGR: case COLOR_HLS2RGB: case COLOR_HLS2BGR_FULL: case COLOR_HLS2RGB_FULL:
*/ */
default: default:
CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); CV_Error(Error::StsBadFlag, "Unknown/unsupported color conversion code" );
} }
} }
} }

@ -170,21 +170,5 @@ namespace cv
sprintf(buf, "%d", err); sprintf(buf, "%d", err);
return buf; return buf;
} }
void error(const char *error_string, const char *file, const int line, const char *func)
{
int code = CV_GpuApiCallError;
if (std::uncaught_exception())
{
const char *errorStr = cvErrorStr(code);
const char *function = func ? func : "unknown function";
std::cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
std::cerr.flush();
}
else
cv::error( cv::Exception(code, error_string, func, file, line) );
}
} }
} }

@ -51,7 +51,7 @@ using namespace cv::ocl;
#if !defined HAVE_CLAMDFFT #if !defined HAVE_CLAMDFFT
void cv::ocl::dft(const oclMat&, oclMat&, Size, int) void cv::ocl::dft(const oclMat&, oclMat&, Size, int)
{ {
CV_Error(CV_StsNotImplemented, "OpenCL DFT is not implemented"); CV_Error(Error::StsNotImplemented, "OpenCL DFT is not implemented");
} }
namespace cv { namespace ocl { namespace cv { namespace ocl {
void fft_teardown(); void fft_teardown();

@ -270,7 +270,7 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
sprintf(s, "-D VAL=FLT_MAX -D GENTYPE=float4"); sprintf(s, "-D VAL=FLT_MAX -D GENTYPE=float4");
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported type"); CV_Error(Error::StsUnsupportedFormat, "unsupported type");
} }
char compile_option[128]; char compile_option[128];
@ -350,7 +350,7 @@ static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
sprintf(s, "-D VAL=-FLT_MAX -D GENTYPE=float4"); sprintf(s, "-D VAL=-FLT_MAX -D GENTYPE=float4");
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported type"); CV_Error(Error::StsUnsupportedFormat, "unsupported type");
} }
char compile_option[128]; char compile_option[128];
@ -462,7 +462,7 @@ void morphOp(int op, const oclMat &src, oclMat &dst, const Mat &_kernel, Point a
{ {
if ((borderType != cv::BORDER_CONSTANT) || (borderValue != morphologyDefaultBorderValue())) if ((borderType != cv::BORDER_CONSTANT) || (borderValue != morphologyDefaultBorderValue()))
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(Error::StsBadArg, "unsupported border type");
} }
Mat kernel; Mat kernel;
@ -564,7 +564,7 @@ void cv::ocl::morphologyEx(const oclMat &src, oclMat &dst, int op, const Mat &ke
subtract(temp, src, dst); subtract(temp, src, dst);
break; break;
default: default:
CV_Error(CV_StsBadArg, "unknown morphological operation"); CV_Error(Error::StsBadArg, "unknown morphological operation");
} }
} }
@ -778,7 +778,7 @@ static void GPUFilterBox_8u_C1R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT"); sprintf(btype, "BORDER_REFLECT");
break; break;
case 3: case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!"); CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return; return;
case 4: case 4:
sprintf(btype, "BORDER_REFLECT_101"); sprintf(btype, "BORDER_REFLECT_101");
@ -840,7 +840,7 @@ static void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT"); sprintf(btype, "BORDER_REFLECT");
break; break;
case 3: case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!"); CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return; return;
case 4: case 4:
sprintf(btype, "BORDER_REFLECT_101"); sprintf(btype, "BORDER_REFLECT_101");
@ -902,7 +902,7 @@ static void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT"); sprintf(btype, "BORDER_REFLECT");
break; break;
case 3: case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!"); CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return; return;
case 4: case 4:
sprintf(btype, "BORDER_REFLECT_101"); sprintf(btype, "BORDER_REFLECT_101");
@ -965,7 +965,7 @@ static void GPUFilterBox_32F_C4R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT"); sprintf(btype, "BORDER_REFLECT");
break; break;
case 3: case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!"); CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return; return;
case 4: case 4:
sprintf(btype, "BORDER_REFLECT_101"); sprintf(btype, "BORDER_REFLECT_101");
@ -1396,7 +1396,7 @@ void cv::ocl::sepFilter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat
if ((bordertype != cv::BORDER_CONSTANT) && if ((bordertype != cv::BORDER_CONSTANT) &&
(bordertype != cv::BORDER_REPLICATE)) (bordertype != cv::BORDER_REPLICATE))
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(Error::StsBadArg, "unsupported border type");
} }
} }
} }
@ -1479,7 +1479,7 @@ void cv::ocl::Laplacian(const oclMat &src, oclMat &dst, int ddepth, int ksize, d
{ {
if (!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if (!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -1563,7 +1563,7 @@ void cv::ocl::GaussianBlur(const oclMat &src, oclMat &dst, Size ksize, double si
if ((bordertype != cv::BORDER_CONSTANT) && if ((bordertype != cv::BORDER_CONSTANT) &&
(bordertype != cv::BORDER_REPLICATE)) (bordertype != cv::BORDER_REPLICATE))
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(Error::StsBadArg, "unsupported border type");
} }
} }
} }

@ -50,7 +50,7 @@
void cv::ocl::gemm(const oclMat&, const oclMat&, double, void cv::ocl::gemm(const oclMat&, const oclMat&, double,
const oclMat&, double, oclMat&, int) const oclMat&, double, oclMat&, int)
{ {
CV_Error(CV_StsNotImplemented, "OpenCL BLAS is not implemented"); CV_Error(Error::StsNotImplemented, "OpenCL BLAS is not implemented");
} }
#else #else
#include "clAmdBlas.h" #include "clAmdBlas.h"

@ -53,6 +53,8 @@
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if 0
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -1493,3 +1495,4 @@ struct gpuHaarDetectObjects_ScaleCascade_Invoker
} }
} }
#endif

@ -267,7 +267,7 @@ void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &img, Size win_stride,
win_stride.height, win_stride.width, effect_size.height, effect_size.width, block_hists, descriptors); win_stride.height, win_stride.width, effect_size.height, effect_size.width, block_hists, descriptors);
break; break;
default: default:
CV_Error(CV_StsBadArg, "Unknown descriptor format"); CV_Error(Error::StsBadArg, "Unknown descriptor format");
} }
} }
@ -353,7 +353,7 @@ void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &img, std::vector<Rec
} }
Size scaled_win_size(cvRound(win_size.width * scale), cvRound(win_size.height * scale)); Size scaled_win_size(cvRound(win_size.width * scale), cvRound(win_size.height * scale));
for (size_t j = 0; j < locations.size(); j++) for (size_t j = 0; j < locations.size(); j++)
all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale, scaled_win_size)); all_candidates.push_back(Rect(Point2d(locations[j]) * scale, scaled_win_size));
} }
found_locations.assign(all_candidates.begin(), all_candidates.end()); found_locations.assign(all_candidates.begin(), all_candidates.end());
@ -1627,7 +1627,7 @@ void cv::ocl::device::hog::normalize_hists(int nbins, int block_stride_x, int bl
size_t localThreads[3] = { nthreads, 1, 1 }; size_t localThreads[3] = { nthreads, 1, 1 };
if ((nthreads < 32) || (nthreads > 512) ) if ((nthreads < 32) || (nthreads > 512) )
cv::ocl::error("normalize_hists: histogram's size is too small or too big", __FILE__, __LINE__, "normalize_hists"); cv::error(Error::StsBadArg, "normalize_hists: histogram's size is too small or too big", "cv::ocl::device::hog::normalize_hists", __FILE__, __LINE__);
args.push_back( std::make_pair( sizeof(cl_int), (void *)&nthreads)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&nthreads));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&block_hist_size)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&block_hist_size));

@ -385,7 +385,7 @@ void cv::ocl::HoughCircles(const oclMat& src, oclMat& circles, HoughCirclesBuf&
void cv::ocl::HoughCirclesDownload(const oclMat& d_circles, cv::OutputArray h_circles_) void cv::ocl::HoughCirclesDownload(const oclMat& d_circles, cv::OutputArray h_circles_)
{ {
// FIX ME: garbage values are copied! // FIX ME: garbage values are copied!
CV_Error(CV_StsNotImplemented, "HoughCirclesDownload is not implemented"); CV_Error(Error::StsNotImplemented, "HoughCirclesDownload is not implemented");
if (d_circles.empty()) if (d_circles.empty())
{ {

@ -428,7 +428,7 @@ namespace cv
{ {
if(dsize.width != (int)(src.cols * fx) || dsize.height != (int)(src.rows * fy)) if(dsize.width != (int)(src.cols * fx) || dsize.height != (int)(src.rows * fy))
{ {
CV_Error(CV_StsUnmatchedSizes, "invalid dsize and fx, fy!"); CV_Error(Error::StsUnmatchedSizes, "invalid dsize and fx, fy!");
} }
} }
if( dsize == Size() ) if( dsize == Size() )
@ -448,7 +448,7 @@ namespace cv
resize_gpu( src, dst, fx, fy, interpolation); resize_gpu( src, dst, fx, fy, interpolation);
return; return;
} }
CV_Error(CV_StsUnsupportedFormat, "Non-supported interpolation method"); CV_Error(Error::StsUnsupportedFormat, "Non-supported interpolation method");
} }
@ -501,7 +501,7 @@ namespace cv
} }
else else
{ {
CV_Error(CV_StsUnsupportedFormat, "Non-supported filter length"); CV_Error(Error::StsUnsupportedFormat, "Non-supported filter length");
//String kernelName = "medianFilter"; //String kernelName = "medianFilter";
//args.push_back( std::make_pair( sizeof(cl_int),(void*)&m)); //args.push_back( std::make_pair( sizeof(cl_int),(void*)&m));
@ -522,7 +522,7 @@ namespace cv
(bordertype != cv::BORDER_CONSTANT) && (bordertype != cv::BORDER_CONSTANT) &&
(bordertype != cv::BORDER_REPLICATE)) (bordertype != cv::BORDER_REPLICATE))
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(Error::StsBadArg, "unsupported border type");
} }
} }
bordertype &= ~cv::BORDER_ISOLATED; bordertype &= ~cv::BORDER_ISOLATED;
@ -549,7 +549,7 @@ namespace cv
} }
if(bordertype_index == sizeof(__bordertype) / sizeof(int)) if(bordertype_index == sizeof(__bordertype) / sizeof(int))
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(Error::StsBadArg, "unsupported border type");
} }
String kernelName = "copymakeborder"; String kernelName = "copymakeborder";
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
@ -604,7 +604,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval )); args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_8S: case CV_8S:
@ -623,7 +623,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval )); args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16U: case CV_16U:
@ -642,7 +642,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval )); args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16S: case CV_16S:
@ -661,7 +661,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval )); args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32S: case CV_32S:
@ -687,7 +687,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival )); args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32F: case CV_32F:
@ -706,7 +706,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval )); args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_64F: case CV_64F:
@ -725,11 +725,11 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval )); args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
openCLExecuteKernel(src.clCxt, &imgproc_copymakeboder, kernelName, globalThreads, localThreads, args, -1, -1, compile_option); openCLExecuteKernel(src.clCxt, &imgproc_copymakeboder, kernelName, globalThreads, localThreads, args, -1, -1, compile_option);
@ -1021,7 +1021,7 @@ namespace cv
CV_Assert(src.type() == CV_8UC1); CV_Assert(src.type() == CV_8UC1);
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
int vlen = 4; int vlen = 4;
int offset = src.offset / vlen; int offset = src.offset / vlen;
@ -1195,7 +1195,7 @@ namespace cv
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
CV_Assert(src.cols >= blockSize / 2 && src.rows >= blockSize / 2); CV_Assert(src.cols >= blockSize / 2 && src.rows >= blockSize / 2);
oclMat Dx, Dy; oclMat Dx, Dy;
@ -1209,7 +1209,7 @@ namespace cv
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "select device don't support double"); CV_Error(Error::GpuNotSupported, "select device don't support double");
} }
CV_Assert(src.cols >= blockSize / 2 && src.rows >= blockSize / 2); CV_Assert(src.cols >= blockSize / 2 && src.rows >= blockSize / 2);
oclMat Dx, Dy; oclMat Dx, Dy;
@ -1256,15 +1256,10 @@ namespace cv
void meanShiftFiltering(const oclMat &src, oclMat &dst, int sp, int sr, TermCriteria criteria) void meanShiftFiltering(const oclMat &src, oclMat &dst, int sp, int sr, TermCriteria criteria)
{ {
if( src.empty() ) if( src.empty() )
CV_Error( CV_StsBadArg, "The input image is empty" ); CV_Error(Error::StsBadArg, "The input image is empty" );
if( src.depth() != CV_8U || src.oclchannels() != 4 ) if( src.depth() != CV_8U || src.oclchannels() != 4 )
CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
// if(!src.clCxt->supportsFeature(Context::CL_DOUBLE))
// {
// CV_Error( CV_GpuNotSupported, "Selected device doesn't support double, so a deviation exists.\nIf the accuracy is acceptable, the error can be ignored.\n");
// }
dst.create( src.size(), CV_8UC4 ); dst.create( src.size(), CV_8UC4 );
@ -1324,15 +1319,10 @@ namespace cv
void meanShiftProc(const oclMat &src, oclMat &dstr, oclMat &dstsp, int sp, int sr, TermCriteria criteria) void meanShiftProc(const oclMat &src, oclMat &dstr, oclMat &dstsp, int sp, int sr, TermCriteria criteria)
{ {
if( src.empty() ) if( src.empty() )
CV_Error( CV_StsBadArg, "The input image is empty" ); CV_Error(Error::StsBadArg, "The input image is empty" );
if( src.depth() != CV_8U || src.oclchannels() != 4 ) if( src.depth() != CV_8U || src.oclchannels() != 4 )
CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
// if(!src.clCxt->supportsFeature(Context::CL_DOUBLE))
// {
// CV_Error( CV_GpuNotSupported, "Selected device doesn't support double, so a deviation exists.\nIf the accuracy is acceptable, the error can be ignored.\n");
// }
dstr.create( src.size(), CV_8UC4 ); dstr.create( src.size(), CV_8UC4 );
dstsp.create( src.size(), CV_16SC2 ); dstsp.create( src.size(), CV_16SC2 );
@ -1581,8 +1571,7 @@ namespace cv
if( src.depth() == CV_8U ) if( src.depth() == CV_8U )
oclbilateralFilter_8u( src, dst, radius, sigmaclr, sigmaspc, borderType ); oclbilateralFilter_8u( src, dst, radius, sigmaclr, sigmaspc, borderType );
else else
CV_Error( CV_StsUnsupportedFormat, CV_Error(Error::StsUnsupportedFormat, "Bilateral filtering is only implemented for 8uimages" );
"Bilateral filtering is only implemented for 8uimages" );
} }
} }
@ -1726,7 +1715,7 @@ static void convolve_run_fft(const oclMat &image, const oclMat &templ, oclMat &r
} }
#else #else
CV_Error(CV_StsNotImplemented, "OpenCL DFT is not implemented"); CV_Error(Error::StsNotImplemented, "OpenCL DFT is not implemented");
#define UNUSED(x) (void)(x); #define UNUSED(x) (void)(x);
UNUSED(image) UNUSED(templ) UNUSED(result) UNUSED(ccorr) UNUSED(buf) UNUSED(image) UNUSED(templ) UNUSED(result) UNUSED(ccorr) UNUSED(buf)
#undef UNUSED #undef UNUSED

@ -505,7 +505,7 @@ namespace cv
char* binary = (char*)malloc(binarySize); char* binary = (char*)malloc(binarySize);
if(binary == NULL) if(binary == NULL)
{ {
CV_Error(CV_StsNoMem, "Failed to allocate host memory."); CV_Error(Error::StsNoMem, "Failed to allocate host memory.");
} }
openCLSafeCall(clGetProgramInfo(program, openCLSafeCall(clGetProgramInfo(program,
CL_PROGRAM_BINARIES, CL_PROGRAM_BINARIES,

@ -407,7 +407,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum[3]) ); args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sum[3]) );
break; break;
default: default:
CV_Error(CV_StsBadArg, "matchTemplate: unsupported number of channels"); CV_Error(Error::StsBadArg, "matchTemplate: unsupported number of channels");
break; break;
} }
} }
@ -513,7 +513,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sqsum_sum) ); args.push_back( std::make_pair( sizeof(cl_float), (void *)&templ_sqsum_sum) );
break; break;
default: default:
CV_Error(CV_StsBadArg, "matchTemplate: unsupported number of channels"); CV_Error(Error::StsBadArg, "matchTemplate: unsupported number of channels");
break; break;
} }
} }

@ -106,7 +106,7 @@ static void convert_C3C4(const cl_mem &src, oclMat &dst)
sprintf(compile_option, "-D GENTYPE4=double4"); sprintf(compile_option, "-D GENTYPE4=double4");
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src));
@ -154,7 +154,7 @@ static void convert_C4C3(const oclMat &src, cl_mem &dst)
sprintf(compile_option, "-D GENTYPE4=double4"); sprintf(compile_option, "-D GENTYPE4=double4");
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
@ -464,7 +464,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval )); args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_8S: case CV_8S:
@ -483,7 +483,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval )); args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16U: case CV_16U:
@ -502,7 +502,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval )); args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16S: case CV_16S:
@ -521,7 +521,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval )); args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32S: case CV_32S:
@ -547,7 +547,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival )); args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32F: case CV_32F:
@ -566,7 +566,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval )); args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_64F: case CV_64F:
@ -585,11 +585,11 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, Stri
args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval )); args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
#ifdef CL_VERSION_1_2 #ifdef CL_VERSION_1_2
if(dst.offset == 0 && dst.cols == dst.wholecols) if(dst.offset == 0 && dst.cols == dst.wholecols)
@ -656,7 +656,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval )); args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_8S: case CV_8S:
@ -675,7 +675,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval )); args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16U: case CV_16U:
@ -694,7 +694,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval )); args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_16S: case CV_16S:
@ -713,7 +713,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval )); args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32S: case CV_32S:
@ -732,7 +732,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival )); args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_32F: case CV_32F:
@ -751,7 +751,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval )); args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case CV_64F: case CV_64F:
@ -770,11 +770,11 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o
args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval )); args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst.data )); args.push_back( std::make_pair( sizeof(cl_mem) , (void *)&dst.data ));
args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst.cols )); args.push_back( std::make_pair( sizeof(cl_int) , (void *)&dst.cols ));
@ -824,13 +824,8 @@ oclMat &cv::ocl::oclMat::setTo(const Scalar &scalar, const oclMat &mask)
oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
{ {
if( new_rows != 0 && new_rows != rows) if( new_rows != 0 && new_rows != rows)
{ {
CV_Error( Error::StsBadFunc, "oclMat's number of rows can not be changed for current version" );
CV_Error( CV_StsBadFunc,
"oclMat's number of rows can not be changed for current version" );
} }
oclMat hdr = *this; oclMat hdr = *this;
@ -863,13 +858,13 @@ oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
if (!isContinuous()) if (!isContinuous())
CV_Error(CV_BadStep, "The matrix is not continuous, thus its number of rows can not be changed"); CV_Error(Error::BadStep, "The matrix is not continuous, thus its number of rows can not be changed");
if ((unsigned)new_rows > (unsigned)total_size) if ((unsigned)new_rows > (unsigned)total_size)
CV_Error(CV_StsOutOfRange, "Bad new number of rows"); CV_Error(Error::StsOutOfRange, "Bad new number of rows");
@ -879,7 +874,7 @@ oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
if (total_width * new_rows != total_size) if (total_width * new_rows != total_size)
CV_Error(CV_StsBadArg, "The total number of matrix elements is not divisible by the new number of rows"); CV_Error(Error::StsBadArg, "The total number of matrix elements is not divisible by the new number of rows");
@ -897,7 +892,7 @@ oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
if (new_width * new_cn != total_width) if (new_width * new_cn != total_width)
CV_Error(CV_BadNumChannels, "The total width is not divisible by the new number of channels"); CV_Error(Error::BadNumChannels, "The total width is not divisible by the new number of channels");

@ -44,7 +44,6 @@
// //
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <iostream> #include <iostream>
@ -54,6 +53,7 @@ namespace ocl
{ {
extern const char *moments; extern const char *moments;
#if 0
// The function calculates center of gravity and the central second order moments // The function calculates center of gravity and the central second order moments
static void icvCompleteMomentState( CvMoments* moments ) static void icvCompleteMomentState( CvMoments* moments )
{ {
@ -334,13 +334,21 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary )
icvCompleteMomentState( mom ); icvCompleteMomentState( mom );
} }
#endif
Moments ocl_moments( InputArray _array, bool binaryImage ) Moments ocl_moments( InputArray _array, bool binaryImage )
{ {
#if 0
CvMoments om; CvMoments om;
Mat arr = _array.getMat(); Mat arr = _array.getMat();
CvMat c_array = arr; CvMat c_array = arr;
ocl_cvMoments(&c_array, &om, binaryImage); ocl_cvMoments(&c_array, &om, binaryImage);
return om; return om;
#endif
CV_Error(Error::StsNotImplemented, "ocl_moments is not implemented");
(void)_array;
(void)binaryImage;
return Moments();
} }
} }

@ -226,7 +226,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval )); args.push_back( std::make_pair( sizeof(cl_uchar4) , (void *)&val.uval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 1: case 1:
@ -245,7 +245,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval )); args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 2: case 2:
@ -264,7 +264,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval )); args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 3: case 3:
@ -283,7 +283,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval )); args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 4: case 4:
@ -309,7 +309,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival )); args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 5: case 5:
@ -328,7 +328,7 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval )); args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
case 6: case 6:
@ -347,11 +347,11 @@ static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar,
args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval )); args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval ));
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels"); CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
} }
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth"); CV_Error(Error::StsUnsupportedFormat, "unknown depth");
} }
#ifdef CL_VERSION_1_2 #ifdef CL_VERSION_1_2
if(dst.offset == 0 && dst.cols == dst.wholecols) if(dst.offset == 0 && dst.cols == dst.wholecols)
@ -465,7 +465,7 @@ static void arithmetic_run(const oclMat &src1, oclMat &dst, String kernelName, c
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }

@ -65,13 +65,12 @@ namespace cv
{ {
namespace ocl namespace ocl
{ {
void error( const char *error_string, const char *file, const int line, const char *func = "");
const char *getOpenCLErrorString( int err ); const char *getOpenCLErrorString( int err );
static inline void ___openCLSafeCall(int err, const char *file, const int line, const char *func = "") static inline void ___openCLSafeCall(int err, const char *file, const int line, const char *func = "")
{ {
if( CL_SUCCESS != err) if( CL_SUCCESS != err)
cv::ocl::error(getOpenCLErrorString(err), file, line, func); cv::error(Error::OpenCLApiCallError, getOpenCLErrorString(err), func, file, line);
} }
} }
} }

@ -127,7 +127,7 @@ namespace cv
{ {
if(!mat_dst.clCxt->supportsFeature(Context::CL_DOUBLE) && mat_dst.type() == CV_64F) if(!mat_dst.clCxt->supportsFeature(Context::CL_DOUBLE) && mat_dst.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }
@ -276,7 +276,7 @@ namespace cv
if(!mat_src.clCxt->supportsFeature(Context::CL_DOUBLE) && mat_src.type() == CV_64F) if(!mat_src.clCxt->supportsFeature(Context::CL_DOUBLE) && mat_src.type() == CV_64F)
{ {
CV_Error(CV_GpuNotSupported, "Selected device don't support double\r\n"); CV_Error(Error::GpuNotSupported, "Selected device don't support double\r\n");
return; return;
} }

@ -113,9 +113,6 @@ static void stereo_bm(const oclMat &left, const oclMat &right, oclMat &disp,
{ {
int winsz2 = winSize >> 1; int winsz2 = winSize >> 1;
//if(winsz2 == 0 || winsz2 >= calles_num)
//cv::ocl:error("Unsupported window size", __FILE__, __LINE__, __FUNCTION__);
Context *clCxt = left.clCxt; Context *clCxt = left.clCxt;
String kernelName = "stereoKernel"; String kernelName = "stereoKernel";

@ -46,7 +46,7 @@
#include "opencv2/objdetect.hpp" #include "opencv2/objdetect.hpp"
#include "precomp.hpp" #include "precomp.hpp"
#ifdef HAVE_OPENCL #if 0 //def HAVE_OPENCL
using namespace cvtest; using namespace cvtest;
using namespace testing; using namespace testing;

@ -220,10 +220,10 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::TermCriteria crit) void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::TermCriteria crit)
{ {
if( src_roi.empty() ) if( src_roi.empty() )
CV_Error( CV_StsBadArg, "The input image is empty" ); CV_Error(cv::Error::StsBadArg, "The input image is empty" );
if( src_roi.depth() != CV_8U || src_roi.channels() != 4 ) if( src_roi.depth() != CV_8U || src_roi.channels() != 4 )
CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); CV_Error(cv::Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
CV_Assert( (src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) ); CV_Assert( (src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) );
CV_Assert( !(dst_roi.step & 0x3) ); CV_Assert( !(dst_roi.step & 0x3) );
@ -259,9 +259,9 @@ void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, int sp,
{ {
if( src_roi.empty() ) if( src_roi.empty() )
CV_Error( CV_StsBadArg, "The input image is empty" ); CV_Error(cv::Error::StsBadArg, "The input image is empty" );
if( src_roi.depth() != CV_8U || src_roi.channels() != 4 ) if( src_roi.depth() != CV_8U || src_roi.channels() != 4 )
CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" ); CV_Error(cv::Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
CV_Assert( (src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) && CV_Assert( (src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) &&
(src_roi.cols == dstCoor_roi.cols) && (src_roi.rows == dstCoor_roi.rows)); (src_roi.cols == dstCoor_roi.cols) && (src_roi.rows == dstCoor_roi.rows));
CV_Assert( !(dstCoor_roi.step & 0x3) ); CV_Assert( !(dstCoor_roi.step & 0x3) );

@ -1,6 +1,5 @@
#include "precomp.hpp" #include "precomp.hpp"
#include <iomanip> #include <iomanip>
#include "opencv2/imgproc/imgproc_c.h"
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
@ -47,11 +46,11 @@ TEST_P(ocl_Moments, Mat)
{ {
Mat src = imread( workdir + "../cpp/pic3.png", 1 ); Mat src = imread( workdir + "../cpp/pic3.png", 1 );
Mat src_gray, canny_output; Mat src_gray, canny_output;
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
vector<vector<Point> > contours; vector<vector<Point> > contours;
vector<Vec4i> hierarchy; vector<Vec4i> hierarchy;
Canny( src_gray, canny_output, 100, 200, 3 ); Canny( src_gray, canny_output, 100, 200, 3 );
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
for( size_t i = 0; i < contours.size(); i++ ) for( size_t i = 0; i < contours.size(); i++ )
{ {
Moments m = moments( contours[i], false ); Moments m = moments( contours[i], false );

@ -41,6 +41,8 @@
#ifndef __OPENCV_TEST_UTILITY_HPP__ #ifndef __OPENCV_TEST_UTILITY_HPP__
#define __OPENCV_TEST_UTILITY_HPP__ #define __OPENCV_TEST_UTILITY_HPP__
#include "opencv2/core.hpp"
#define LOOP_TIMES 1 #define LOOP_TIMES 1
#define MWIDTH 256 #define MWIDTH 256
#define MHEIGHT 256 #define MHEIGHT 256
@ -137,7 +139,7 @@ CV_ENUM(NormCode, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_TYPE_MASK, cv
enum {FLIP_BOTH = 0, FLIP_X = 1, FLIP_Y = -1}; enum {FLIP_BOTH = 0, FLIP_X = 1, FLIP_Y = -1};
CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y) CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y)
CV_ENUM(ReduceOp, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN) CV_ENUM(ReduceOp, cv::REDUCE_SUM, cv::REDUCE_AVG, cv::REDUCE_MAX, cv::REDUCE_MIN)
CV_FLAGS(GemmFlags, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T); CV_FLAGS(GemmFlags, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T);

@ -10,6 +10,10 @@
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
int main( int, const char** ) { return 0; }
#if 0
using namespace std; using namespace std;
using namespace cv; using namespace cv;
@ -26,6 +30,8 @@ static void help()
"Hit any key to quit.\n" "Hit any key to quit.\n"
"Using OpenCV version " << CV_VERSION << "\n" << endl; "Using OpenCV version " << CV_VERSION << "\n" << endl;
} }
struct getRect { Rect operator ()(const CvAvgComp& e) const { return e.rect; } }; struct getRect { Rect operator ()(const CvAvgComp& e) const { return e.rect; } };
void detectAndDraw( Mat& img, void detectAndDraw( Mat& img,
cv::ocl::OclCascadeClassifier& cascade, CascadeClassifier& nestedCascade, cv::ocl::OclCascadeClassifier& cascade, CascadeClassifier& nestedCascade,
@ -230,3 +236,4 @@ void detectAndDraw( Mat& img,
} }
cv::imshow( "result", img ); cv::imshow( "result", img );
} }
#endif

@ -326,7 +326,7 @@ void App::run()
for (size_t i = 0; i < found.size(); i++) for (size_t i = 0; i < found.size(); i++)
{ {
Rect r = found[i]; Rect r = found[i];
rectangle(img_to_show, r.tl(), r.br(), CV_RGB(0, 255, 0), 3); rectangle(img_to_show, r.tl(), r.br(), Scalar(0, 255, 0), 3);
} }
if (use_gpu) if (use_gpu)

@ -137,7 +137,7 @@ static void drawSquares( Mat& image, const vector<vector<Point> >& squares )
{ {
const Point* p = &squares[i][0]; const Point* p = &squares[i][0];
int n = (int)squares[i].size(); int n = (int)squares[i].size();
polylines(image, &p, &n, 1, true, Scalar(0,255,0), 3, CV_AA); polylines(image, &p, &n, 1, true, Scalar(0,255,0), 3, LINE_AA);
} }
imshow(wndname, image); imshow(wndname, image);

@ -211,8 +211,8 @@ int main(int argc, char* argv[])
//-- Get the corners from the image_1 ( the object to be "detected" ) //-- Get the corners from the image_1 ( the object to be "detected" )
std::vector<Point2f> obj_corners(4); std::vector<Point2f> obj_corners(4);
obj_corners[0] = cvPoint(0,0); obj_corners[1] = cvPoint( cpu_img1.cols, 0 ); obj_corners[0] = Point(0,0); obj_corners[1] = Point( cpu_img1.cols, 0 );
obj_corners[2] = cvPoint( cpu_img1.cols, cpu_img1.rows ); obj_corners[3] = cvPoint( 0, cpu_img1.rows ); obj_corners[2] = Point( cpu_img1.cols, cpu_img1.rows ); obj_corners[3] = Point( 0, cpu_img1.rows );
std::vector<Point2f> scene_corners(4); std::vector<Point2f> scene_corners(4);
perspectiveTransform( obj_corners, scene_corners, H); perspectiveTransform( obj_corners, scene_corners, H);

Loading…
Cancel
Save