From e2bbe7597b229bb891693a5b307b288ff756454e Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 18 Nov 2013 13:48:04 -0500 Subject: [PATCH] fixed few compile errors and doc build errors --- cmake/OpenCVModule.cmake | 2 +- cmake/cl2cpp.cmake | 2 +- modules/core/src/matrix.cpp | 64 +++++++++++----------- modules/core/src/opencl/arithm.cl | 4 -- modules/core/src/opencl/copyset.cl | 1 - modules/core/src/umatrix.cpp | 12 ++-- .../doc/reading_and_writing_images_and_video.rst | 6 +- modules/imgproc/src/opencl/resize.cl | 1 - modules/objdetect/doc/cascade_classification.rst | 4 +- samples/cpp/ufacedetect.cpp | 4 +- samples/ocl/facedetect.cpp | 8 +-- 11 files changed, 52 insertions(+), 56 deletions(-) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index ffc998a..c07a2b8 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -499,7 +499,7 @@ macro(ocv_glob_module_sources) source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs}) file(GLOB cl_kernels "src/opencl/*.cl") - if(HAVE_opencv_ocl AND cl_kernels) + if(cl_kernels) ocv_include_directories(${OPENCL_INCLUDE_DIRS}) string(REGEX REPLACE "opencv_" "" the_module_barename "${the_module}") add_custom_command( diff --git a/cmake/cl2cpp.cmake b/cmake/cl2cpp.cmake index 17a9e09..24d3eb2 100644 --- a/cmake/cl2cpp.cmake +++ b/cmake/cl2cpp.cmake @@ -10,7 +10,7 @@ if("${MODULE_NAME}" STREQUAL "ocl") else() set(new_mode ON) set(nested_namespace_start "namespace ${MODULE_NAME}\n{") - set(nested_namespace_end "}") + set(nested_namespace_end "}") endif() set(STR_CPP "// This file is auto-generated. Do not edit! diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 263c0f6..cb5d7e4 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -1437,7 +1437,7 @@ Size _InputArray::size(int i) const } -int _InputArray::sizend(int* sz, int i) const +int _InputArray::sizend(int* arrsz, int i) const { int j, d=0, k = kind(); @@ -1448,18 +1448,18 @@ int _InputArray::sizend(int* sz, int i) const CV_Assert( i < 0 ); const Mat& m = *(const Mat*)obj; d = m.dims; - if(sz) + if(arrsz) for(j = 0; j < d; j++) - sz[j] = m.size.p[j]; + arrsz[j] = m.size.p[j]; } else if( k == UMAT ) { CV_Assert( i < 0 ); const UMat& m = *(const UMat*)obj; d = m.dims; - if(sz) + if(arrsz) for(j = 0; j < d; j++) - sz[j] = m.size.p[j]; + arrsz[j] = m.size.p[j]; } else if( k == STD_VECTOR_MAT && i >= 0 ) { @@ -1467,9 +1467,9 @@ int _InputArray::sizend(int* sz, int i) const CV_Assert( i < (int)vv.size() ); const Mat& m = vv[i]; d = m.dims; - if(sz) + if(arrsz) for(j = 0; j < d; j++) - sz[j] = m.size.p[j]; + arrsz[j] = m.size.p[j]; } else if( k == STD_VECTOR_UMAT && i >= 0 ) { @@ -1477,18 +1477,18 @@ int _InputArray::sizend(int* sz, int i) const CV_Assert( i < (int)vv.size() ); const UMat& m = vv[i]; d = m.dims; - if(sz) + if(arrsz) for(j = 0; j < d; j++) - sz[j] = m.size.p[j]; + arrsz[j] = m.size.p[j]; } else { Size sz2d = size(i); d = 2; - if(sz) + if(arrsz) { - sz[0] = sz2d.height; - sz[1] = sz2d.width; + arrsz[0] = sz2d.height; + arrsz[1] = sz2d.width; } } @@ -1597,12 +1597,12 @@ int _InputArray::dims(int i) const CV_Assert( i < 0 ); return 2; } - + if( k == OCL_MAT ) { return 2; } - + CV_Assert( k == CUDA_MEM ); //if( k == CUDA_MEM ) { @@ -1895,7 +1895,7 @@ void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransp create(2, sizes, mtype, i, allowTransposed, fixedDepthMask); } -void _OutputArray::create(int dims, const int* sizes, int mtype, int i, +void _OutputArray::create(int d, const int* sizes, int mtype, int i, bool allowTransposed, int fixedDepthMask) const { int k = kind(); @@ -1913,7 +1913,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, m.release(); } - if( dims == 2 && m.dims == 2 && m.data && + if( d == 2 && m.dims == 2 && m.data && m.type() == mtype && m.rows == sizes[1] && m.cols == sizes[0] ) return; } @@ -1927,11 +1927,11 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, } if(fixedSize()) { - CV_Assert(m.dims == dims); - for(int j = 0; j < dims; ++j) + CV_Assert(m.dims == d); + for(int j = 0; j < d; ++j) CV_Assert(m.size[j] == sizes[j]); } - m.create(dims, sizes, mtype); + m.create(d, sizes, mtype); return; } @@ -1947,7 +1947,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, m.release(); } - if( dims == 2 && m.dims == 2 && !m.empty() && + if( d == 2 && m.dims == 2 && !m.empty() && m.type() == mtype && m.rows == sizes[1] && m.cols == sizes[0] ) return; } @@ -1961,11 +1961,11 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, } if(fixedSize()) { - CV_Assert(m.dims == dims); - for(int j = 0; j < dims; ++j) + CV_Assert(m.dims == d); + for(int j = 0; j < d; ++j) CV_Assert(m.size[j] == sizes[j]); } - m.create(dims, sizes, mtype); + m.create(d, sizes, mtype); return; } @@ -1974,14 +1974,14 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, CV_Assert( i < 0 ); int type0 = CV_MAT_TYPE(flags); CV_Assert( mtype == type0 || (CV_MAT_CN(mtype) == 1 && ((1 << type0) & fixedDepthMask) != 0) ); - CV_Assert( dims == 2 && ((sizes[0] == sz.height && sizes[1] == sz.width) || + CV_Assert( d == 2 && ((sizes[0] == sz.height && sizes[1] == sz.width) || (allowTransposed && sizes[0] == sz.width && sizes[1] == sz.height))); return; } if( k == STD_VECTOR || k == STD_VECTOR_VECTOR ) { - CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) ); + CV_Assert( d == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) ); size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0; std::vector* v = (std::vector*)obj; @@ -2073,7 +2073,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, if( i < 0 ) { - CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) ); + CV_Assert( d == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) ); size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0, len0 = v.size(); CV_Assert(!fixedSize() || len == len0); @@ -2103,7 +2103,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, m.release(); } - if( dims == 2 && m.dims == 2 && m.data && + if( d == 2 && m.dims == 2 && m.data && m.type() == mtype && m.rows == sizes[1] && m.cols == sizes[0] ) return; } @@ -2117,12 +2117,12 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, } if(fixedSize()) { - CV_Assert(m.dims == dims); - for(int j = 0; j < dims; ++j) + CV_Assert(m.dims == d); + for(int j = 0; j < d; ++j) CV_Assert(m.size[j] == sizes[j]); } - m.create(dims, sizes, mtype); + m.create(d, sizes, mtype); return; } @@ -2131,8 +2131,8 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, void _OutputArray::createSameSize(const _InputArray& arr, int mtype) const { - int sz[CV_MAX_DIM], d = arr.sizend(sz); - create(d, sz, mtype); + int arrsz[CV_MAX_DIM], d = arr.sizend(arrsz); + create(d, arrsz, mtype); } void _OutputArray::release() const diff --git a/modules/core/src/opencl/arithm.cl b/modules/core/src/opencl/arithm.cl index 90fbace..baba41a 100644 --- a/modules/core/src/opencl/arithm.cl +++ b/modules/core/src/opencl/arithm.cl @@ -301,7 +301,3 @@ __kernel void KF(__global const uchar* srcptr1, int srcstep1, int srcoffset1, #error "Unknown operation type" #endif - - - - diff --git a/modules/core/src/opencl/copyset.cl b/modules/core/src/opencl/copyset.cl index 9b73616..df5bdf5 100644 --- a/modules/core/src/opencl/copyset.cl +++ b/modules/core/src/opencl/copyset.cl @@ -71,4 +71,3 @@ __kernel void set(__global uchar* dstptr, int dststep, int dstoffset, *(dstT*)(dstptr + dst_index) = value; } } - diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index 46f03b9..9a5772f 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -174,8 +174,8 @@ static void updateContinuityFlag(UMat& m) break; } - uint64 t = (uint64)m.step[0]*m.size[0]; - if( j <= i && t == (size_t)t ) + uint64 total = (uint64)m.step[0]*m.size[0]; + if( j <= i && total == (size_t)total ) m.flags |= UMat::CONTINUOUS_FLAG; else m.flags &= ~UMat::CONTINUOUS_FLAG; @@ -638,21 +638,21 @@ void UMat::convertTo(OutputArray, int, double, double) const UMat& UMat::setTo(InputArray _value, InputArray _mask) { bool haveMask = !_mask.empty(); - int t = type(), cn = CV_MAT_CN(t); + int tp = type(), cn = CV_MAT_CN(tp); if( dims <= 2 && cn <= 4 && ocl::useOpenCL() ) { Mat value = _value.getMat(); CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::UMAT) ); double buf[4]; - convertAndUnrollScalar(value, t, (uchar*)buf, 1); + convertAndUnrollScalar(value, tp, (uchar*)buf, 1); char opts[1024]; - sprintf(opts, "-D dstT=%s", ocl::memopTypeToStr(t)); + sprintf(opts, "-D dstT=%s", ocl::memopTypeToStr(tp)); ocl::Kernel setK(haveMask ? "setMask" : "set", ocl::core::copyset_oclsrc, opts); if( !setK.empty() ) { - ocl::KernelArg scalararg(0, 0, 0, buf, CV_ELEM_SIZE(t)); + ocl::KernelArg scalararg(0, 0, 0, buf, CV_ELEM_SIZE(tp)); UMat mask; if( haveMask ) diff --git a/modules/highgui/doc/reading_and_writing_images_and_video.rst b/modules/highgui/doc/reading_and_writing_images_and_video.rst index 6b956b4..95d3e05 100644 --- a/modules/highgui/doc/reading_and_writing_images_and_video.rst +++ b/modules/highgui/doc/reading_and_writing_images_and_video.rst @@ -320,7 +320,7 @@ VideoCapture::retrieve ---------------------- Decodes and returns the grabbed video frame. -.. ocv:function:: bool VideoCapture::retrieve( Mat& image, int flag=0 ) +.. ocv:function:: bool VideoCapture::retrieve( OutputArray image, int flag=0 ) .. ocv:pyfunction:: cv2.VideoCapture.retrieve([image[, flag]]) -> retval, image @@ -337,7 +337,9 @@ Grabs, decodes and returns the next video frame. .. ocv:function:: VideoCapture& VideoCapture::operator >> (Mat& image) -.. ocv:function:: bool VideoCapture::read(Mat& image) +.. ocv:function:: VideoCapture& VideoCapture::operator >> (UMat& image) + +.. ocv:function:: bool VideoCapture::read(OutputArray image) .. ocv:pyfunction:: cv2.VideoCapture.read([image]) -> retval, image diff --git a/modules/imgproc/src/opencl/resize.cl b/modules/imgproc/src/opencl/resize.cl index c53afd7..0805246 100644 --- a/modules/imgproc/src/opencl/resize.cl +++ b/modules/imgproc/src/opencl/resize.cl @@ -149,4 +149,3 @@ __kernel void resizeNN(__global const uchar* srcptr, int srcstep, int srcoffset, } #endif - diff --git a/modules/objdetect/doc/cascade_classification.rst b/modules/objdetect/doc/cascade_classification.rst index 453f052..b7a9862 100644 --- a/modules/objdetect/doc/cascade_classification.rst +++ b/modules/objdetect/doc/cascade_classification.rst @@ -188,8 +188,8 @@ CascadeClassifier::detectMultiScale --------------------------------------- Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. -.. ocv:function:: void CascadeClassifier::detectMultiScale( const Mat& image, vector& objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) -.. ocv:function:: void CascadeClassifier::detectMultiScale( const Mat& image, vector& objects, vector& numDetections, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) +.. ocv:function:: void CascadeClassifier::detectMultiScale( InputArray image, vector& objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) +.. ocv:function:: void CascadeClassifier::detectMultiScale( InputArray image, vector& objects, vector& numDetections, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) .. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects .. ocv:pyfunction:: cv2.CascadeClassifier.detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) -> objects, rejectLevels, levelWeights diff --git a/samples/cpp/ufacedetect.cpp b/samples/cpp/ufacedetect.cpp index 01ba510..9cd6b3a 100644 --- a/samples/cpp/ufacedetect.cpp +++ b/samples/cpp/ufacedetect.cpp @@ -203,7 +203,7 @@ void detectAndDraw( UMat& img, Mat& canvas, CascadeClassifier& cascade, resize( gray, smallImg, Size(), scale0, scale0, INTER_LINEAR ); cvtColor(smallImg, canvas, COLOR_GRAY2BGR); equalizeHist( smallImg, smallImg ); - + cascade.detectMultiScale( smallImg, faces, 1.1, 2, 0 //|CASCADE_FIND_BIGGEST_OBJECT @@ -233,7 +233,7 @@ void detectAndDraw( UMat& img, Mat& canvas, CascadeClassifier& cascade, putText(canvas, format("OpenCL: %s, fps: %.1f", ocl::useOpenCL() ? "ON" : "OFF", fps), Point(250, 50), FONT_HERSHEY_SIMPLEX, 1, Scalar(0,255,0), 3); - + for( vector::const_iterator r = faces.begin(); r != faces.end(); r++, i++ ) { vector nestedObjects; diff --git a/samples/ocl/facedetect.cpp b/samples/ocl/facedetect.cpp index 3786115..182dc1e 100644 --- a/samples/ocl/facedetect.cpp +++ b/samples/ocl/facedetect.cpp @@ -46,12 +46,12 @@ static double getTime() static void detect( Mat& img, vector& faces, ocl::OclCascadeClassifier& cascade, - double scale, bool calTime); + double scale); static void detectCPU( Mat& img, vector& faces, CascadeClassifier& cascade, - double scale, bool calTime); + double scale); static void Draw(Mat& img, vector& faces, double scale); @@ -190,7 +190,7 @@ int main( int argc, const char** argv ) void detect( Mat& img, vector& faces, ocl::OclCascadeClassifier& cascade, - double scale, bool calTime) + double scale) { ocl::oclMat image(img); ocl::oclMat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); @@ -208,7 +208,7 @@ void detect( Mat& img, vector& faces, void detectCPU( Mat& img, vector& faces, CascadeClassifier& cascade, - double scale, bool calTime) + double scale) { workBegin(); Mat cpu_gray, cpu_smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); -- 2.7.4