Fix build errors
This commit is contained in:
@@ -88,102 +88,3 @@ Computes a proximity map for a raster template and an image where the template i
|
||||
* ``CV_TM_CCORR``
|
||||
|
||||
.. seealso:: :ocv:func:`matchTemplate`
|
||||
|
||||
|
||||
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<KeyPoint>& keypoints,
|
||||
oclMat& keypointsocl);
|
||||
//! download keypoints from device to host memory
|
||||
void downloadKeypoints(const oclMat& keypointsocl,
|
||||
vector<KeyPoint>& keypoints);
|
||||
|
||||
//! download descriptors from device to host memory
|
||||
void downloadDescriptors(const oclMat& descriptorsocl,
|
||||
vector<float>& 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<KeyPoint>& keypoints);
|
||||
|
||||
void operator()(const oclMat& img, const oclMat& mask,
|
||||
std::vector<KeyPoint>& keypoints, oclMat& descriptors,
|
||||
bool useProvidedKeypoints = false);
|
||||
|
||||
void operator()(const oclMat& img, const oclMat& mask,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
std::vector<float>& 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<float>(X_ROW)[i]`` contains x coordinate of the i-th feature.
|
||||
* ``keypoints.ptr<float>(Y_ROW)[i]`` contains y coordinate of the i-th feature.
|
||||
* ``keypoints.ptr<float>(LAPLACIAN_ROW)[i]`` contains the laplacian sign of the i-th feature.
|
||||
* ``keypoints.ptr<float>(OCTAVE_ROW)[i]`` contains the octave of the i-th feature.
|
||||
* ``keypoints.ptr<float>(SIZE_ROW)[i]`` contains the size of the i-th feature.
|
||||
* ``keypoints.ptr<float>(ANGLE_ROW)[i]`` contain orientation of the i-th feature.
|
||||
* ``keypoints.ptr<float>(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`
|
||||
@@ -58,6 +58,12 @@ namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
enum openCLMemcpyKind
|
||||
{
|
||||
clMemcpyHostToDevice = 0,
|
||||
clMemcpyDeviceToHost,
|
||||
clMemcpyDeviceToDevice
|
||||
};
|
||||
///////////////////////////OpenCL call wrappers////////////////////////////
|
||||
void CV_EXPORTS openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
|
||||
size_t widthInBytes, size_t height);
|
||||
@@ -65,7 +71,7 @@ namespace cv
|
||||
size_t widthInBytes, size_t height, DevMemRW rw_type, DevMemType mem_type);
|
||||
void CV_EXPORTS openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
|
||||
const void *src, size_t spitch,
|
||||
size_t width, size_t height, enum openCLMemcpyKind kind, int channels = -1);
|
||||
size_t width, size_t height, openCLMemcpyKind kind, int channels = -1);
|
||||
void CV_EXPORTS openCLCopyBuffer2D(Context *clCxt, void *dst, size_t dpitch, int dst_offset,
|
||||
const void *src, size_t spitch,
|
||||
size_t width, size_t height, int src_offset);
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace cv
|
||||
|
||||
void openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
|
||||
const void *src, size_t spitch,
|
||||
size_t width, size_t height, enum openCLMemcpyKind kind, int channels)
|
||||
size_t width, size_t height, openCLMemcpyKind kind, int channels)
|
||||
{
|
||||
size_t buffer_origin[3] = {0, 0, 0};
|
||||
size_t host_origin[3] = {0, 0, 0};
|
||||
@@ -593,11 +593,11 @@ namespace cv
|
||||
size_t kernelWorkGroupSize;
|
||||
openCLSafeCall(clGetKernelWorkGroupInfo(kernel, clCxt->impl->devices[clCxt->impl->devnum],
|
||||
CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &kernelWorkGroupSize, 0));
|
||||
CV_Assert( (localThreads[0] <= clCxt->impl->maxWorkItemSizes[0]) &&
|
||||
(localThreads[1] <= clCxt->impl->maxWorkItemSizes[1]) &&
|
||||
(localThreads[2] <= clCxt->impl->maxWorkItemSizes[2]) &&
|
||||
((localThreads[0] * localThreads[1] * localThreads[2]) <= kernelWorkGroupSize) &&
|
||||
(localThreads[0] * localThreads[1] * localThreads[2]) <= clCxt->impl->maxWorkGroupSize);
|
||||
CV_Assert( localThreads[0] <= clCxt->impl->maxWorkItemSizes[0] );
|
||||
CV_Assert( localThreads[1] <= clCxt->impl->maxWorkItemSizes[1] );
|
||||
CV_Assert( localThreads[2] <= clCxt->impl->maxWorkItemSizes[2] );
|
||||
CV_Assert( localThreads[0] * localThreads[1] * localThreads[2] <= kernelWorkGroupSize );
|
||||
CV_Assert( localThreads[0] * localThreads[1] * localThreads[2] <= clCxt->impl->maxWorkGroupSize );
|
||||
}
|
||||
|
||||
#ifdef PRINT_KERNEL_RUN_TIME
|
||||
|
||||
@@ -43,17 +43,14 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "opencv2/ocl/private/util.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if defined (HAVE_OPENCL)
|
||||
#ifndef CL_VERSION_1_2
|
||||
#define CL_VERSION_1_2 0
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
@@ -180,7 +177,7 @@ namespace cv
|
||||
texture = clCreateImage((cl_context)mat.clCxt->oclContext(), CL_MEM_READ_WRITE, &format, &desc, NULL, &err);
|
||||
#else
|
||||
texture = clCreateImage2D(
|
||||
mat.clCxt->impl->clContext,
|
||||
(cl_context)mat.clCxt->oclContext(),
|
||||
CL_MEM_READ_WRITE,
|
||||
&format,
|
||||
mat.cols,
|
||||
@@ -254,4 +251,3 @@ namespace cv
|
||||
}//namespace ocl
|
||||
|
||||
}//namespace cv
|
||||
#endif
|
||||
@@ -65,12 +65,6 @@ namespace cv
|
||||
{
|
||||
namespace ocl
|
||||
{
|
||||
enum openCLMemcpyKind
|
||||
{
|
||||
clMemcpyHostToDevice = 0,
|
||||
clMemcpyDeviceToHost,
|
||||
clMemcpyDeviceToDevice
|
||||
};
|
||||
void error( const char *error_string, const char *file, const int line, const char *func = "");
|
||||
const char *getOpenCLErrorString( int err );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user