Remove C API from OpenCL module

This commit is contained in:
Andrey Kamaev 2013-04-12 14:12:12 +04:00
parent 4296b456e5
commit 8406312571
39 changed files with 181 additions and 204 deletions

View File

@ -13,6 +13,13 @@ else(APPLE)
DOC "OpenCL root directory"
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
NAMES OpenCL/cl.h CL/cl.h
HINTS ${OPENCL_ROOT_DIR}
@ -25,6 +32,13 @@ else(APPLE)
set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86)
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
NAMES OpenCL
HINTS ${OPENCL_ROOT_DIR}

View File

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

View File

@ -3,5 +3,4 @@ if(BUILD_ANDROID_PACKAGE)
endif()
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)

View File

@ -182,7 +182,7 @@ public:
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
// temp fix for missing min overload
//oclMat temp(mask.size(), mask.type());

View File

@ -131,9 +131,6 @@ namespace cv
//getDevice also need to be called before this function
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 ////////////////////////
//This is a global singleton class used to represent a OpenCL context.
class CV_EXPORTS Context
@ -811,7 +808,8 @@ namespace cv
///////////////////////////////////////////CascadeClassifier//////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CV_EXPORTS_W OclCascadeClassifier : public cv::CascadeClassifier
#if 0
class CV_EXPORTS OclCascadeClassifier : public cv::CascadeClassifier
{
public:
OclCascadeClassifier() {};
@ -820,6 +818,7 @@ namespace cv
CvSeq* oclHaarDetectObjects(oclMat &gimg, CvMemStorage *storage, double scaleFactor,
int minNeighbors, int flags, CvSize minSize = cvSize(0, 0), CvSize maxSize = cvSize(0, 0));
};
#endif

View File

@ -459,28 +459,28 @@ namespace cv
inline uchar *oclMat::ptr(int y)
{
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;
}
inline const uchar *oclMat::ptr(int y) const
{
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;
}
template<typename _Tp> inline _Tp *oclMat::ptr(int y)
{
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);
}
template<typename _Tp> inline const _Tp *oclMat::ptr(int y) const
{
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);
}

View File

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

View File

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

View File

@ -746,12 +746,12 @@ void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, int sp,
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)
{
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) &&

View File

@ -349,14 +349,3 @@ string abspath(const string &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;
}

View File

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

View File

@ -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)
{
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;
}
@ -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)
{
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;
}
@ -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)
{
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;
}
@ -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)
{
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;
}
@ -433,7 +433,7 @@ static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &ds
};
ArithmeticFuncS func = tab[src1.depth()];
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);
}
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))
{
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;
}
@ -557,7 +557,7 @@ void cv::ocl::compare(const oclMat &src1, const oclMat &src2, oclMat &dst , int
kernelString = &arithm_compare_ne;
break;
default:
CV_Error(CV_StsBadArg, "Unknown comparison method");
CV_Error(Error::StsBadArg, "Unknown comparison method");
}
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)
{
CV_Error(CV_GpuNotSupported, "select device don't support double");
CV_Error(Error::GpuNotSupported, "select device don't support double");
}
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)
{
CV_Error(CV_GpuNotSupported, "select device don't support double");
CV_Error(Error::GpuNotSupported, "select device don't support double");
}
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)
{
CV_Error(CV_GpuNotSupported, "select device don't support double");
CV_Error(Error::GpuNotSupported, "select device don't support double");
}
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);
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] =
{
@ -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)
{
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;
}
@ -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)
{
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;
}
@ -1124,7 +1124,7 @@ static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, String kernel
Context *clCxt = src.clCxt;
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;
}
//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)
{
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;
}
@ -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)
{
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;
}
@ -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)
{
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;
}
@ -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)
{
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;
}
@ -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)
{
CV_Error(CV_GpuNotSupported, "select device don't support double");
CV_Error(Error::GpuNotSupported, "select device don't support double");
}
static minMaxLocFunc functab[2] =
{
@ -1561,7 +1561,7 @@ int cv::ocl::countNonZero(const oclMat &src)
size_t groupnum = src.clCxt->computeUnits();
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);
groupnum = groupnum * 2;
@ -1834,7 +1834,7 @@ static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst,
};
BitwiseFuncS func = tab[src1.depth()];
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);
}
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)
{
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;
}

View File

@ -62,7 +62,7 @@ void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &
oclMat &result)
{
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 depth = img1.depth();
int rows = img1.rows;

View File

@ -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*/,
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;
size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * 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*/,
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;
size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * 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*/,
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;
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};
@ -188,7 +188,7 @@ template < int BLOCK_SIZE/*, typename 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)
{
assert(query.type() == CV_32F);
CV_Assert(query.type() == CV_32F);
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 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
int callType = query.depth();
char cvFuncName[] = "singleMatch";
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
|| 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);
@ -550,8 +549,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchSingle(const oclMat &query, const
distance.create(1, query.rows, CV_32F);
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)
@ -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)
{
assert(mask.empty()); // mask is not supported at the moment
CV_Assert(mask.empty()); // mask is not supported at the moment
oclMat trainIdx, distance;
matchSingle(query, train, trainIdx, distance, mask);
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
int callType = query.depth();
char cvFuncName[] = "matchCollection";
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
|| 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);
@ -672,8 +668,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &query, c
distance.create(1, query.rows, CV_32F);
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)
@ -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
int callType = query.depth();
char cvFuncName[] = "knnMatchSingle";
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
|| 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);
@ -773,8 +766,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatchSingle(const oclMat &query, co
trainIdx.setTo(Scalar::all(-1));
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)
@ -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
int callType = query.depth();
char cvFuncName[] = "radiusMatchSingle";
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
|| 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);
@ -1044,8 +1034,6 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &query,
nMatches.setTo(Scalar::all(0));
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,

View File

@ -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:
*/
default:
CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" );
CV_Error(Error::StsBadFlag, "Unknown/unsupported color conversion code" );
}
}
}

View File

@ -170,21 +170,5 @@ namespace cv
sprintf(buf, "%d", err);
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) );
}
}
}

View File

@ -51,7 +51,7 @@ using namespace cv::ocl;
#if !defined HAVE_CLAMDFFT
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 {
void fft_teardown();

View File

@ -270,7 +270,7 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
sprintf(s, "-D VAL=FLT_MAX -D GENTYPE=float4");
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported type");
CV_Error(Error::StsUnsupportedFormat, "unsupported type");
}
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");
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported type");
CV_Error(Error::StsUnsupportedFormat, "unsupported type");
}
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()))
{
CV_Error(CV_StsBadArg, "unsupported border type");
CV_Error(Error::StsBadArg, "unsupported border type");
}
Mat kernel;
@ -564,7 +564,7 @@ void cv::ocl::morphologyEx(const oclMat &src, oclMat &dst, int op, const Mat &ke
subtract(temp, src, dst);
break;
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");
break;
case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!");
CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return;
case 4:
sprintf(btype, "BORDER_REFLECT_101");
@ -840,7 +840,7 @@ static void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT");
break;
case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!");
CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return;
case 4:
sprintf(btype, "BORDER_REFLECT_101");
@ -902,7 +902,7 @@ static void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT");
break;
case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!");
CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return;
case 4:
sprintf(btype, "BORDER_REFLECT_101");
@ -965,7 +965,7 @@ static void GPUFilterBox_32F_C4R(const oclMat &src, oclMat &dst,
sprintf(btype, "BORDER_REFLECT");
break;
case 3:
CV_Error(CV_StsUnsupportedFormat, "BORDER_WRAP is not supported!");
CV_Error(Error::StsUnsupportedFormat, "BORDER_WRAP is not supported!");
return;
case 4:
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) &&
(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)
{
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;
}
@ -1563,7 +1563,7 @@ void cv::ocl::GaussianBlur(const oclMat &src, oclMat &dst, Size ksize, double si
if ((bordertype != cv::BORDER_CONSTANT) &&
(bordertype != cv::BORDER_REPLICATE))
{
CV_Error(CV_StsBadArg, "unsupported border type");
CV_Error(Error::StsBadArg, "unsupported border type");
}
}
}

View File

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

View File

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

View File

@ -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);
break;
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));
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());
@ -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 };
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 *)&block_hist_size));

View File

@ -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_)
{
// 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())
{

View File

@ -428,7 +428,7 @@ namespace cv
{
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() )
@ -448,7 +448,7 @@ namespace cv
resize_gpu( src, dst, fx, fy, interpolation);
return;
}
CV_Error(CV_StsUnsupportedFormat, "Non-supported interpolation method");
CV_Error(Error::StsUnsupportedFormat, "Non-supported interpolation method");
}
@ -501,7 +501,7 @@ namespace cv
}
else
{
CV_Error(CV_StsUnsupportedFormat, "Non-supported filter length");
CV_Error(Error::StsUnsupportedFormat, "Non-supported filter length");
//String kernelName = "medianFilter";
//args.push_back( std::make_pair( sizeof(cl_int),(void*)&m));
@ -522,7 +522,7 @@ namespace cv
(bordertype != cv::BORDER_CONSTANT) &&
(bordertype != cv::BORDER_REPLICATE))
{
CV_Error(CV_StsBadArg, "unsupported border type");
CV_Error(Error::StsBadArg, "unsupported border type");
}
}
bordertype &= ~cv::BORDER_ISOLATED;
@ -549,7 +549,7 @@ namespace cv
}
if(bordertype_index == sizeof(__bordertype) / sizeof(int))
{
CV_Error(CV_StsBadArg, "unsupported border type");
CV_Error(Error::StsBadArg, "unsupported border type");
}
String kernelName = "copymakeborder";
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_8S:
@ -623,7 +623,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_char4) , (void *)&val.cval ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_16U:
@ -642,7 +642,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_ushort4) , (void *)&val.usval ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_16S:
@ -661,7 +661,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_short4) , (void *)&val.shval ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_32S:
@ -687,7 +687,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_int4) , (void *)&val.ival ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_32F:
@ -706,7 +706,7 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_float4) , (void *)&val.fval ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
case CV_64F:
@ -725,11 +725,11 @@ namespace cv
args.push_back( std::make_pair( sizeof(cl_double4) , (void *)&val.dval ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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);
@ -1021,7 +1021,7 @@ namespace cv
CV_Assert(src.type() == CV_8UC1);
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 offset = src.offset / vlen;
@ -1195,7 +1195,7 @@ namespace cv
{
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);
oclMat Dx, Dy;
@ -1209,7 +1209,7 @@ namespace cv
{
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);
oclMat Dx, Dy;
@ -1256,15 +1256,10 @@ namespace cv
void meanShiftFiltering(const oclMat &src, oclMat &dst, int sp, int sr, TermCriteria criteria)
{
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 )
CV_Error( CV_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");
// }
CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
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)
{
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 )
CV_Error( CV_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");
// }
CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
dstr.create( src.size(), CV_8UC4 );
dstsp.create( src.size(), CV_16SC2 );
@ -1581,8 +1571,7 @@ namespace cv
if( src.depth() == CV_8U )
oclbilateralFilter_8u( src, dst, radius, sigmaclr, sigmaspc, borderType );
else
CV_Error( CV_StsUnsupportedFormat,
"Bilateral filtering is only implemented for 8uimages" );
CV_Error(Error::StsUnsupportedFormat, "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
CV_Error(CV_StsNotImplemented, "OpenCL DFT is not implemented");
CV_Error(Error::StsNotImplemented, "OpenCL DFT is not implemented");
#define UNUSED(x) (void)(x);
UNUSED(image) UNUSED(templ) UNUSED(result) UNUSED(ccorr) UNUSED(buf)
#undef UNUSED

View File

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

View File

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

View File

@ -106,7 +106,7 @@ static void convert_C3C4(const cl_mem &src, oclMat &dst)
sprintf(compile_option, "-D GENTYPE4=double4");
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth");
CV_Error(Error::StsUnsupportedFormat, "unknown depth");
}
std::vector< std::pair<size_t, const void *> > args;
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");
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth");
CV_Error(Error::StsUnsupportedFormat, "unknown depth");
}
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth");
CV_Error(Error::StsUnsupportedFormat, "unknown depth");
}
#ifdef CL_VERSION_1_2
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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_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
{
if( new_rows != 0 && new_rows != rows)
{
CV_Error( CV_StsBadFunc,
"oclMat's number of rows can not be changed for current version" );
CV_Error( Error::StsBadFunc, "oclMat's number of rows can not be changed for current version" );
}
oclMat hdr = *this;
@ -863,13 +858,13 @@ oclMat cv::ocl::oclMat::reshape(int new_cn, int new_rows) const
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)
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)
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)
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");

View File

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

View File

@ -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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
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 ));
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unsupported channels");
CV_Error(Error::StsUnsupportedFormat, "unsupported channels");
}
break;
default:
CV_Error(CV_StsUnsupportedFormat, "unknown depth");
CV_Error(Error::StsUnsupportedFormat, "unknown depth");
}
#ifdef CL_VERSION_1_2
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)
{
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;
}

View File

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

View File

@ -127,7 +127,7 @@ namespace cv
{
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;
}
@ -276,7 +276,7 @@ namespace cv
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;
}

View File

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

View File

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

View File

@ -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)
{
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 )
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( !(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() )
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 )
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) &&
(src_roi.cols == dstCoor_roi.cols) && (src_roi.rows == dstCoor_roi.rows));
CV_Assert( !(dstCoor_roi.step & 0x3) );

View File

@ -1,6 +1,5 @@
#include "precomp.hpp"
#include <iomanip>
#include "opencv2/imgproc/imgproc_c.h"
#ifdef HAVE_OPENCL
@ -47,11 +46,11 @@ TEST_P(ocl_Moments, Mat)
{
Mat src = imread( workdir + "../cpp/pic3.png", 1 );
Mat src_gray, canny_output;
cvtColor( src, src_gray, CV_BGR2GRAY );
cvtColor( src, src_gray, COLOR_BGR2GRAY );
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
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++ )
{
Moments m = moments( contours[i], false );

View File

@ -41,6 +41,8 @@
#ifndef __OPENCV_TEST_UTILITY_HPP__
#define __OPENCV_TEST_UTILITY_HPP__
#include "opencv2/core.hpp"
#define LOOP_TIMES 1
#define MWIDTH 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};
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);

View File

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

View File

@ -326,7 +326,7 @@ void App::run()
for (size_t i = 0; i < found.size(); 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)

View File

@ -137,7 +137,7 @@ static void drawSquares( Mat& image, const vector<vector<Point> >& squares )
{
const Point* p = &squares[i][0];
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);

View File

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