From 092d058d06e35bb4b53eb0d8c5940a2cec3012e7 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 4 Feb 2014 21:19:31 +0400 Subject: [PATCH] fixed warnings from OCL and DOC builders --- modules/nonfree/doc/feature_detection.rst | 102 ------------------------------ modules/nonfree/src/surf.ocl.cpp | 8 +-- 2 files changed, 4 insertions(+), 106 deletions(-) diff --git a/modules/nonfree/doc/feature_detection.rst b/modules/nonfree/doc/feature_detection.rst index dc43c8b..22c1d97 100644 --- a/modules/nonfree/doc/feature_detection.rst +++ b/modules/nonfree/doc/feature_detection.rst @@ -246,105 +246,3 @@ The class ``SURF_CUDA`` uses some buffers and provides access to it. All buffers .. note:: * An example for using the SURF keypoint matcher on GPU can be found at opencv_source_code/samples/gpu/surf_keypoint_matcher.cpp - -ocl::SURF_OCL -------------- -.. ocv:class:: ocl::SURF_OCL - -Class used for extracting Speeded Up Robust Features (SURF) from an image. :: - - class SURF_OCL - { - public: - enum KeypointLayout - { - X_ROW = 0, - Y_ROW, - LAPLACIAN_ROW, - OCTAVE_ROW, - SIZE_ROW, - ANGLE_ROW, - HESSIAN_ROW, - ROWS_COUNT - }; - - //! the default constructor - SURF_OCL(); - //! the full constructor taking all the necessary parameters - explicit SURF_OCL(double _hessianThreshold, int _nOctaves=4, - int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f, bool _upright = false); - - //! returns the descriptor size in float's (64 or 128) - int descriptorSize() const; - - //! upload host keypoints to device memory - void uploadKeypoints(const vector& keypoints, - oclMat& keypointsocl); - //! download keypoints from device to host memory - void downloadKeypoints(const oclMat& keypointsocl, - vector& keypoints); - - //! download descriptors from device to host memory - void downloadDescriptors(const oclMat& descriptorsocl, - vector& descriptors); - - void operator()(const oclMat& img, const oclMat& mask, - oclMat& keypoints); - - void operator()(const oclMat& img, const oclMat& mask, - oclMat& keypoints, oclMat& descriptors, - bool useProvidedKeypoints = false); - - void operator()(const oclMat& img, const oclMat& mask, - std::vector& keypoints); - - void operator()(const oclMat& img, const oclMat& mask, - std::vector& keypoints, oclMat& descriptors, - bool useProvidedKeypoints = false); - - void operator()(const oclMat& img, const oclMat& mask, - std::vector& keypoints, - std::vector& descriptors, - bool useProvidedKeypoints = false); - - void releaseMemory(); - - // SURF parameters - double hessianThreshold; - int nOctaves; - int nOctaveLayers; - bool extended; - bool upright; - - //! max keypoints = min(keypointsRatio * img.size().area(), 65535) - float keypointsRatio; - - oclMat sum, mask1, maskSum, intBuffer; - - oclMat det, trace; - - oclMat maxPosBuffer; - }; - - -The class ``SURF_OCL`` implements Speeded Up Robust Features descriptor. There is a fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option). But the descriptors can also be computed for the user-specified keypoints. Only 8-bit grayscale images are supported. - -The class ``SURF_OCL`` can store results in the GPU and CPU memory. It provides functions to convert results between CPU and GPU version ( ``uploadKeypoints``, ``downloadKeypoints``, ``downloadDescriptors`` ). The format of CPU results is the same as ``SURF`` results. GPU results are stored in ``oclMat``. The ``keypoints`` matrix is :math:`\texttt{nFeatures} \times 7` matrix with the ``CV_32FC1`` type. - -* ``keypoints.ptr(X_ROW)[i]`` contains x coordinate of the i-th feature. -* ``keypoints.ptr(Y_ROW)[i]`` contains y coordinate of the i-th feature. -* ``keypoints.ptr(LAPLACIAN_ROW)[i]`` contains the laplacian sign of the i-th feature. -* ``keypoints.ptr(OCTAVE_ROW)[i]`` contains the octave of the i-th feature. -* ``keypoints.ptr(SIZE_ROW)[i]`` contains the size of the i-th feature. -* ``keypoints.ptr(ANGLE_ROW)[i]`` contain orientation of the i-th feature. -* ``keypoints.ptr(HESSIAN_ROW)[i]`` contains the response of the i-th feature. - -The ``descriptors`` matrix is :math:`\texttt{nFeatures} \times \texttt{descriptorSize}` matrix with the ``CV_32FC1`` type. - -The class ``SURF_OCL`` uses some buffers and provides access to it. All buffers can be safely released between function calls. - -.. seealso:: :ocv:class:`SURF` - -.. note:: - - * OCL : An example of the SURF detector can be found at opencv_source_code/samples/ocl/surf_matcher.cpp diff --git a/modules/nonfree/src/surf.ocl.cpp b/modules/nonfree/src/surf.ocl.cpp index bf5db6c..2304c36 100644 --- a/modules/nonfree/src/surf.ocl.cpp +++ b/modules/nonfree/src/surf.ocl.cpp @@ -373,8 +373,8 @@ bool SURF_OCL::calcLayerDetAndTrace(int octave, int c_layer_rows) size_t localThreads[] = {16, 16}; size_t globalThreads[] = { - divUp(max_samples_j, localThreads[0]) *localThreads[0], - divUp(max_samples_i, localThreads[1]) *localThreads[1] *(nOctaveLayers + 2) + divUp(max_samples_j, (int)localThreads[0]) * localThreads[0], + divUp(max_samples_i, (int)localThreads[1]) * localThreads[1] * (nOctaveLayers + 2) }; ocl::Kernel kerCalcDetTrace("SURF_calcLayerDetAndTrace", ocl::nonfree::surf_oclsrc, kerOpts); if(haveImageSupport) @@ -405,8 +405,8 @@ bool SURF_OCL::findMaximaInLayer(int counterOffset, int octave, size_t localThreads[3] = {16, 16}; size_t globalThreads[3] = { - divUp(layer_cols - 2 * min_margin, localThreads[0] - 2) *localThreads[0], - divUp(layer_rows - 2 * min_margin, localThreads[1] - 2) *nOctaveLayers *localThreads[1] + divUp(layer_cols - 2 * min_margin, (int)localThreads[0] - 2) * localThreads[0], + divUp(layer_rows - 2 * min_margin, (int)localThreads[1] - 2) * nOctaveLayers * localThreads[1] }; ocl::Kernel kerFindMaxima("SURF_findMaximaInLayer", ocl::nonfree::surf_oclsrc, kerOpts); -- 2.7.4