1 /*M///////////////////////////////////////////////////////////////////////////////////////
\r
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
\r
5 // By downloading, copying, installing or using the software you agree to this license.
\r
6 // If you do not agree to this license, do not download, install,
\r
7 // copy or use the software.
\r
10 // License Agreement
\r
11 // For Open Source Computer Vision Library
\r
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
\r
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
\r
15 // Third party copyrights are property of their respective owners.
\r
17 // Redistribution and use in source and binary forms, with or without modification,
\r
18 // are permitted provided that the following conditions are met:
\r
20 // * Redistribution's of source code must retain the above copyright notice,
\r
21 // this list of conditions and the following disclaimer.
\r
23 // * Redistribution's in binary form must reproduce the above copyright notice,
\r
24 // this list of conditions and the following disclaimer in the documentation
\r
25 // and/or other GpuMaterials provided with the distribution.
\r
27 // * The name of the copyright holders may not be used to endorse or promote products
\r
28 // derived from this software without specific prior written permission.
\r
30 // This software is provided by the copyright holders and contributors "as is" and
\r
31 // any express or implied warranties, including, but not limited to, the implied
\r
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
\r
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
\r
34 // indirect, incidental, special, exemplary, or consequential damages
\r
35 // (including, but not limited to, procurement of substitute goods or services;
\r
36 // loss of use, data, or profits; or business interruption) however caused
\r
37 // and on any theory of liability, whether in contract, strict liability,
\r
38 // or tort (including negligence or otherwise) arising in any way out of
\r
39 // the use of this software, even if advised of the possibility of such damage.
\r
43 #ifndef __OPENCV_GPU_HPP__
\r
44 #define __OPENCV_GPU_HPP__
\r
47 #include "opencv2/core/core.hpp"
\r
48 #include "opencv2/imgproc/imgproc.hpp"
\r
49 #include "opencv2/objdetect/objdetect.hpp"
\r
50 #include "opencv2/gpu/devmem2d.hpp"
\r
51 #include "opencv2/features2d/features2d.hpp"
\r
57 //////////////////////////////// Initialization & Info ////////////////////////
\r
59 //! This is the only function that do not throw exceptions if the library is compiled without Cuda.
\r
60 CV_EXPORTS int getCudaEnabledDeviceCount();
\r
62 //! Functions below throw cv::Expception if the library is compiled without Cuda.
\r
63 CV_EXPORTS string getDeviceName(int device);
\r
64 CV_EXPORTS void setDevice(int device);
\r
65 CV_EXPORTS int getDevice();
\r
67 CV_EXPORTS void getComputeCapability(int device, int& major, int& minor);
\r
68 CV_EXPORTS int getNumberOfSMs(int device);
\r
70 CV_EXPORTS void getGpuMemInfo(size_t& free, size_t& total);
\r
72 CV_EXPORTS bool hasNativeDoubleSupport(int device);
\r
73 CV_EXPORTS bool hasAtomicsSupport(int device);
\r
75 //////////////////////////////// Error handling ////////////////////////
\r
77 CV_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func);
\r
78 CV_EXPORTS void nppError( int err, const char *file, const int line, const char *func);
\r
80 //////////////////////////////// GpuMat ////////////////////////////////
\r
84 //! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
\r
85 class CV_EXPORTS GpuMat
\r
88 //! default constructor
\r
90 //! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
\r
91 GpuMat(int rows, int cols, int type);
\r
92 GpuMat(Size size, int type);
\r
93 //! constucts GpuMatrix and fills it with the specified value _s.
\r
94 GpuMat(int rows, int cols, int type, const Scalar& s);
\r
95 GpuMat(Size size, int type, const Scalar& s);
\r
96 //! copy constructor
\r
97 GpuMat(const GpuMat& m);
\r
99 //! constructor for GpuMatrix headers pointing to user-allocated data
\r
100 GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP);
\r
101 GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP);
\r
103 //! creates a matrix header for a part of the bigger matrix
\r
104 GpuMat(const GpuMat& m, const Range& rowRange, const Range& colRange);
\r
105 GpuMat(const GpuMat& m, const Rect& roi);
\r
107 //! builds GpuMat from Mat. Perfom blocking upload to device.
\r
108 explicit GpuMat (const Mat& m);
\r
110 //! destructor - calls release()
\r
113 //! assignment operators
\r
114 GpuMat& operator = (const GpuMat& m);
\r
115 //! assignment operator. Perfom blocking upload to device.
\r
116 GpuMat& operator = (const Mat& m);
\r
118 //! returns lightweight DevMem2D_ structure for passing to nvcc-compiled code.
\r
119 // Contains just image size, data ptr and step.
\r
120 template <class T> operator DevMem2D_<T>() const;
\r
121 template <class T> operator PtrStep_<T>() const;
\r
123 //! pefroms blocking upload data to GpuMat.
\r
124 void upload(const cv::Mat& m);
\r
127 void upload(const CudaMem& m, Stream& stream);
\r
129 //! downloads data from device to host memory. Blocking calls.
\r
130 operator Mat() const;
\r
131 void download(cv::Mat& m) const;
\r
134 void download(CudaMem& m, Stream& stream) const;
\r
136 //! returns a new GpuMatrix header for the specified row
\r
137 GpuMat row(int y) const;
\r
138 //! returns a new GpuMatrix header for the specified column
\r
139 GpuMat col(int x) const;
\r
140 //! ... for the specified row span
\r
141 GpuMat rowRange(int startrow, int endrow) const;
\r
142 GpuMat rowRange(const Range& r) const;
\r
143 //! ... for the specified column span
\r
144 GpuMat colRange(int startcol, int endcol) const;
\r
145 GpuMat colRange(const Range& r) const;
\r
147 //! returns deep copy of the GpuMatrix, i.e. the data is copied
\r
148 GpuMat clone() const;
\r
149 //! copies the GpuMatrix content to "m".
\r
150 // It calls m.create(this->size(), this->type()).
\r
151 void copyTo( GpuMat& m ) const;
\r
152 //! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
\r
153 void copyTo( GpuMat& m, const GpuMat& mask ) const;
\r
154 //! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
\r
155 void convertTo( GpuMat& m, int rtype, double alpha=1, double beta=0 ) const;
\r
157 void assignTo( GpuMat& m, int type=-1 ) const;
\r
159 //! sets every GpuMatrix element to s
\r
160 GpuMat& operator = (const Scalar& s);
\r
161 //! sets some of the GpuMatrix elements to s, according to the mask
\r
162 GpuMat& setTo(const Scalar& s, const GpuMat& mask = GpuMat());
\r
163 //! creates alternative GpuMatrix header for the same data, with different
\r
164 // number of channels and/or different number of rows. see cvReshape.
\r
165 GpuMat reshape(int cn, int rows = 0) const;
\r
167 //! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
\r
168 // previous data is unreferenced if needed.
\r
169 void create(int rows, int cols, int type);
\r
170 void create(Size size, int type);
\r
171 //! decreases reference counter;
\r
172 // deallocate the data when reference counter reaches 0.
\r
175 //! swaps with other smart pointer
\r
176 void swap(GpuMat& mat);
\r
178 //! locates GpuMatrix header within a parent GpuMatrix. See below
\r
179 void locateROI( Size& wholeSize, Point& ofs ) const;
\r
180 //! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
\r
181 GpuMat& adjustROI( int dtop, int dbottom, int dleft, int dright );
\r
182 //! extracts a rectangular sub-GpuMatrix
\r
183 // (this is a generalized form of row, rowRange etc.)
\r
184 GpuMat operator()( Range rowRange, Range colRange ) const;
\r
185 GpuMat operator()( const Rect& roi ) const;
\r
187 //! returns true iff the GpuMatrix data is continuous
\r
188 // (i.e. when there are no gaps between successive rows).
\r
189 // similar to CV_IS_GpuMat_CONT(cvGpuMat->type)
\r
190 bool isContinuous() const;
\r
191 //! returns element size in bytes,
\r
192 // similar to CV_ELEM_SIZE(cvMat->type)
\r
193 size_t elemSize() const;
\r
194 //! returns the size of element channel in bytes.
\r
195 size_t elemSize1() const;
\r
196 //! returns element type, similar to CV_MAT_TYPE(cvMat->type)
\r
198 //! returns element type, similar to CV_MAT_DEPTH(cvMat->type)
\r
200 //! returns element type, similar to CV_MAT_CN(cvMat->type)
\r
201 int channels() const;
\r
202 //! returns step/elemSize1()
\r
203 size_t step1() const;
\r
204 //! returns GpuMatrix size:
\r
205 // width == number of columns, height == number of rows
\r
207 //! returns true if GpuMatrix data is NULL
\r
208 bool empty() const;
\r
210 //! returns pointer to y-th row
\r
211 uchar* ptr(int y = 0);
\r
212 const uchar* ptr(int y = 0) const;
\r
214 //! template version of the above method
\r
215 template<typename _Tp> _Tp* ptr(int y = 0);
\r
216 template<typename _Tp> const _Tp* ptr(int y = 0) const;
\r
218 //! matrix transposition
\r
221 /*! includes several bit-fields:
\r
222 - the magic signature
\r
225 - number of channels
\r
228 //! the number of rows and columns
\r
230 //! a distance between successive rows in bytes; includes the gap if any
\r
232 //! pointer to the data
\r
235 //! pointer to the reference counter;
\r
236 // when GpuMatrix points to user-allocated data, the pointer is NULL
\r
239 //! helper fields used in locateROI and adjustROI
\r
244 //#define TemplatedGpuMat // experimental now, deprecated to use
\r
245 #ifdef TemplatedGpuMat
\r
246 #include "GpuMat_BetaDeprecated.hpp"
\r
249 //////////////////////////////// CudaMem ////////////////////////////////
\r
250 // CudaMem is limited cv::Mat with page locked memory allocation.
\r
251 // Page locked memory is only needed for async and faster coping to GPU.
\r
252 // It is convertable to cv::Mat header without reference counting
\r
253 // so you can use it with other opencv functions.
\r
255 class CV_EXPORTS CudaMem
\r
258 enum { ALLOC_PAGE_LOCKED = 1, ALLOC_ZEROCOPY = 2, ALLOC_WRITE_COMBINED = 4 };
\r
261 CudaMem(const CudaMem& m);
\r
263 CudaMem(int rows, int cols, int type, int _alloc_type = ALLOC_PAGE_LOCKED);
\r
264 CudaMem(Size size, int type, int alloc_type = ALLOC_PAGE_LOCKED);
\r
267 //! creates from cv::Mat with coping data
\r
268 explicit CudaMem(const Mat& m, int alloc_type = ALLOC_PAGE_LOCKED);
\r
272 CudaMem& operator = (const CudaMem& m);
\r
274 //! returns deep copy of the matrix, i.e. the data is copied
\r
275 CudaMem clone() const;
\r
277 //! allocates new matrix data unless the matrix already has specified size and type.
\r
278 void create(int rows, int cols, int type, int alloc_type = ALLOC_PAGE_LOCKED);
\r
279 void create(Size size, int type, int alloc_type = ALLOC_PAGE_LOCKED);
\r
281 //! decrements reference counter and released memory if needed.
\r
284 //! returns matrix header with disabled reference counting for CudaMem data.
\r
285 Mat createMatHeader() const;
\r
286 operator Mat() const;
\r
288 //! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware.
\r
289 GpuMat createGpuMatHeader() const;
\r
290 operator GpuMat() const;
\r
292 //returns if host memory can be mapperd to gpu address space;
\r
293 static bool canMapHostMemory();
\r
295 // Please see cv::Mat for descriptions
\r
296 bool isContinuous() const;
\r
297 size_t elemSize() const;
\r
298 size_t elemSize1() const;
\r
301 int channels() const;
\r
302 size_t step1() const;
\r
304 bool empty() const;
\r
307 // Please see cv::Mat for descriptions
\r
321 //////////////////////////////// CudaStream ////////////////////////////////
\r
322 // Encapculates Cuda Stream. Provides interface for async coping.
\r
323 // Passed to each function that supports async kernel execution.
\r
324 // Reference counting is enabled
\r
326 class CV_EXPORTS Stream
\r
332 Stream(const Stream&);
\r
333 Stream& operator=(const Stream&);
\r
335 bool queryIfComplete();
\r
336 void waitForCompletion();
\r
338 //! downloads asynchronously.
\r
339 // Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat)
\r
340 void enqueueDownload(const GpuMat& src, CudaMem& dst);
\r
341 void enqueueDownload(const GpuMat& src, Mat& dst);
\r
343 //! uploads asynchronously.
\r
344 // Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI)
\r
345 void enqueueUpload(const CudaMem& src, GpuMat& dst);
\r
346 void enqueueUpload(const Mat& src, GpuMat& dst);
\r
348 void enqueueCopy(const GpuMat& src, GpuMat& dst);
\r
350 void enqueueMemSet(const GpuMat& src, Scalar val);
\r
351 void enqueueMemSet(const GpuMat& src, Scalar val, const GpuMat& mask);
\r
353 // converts matrix type, ex from float to uchar depending on type
\r
354 void enqueueConvert(const GpuMat& src, GpuMat& dst, int type, double a = 1, double b = 0);
\r
360 friend struct StreamAccessor;
\r
364 ////////////////////////////// Arithmetics ///////////////////////////////////
\r
366 //! transposes the matrix
\r
367 //! supports matrix with element size = 1, 4 and 8 bytes (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc)
\r
368 CV_EXPORTS void transpose(const GpuMat& src1, GpuMat& dst);
\r
370 //! reverses the order of the rows, columns or both in a matrix
\r
371 //! supports CV_8UC1, CV_8UC4 types
\r
372 CV_EXPORTS void flip(const GpuMat& a, GpuMat& b, int flipCode);
\r
374 //! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
\r
375 //! destination array will have the depth type as lut and the same channels number as source
\r
376 //! supports CV_8UC1, CV_8UC3 types
\r
377 CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst);
\r
379 //! makes multi-channel array out of several single-channel arrays
\r
380 CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst);
\r
382 //! makes multi-channel array out of several single-channel arrays
\r
383 CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst);
\r
385 //! makes multi-channel array out of several single-channel arrays (async version)
\r
386 CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream);
\r
388 //! makes multi-channel array out of several single-channel arrays (async version)
\r
389 CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream);
\r
391 //! copies each plane of a multi-channel array to a dedicated array
\r
392 CV_EXPORTS void split(const GpuMat& src, GpuMat* dst);
\r
394 //! copies each plane of a multi-channel array to a dedicated array
\r
395 CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst);
\r
397 //! copies each plane of a multi-channel array to a dedicated array (async version)
\r
398 CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, const Stream& stream);
\r
400 //! copies each plane of a multi-channel array to a dedicated array (async version)
\r
401 CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream);
\r
403 //! computes magnitude of complex (x(i).re, x(i).im) vector
\r
404 //! supports only CV_32FC2 type
\r
405 CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude);
\r
407 //! computes squared magnitude of complex (x(i).re, x(i).im) vector
\r
408 //! supports only CV_32FC2 type
\r
409 CV_EXPORTS void magnitudeSqr(const GpuMat& x, GpuMat& magnitude);
\r
411 //! computes magnitude of each (x(i), y(i)) vector
\r
412 //! supports only floating-point source
\r
413 CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);
\r
415 CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);
\r
417 //! computes squared magnitude of each (x(i), y(i)) vector
\r
418 //! supports only floating-point source
\r
419 CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);
\r
421 CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);
\r
423 //! computes angle (angle(i)) of each (x(i), y(i)) vector
\r
424 //! supports only floating-point source
\r
425 CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees = false);
\r
427 CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream);
\r
429 //! converts Cartesian coordinates to polar
\r
430 //! supports only floating-point source
\r
431 CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees = false);
\r
433 CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream);
\r
435 //! converts polar coordinates to Cartesian
\r
436 //! supports only floating-point source
\r
437 CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees = false);
\r
439 CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream);
\r
442 //////////////////////////// Per-element operations ////////////////////////////////////
\r
444 //! adds one matrix to another (c = a + b)
\r
445 //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
\r
446 CV_EXPORTS void add(const GpuMat& a, const GpuMat& b, GpuMat& c);
\r
447 //! adds scalar to a matrix (c = a + s)
\r
448 //! supports CV_32FC1 and CV_32FC2 type
\r
449 CV_EXPORTS void add(const GpuMat& a, const Scalar& sc, GpuMat& c);
\r
451 //! subtracts one matrix from another (c = a - b)
\r
452 //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
\r
453 CV_EXPORTS void subtract(const GpuMat& a, const GpuMat& b, GpuMat& c);
\r
454 //! subtracts scalar from a matrix (c = a - s)
\r
455 //! supports CV_32FC1 and CV_32FC2 type
\r
456 CV_EXPORTS void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c);
\r
458 //! computes element-wise product of the two arrays (c = a * b)
\r
459 //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
\r
460 CV_EXPORTS void multiply(const GpuMat& a, const GpuMat& b, GpuMat& c);
\r
461 //! multiplies matrix to a scalar (c = a * s)
\r
462 //! supports CV_32FC1 and CV_32FC2 type
\r
463 CV_EXPORTS void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c);
\r
465 //! computes element-wise quotient of the two arrays (c = a / b)
\r
466 //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
\r
467 CV_EXPORTS void divide(const GpuMat& a, const GpuMat& b, GpuMat& c);
\r
468 //! computes element-wise quotient of matrix and scalar (c = a / s)
\r
469 //! supports CV_32FC1 and CV_32FC2 type
\r
470 CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c);
\r
472 //! computes exponent of each matrix element (b = e**a)
\r
473 //! supports only CV_32FC1 type
\r
474 CV_EXPORTS void exp(const GpuMat& a, GpuMat& b);
\r
476 //! computes natural logarithm of absolute value of each matrix element: b = log(abs(a))
\r
477 //! supports only CV_32FC1 type
\r
478 CV_EXPORTS void log(const GpuMat& a, GpuMat& b);
\r
480 //! computes element-wise absolute difference of two arrays (c = abs(a - b))
\r
481 //! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
\r
482 CV_EXPORTS void absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c);
\r
483 //! computes element-wise absolute difference of array and scalar (c = abs(a - s))
\r
484 //! supports only CV_32FC1 type
\r
485 CV_EXPORTS void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c);
\r
487 //! compares elements of two arrays (c = a <cmpop> b)
\r
488 //! supports CV_8UC4, CV_32FC1 types
\r
489 CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop);
\r
491 //! performs per-elements bit-wise inversion
\r
492 CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat());
\r
494 CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream);
\r
496 //! calculates per-element bit-wise disjunction of two arrays
\r
497 CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
\r
499 CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);
\r
501 //! calculates per-element bit-wise conjunction of two arrays
\r
502 CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
\r
504 CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);
\r
506 //! calculates per-element bit-wise "exclusive or" operation
\r
507 CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
\r
509 CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);
\r
511 //! computes per-element minimum of two arrays (dst = min(src1, src2))
\r
512 CV_EXPORTS void min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst);
\r
514 CV_EXPORTS void min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream);
\r
516 //! computes per-element minimum of array and scalar (dst = min(src1, src2))
\r
517 CV_EXPORTS void min(const GpuMat& src1, double src2, GpuMat& dst);
\r
519 CV_EXPORTS void min(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream);
\r
521 //! computes per-element maximum of two arrays (dst = max(src1, src2))
\r
522 CV_EXPORTS void max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst);
\r
524 CV_EXPORTS void max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream);
\r
526 //! computes per-element maximum of array and scalar (dst = max(src1, src2))
\r
527 CV_EXPORTS void max(const GpuMat& src1, double src2, GpuMat& dst);
\r
529 CV_EXPORTS void max(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream);
\r
532 ////////////////////////////// Image processing //////////////////////////////
\r
534 //! DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
\r
535 //! supports CV_8UC1, CV_8UC3 source types and CV_32FC1 map type
\r
536 CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap);
\r
538 //! Does mean shift filtering on GPU.
\r
539 CV_EXPORTS void meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr,
\r
540 TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));
\r
542 //! Does mean shift procedure on GPU.
\r
543 CV_EXPORTS void meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int sp, int sr,
\r
544 TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));
\r
546 //! Does mean shift segmentation with elimiation of small regions.
\r
547 CV_EXPORTS void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int minsize,
\r
548 TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));
\r
550 //! Does coloring of disparity image: [0..ndisp) -> [0..240, 1, 1] in HSV.
\r
551 //! Supported types of input disparity: CV_8U, CV_16S.
\r
552 //! Output disparity has CV_8UC4 type in BGRA format (alpha = 255).
\r
553 CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp);
\r
555 CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, const Stream& stream);
\r
557 //! Reprojects disparity image to 3D space.
\r
558 //! Supports CV_8U and CV_16S types of input disparity.
\r
559 //! The output is a 4-channel floating-point (CV_32FC4) matrix.
\r
560 //! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.
\r
561 //! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.
\r
562 CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q);
\r
564 CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, const Stream& stream);
\r
566 //! converts image from one color space to another
\r
567 CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0);
\r
569 CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, const Stream& stream);
\r
571 //! applies fixed threshold to the image.
\r
572 //! Now supports only THRESH_TRUNC threshold type and one channels float source.
\r
573 CV_EXPORTS double threshold(const GpuMat& src, GpuMat& dst, double thresh);
\r
575 //! resizes the image
\r
576 //! Supports INTER_NEAREST, INTER_LINEAR
\r
577 //! supports CV_8UC1, CV_8UC4 types
\r
578 CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR);
\r
580 //! warps the image using affine transformation
\r
581 //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
\r
582 CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR);
\r
584 //! warps the image using perspective transformation
\r
585 //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
\r
586 CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR);
\r
588 //! rotate 8bit single or four channel image
\r
589 //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
\r
590 //! supports CV_8UC1, CV_8UC4 types
\r
591 CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR);
\r
593 //! copies 2D array to a larger destination array and pads borders with user-specifiable constant
\r
594 //! supports CV_8UC1, CV_8UC4, CV_32SC1 and CV_32FC1 types
\r
595 CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar());
\r
597 //! computes the integral image
\r
598 //! sum will have CV_32S type, but will contain unsigned int values
\r
599 //! supports only CV_8UC1 source type
\r
600 CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum);
\r
602 //! computes the integral image and integral for the squared image
\r
603 //! sum will have CV_32S type, sqsum - CV32F type
\r
604 //! supports only CV_8UC1 source type
\r
605 CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum);
\r
607 //! computes squared integral image
\r
608 //! result matrix will have 64F type, but will contain 64U values
\r
609 //! supports source images of 8UC1 type only
\r
610 CV_EXPORTS void sqrIntegral(const GpuMat& src, GpuMat& sqsum);
\r
612 //! computes vertical sum, supports only CV_32FC1 images
\r
613 CV_EXPORTS void columnSum(const GpuMat& src, GpuMat& sum);
\r
615 //! computes the standard deviation of integral images
\r
616 //! supports only CV_32SC1 source type and CV_32FC1 sqr type
\r
617 //! output will have CV_32FC1 type
\r
618 CV_EXPORTS void rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect);
\r
620 //! applies Canny edge detector and produces the edge map
\r
621 //! supprots only CV_8UC1 source type
\r
622 //! disabled until fix crash
\r
623 CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double threshold1, double threshold2, int apertureSize = 3);
\r
625 //! computes Harris cornerness criteria at each image pixel
\r
626 CV_EXPORTS void cornerHarris(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, double k, int borderType=BORDER_REFLECT101);
\r
628 //! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
\r
629 CV_EXPORTS void cornerMinEigenVal(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, int borderType=BORDER_REFLECT101);
\r
631 //! performs per-element multiplication of two full (i.e. not packed) Fourier spectrums
\r
632 //! supports only 32FC2 matrixes (interleaved format)
\r
633 CV_EXPORTS void mulSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags, bool conjB=false);
\r
635 //! performs per-element multiplication of two full (i.e. not packed) Fourier spectrums
\r
636 //! supports only 32FC2 matrixes (interleaved format)
\r
637 CV_EXPORTS void mulAndScaleSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags,
\r
638 float scale, bool conjB=false);
\r
640 //! computes convolution (or cross-correlation) of two images using discrete Fourier transform
\r
641 //! supports source images of 32FC1 type only
\r
642 //! result matrix will have 32FC1 type
\r
643 CV_EXPORTS void convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result, bool ccorr=false);
\r
645 //! computes the proximity map for the raster template and the image where the template is searched for
\r
646 CV_EXPORTS void matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method);
\r
649 ////////////////////////////// Matrix reductions //////////////////////////////
\r
651 //! computes mean value and standard deviation of all or selected array elements
\r
652 //! supports only CV_8UC1 type
\r
653 CV_EXPORTS void meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev);
\r
655 //! computes norm of array
\r
656 //! supports NORM_INF, NORM_L1, NORM_L2
\r
657 //! supports only CV_8UC1 type
\r
658 CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);
\r
660 //! computes norm of the difference between two arrays
\r
661 //! supports NORM_INF, NORM_L1, NORM_L2
\r
662 //! supports only CV_8UC1 type
\r
663 CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2);
\r
665 //! computes sum of array elements
\r
666 //! supports only single channel images
\r
667 CV_EXPORTS Scalar sum(const GpuMat& src);
\r
669 //! computes sum of array elements
\r
670 //! supports only single channel images
\r
671 CV_EXPORTS Scalar sum(const GpuMat& src, GpuMat& buf);
\r
673 //! computes squared sum of array elements
\r
674 //! supports only single channel images
\r
675 CV_EXPORTS Scalar sqrSum(const GpuMat& src);
\r
677 //! computes squared sum of array elements
\r
678 //! supports only single channel images
\r
679 CV_EXPORTS Scalar sqrSum(const GpuMat& src, GpuMat& buf);
\r
681 //! finds global minimum and maximum array elements and returns their values
\r
682 CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat());
\r
684 //! finds global minimum and maximum array elements and returns their values
\r
685 CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf);
\r
687 //! finds global minimum and maximum array elements and returns their values with locations
\r
688 CV_EXPORTS void minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0,
\r
689 const GpuMat& mask=GpuMat());
\r
691 //! finds global minimum and maximum array elements and returns their values with locations
\r
692 CV_EXPORTS void minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc,
\r
693 const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf);
\r
695 //! counts non-zero array elements
\r
696 CV_EXPORTS int countNonZero(const GpuMat& src);
\r
698 //! counts non-zero array elements
\r
699 CV_EXPORTS int countNonZero(const GpuMat& src, GpuMat& buf);
\r
702 //////////////////////////////// Filter Engine ////////////////////////////////
\r
705 The Base Class for 1D or Row-wise Filters
\r
707 This is the base class for linear or non-linear filters that process 1D data.
\r
708 In particular, such filters are used for the "horizontal" filtering parts in separable filters.
\r
710 class CV_EXPORTS BaseRowFilter_GPU
\r
713 BaseRowFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
714 virtual ~BaseRowFilter_GPU() {}
\r
715 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
720 The Base Class for Column-wise Filters
\r
722 This is the base class for linear or non-linear filters that process columns of 2D arrays.
\r
723 Such filters are used for the "vertical" filtering parts in separable filters.
\r
725 class CV_EXPORTS BaseColumnFilter_GPU
\r
728 BaseColumnFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
729 virtual ~BaseColumnFilter_GPU() {}
\r
730 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
735 The Base Class for Non-Separable 2D Filters.
\r
737 This is the base class for linear or non-linear 2D filters.
\r
739 class CV_EXPORTS BaseFilter_GPU
\r
742 BaseFilter_GPU(const Size& ksize_, const Point& anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
743 virtual ~BaseFilter_GPU() {}
\r
744 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
750 The Base Class for Filter Engine.
\r
752 The class can be used to apply an arbitrary filtering operation to an image.
\r
753 It contains all the necessary intermediate buffers.
\r
755 class CV_EXPORTS FilterEngine_GPU
\r
758 virtual ~FilterEngine_GPU() {}
\r
760 virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1)) = 0;
\r
763 //! returns the non-separable filter engine with the specified filter
\r
764 CV_EXPORTS Ptr<FilterEngine_GPU> createFilter2D_GPU(const Ptr<BaseFilter_GPU> filter2D, int srcType, int dstType);
\r
766 //! returns the separable filter engine with the specified filters
\r
767 CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,
\r
768 const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType);
\r
770 //! returns horizontal 1D box filter
\r
771 //! supports only CV_8UC1 source type and CV_32FC1 sum type
\r
772 CV_EXPORTS Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1);
\r
774 //! returns vertical 1D box filter
\r
775 //! supports only CV_8UC1 sum type and CV_32FC1 dst type
\r
776 CV_EXPORTS Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1);
\r
778 //! returns 2D box filter
\r
779 //! supports CV_8UC1 and CV_8UC4 source type, dst type must be the same as source type
\r
780 CV_EXPORTS Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1));
\r
782 //! returns box filter engine
\r
783 CV_EXPORTS Ptr<FilterEngine_GPU> createBoxFilter_GPU(int srcType, int dstType, const Size& ksize,
\r
784 const Point& anchor = Point(-1,-1));
\r
786 //! returns 2D morphological filter
\r
787 //! only MORPH_ERODE and MORPH_DILATE are supported
\r
788 //! supports CV_8UC1 and CV_8UC4 types
\r
789 //! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height
\r
790 CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,
\r
791 Point anchor=Point(-1,-1));
\r
793 //! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
\r
794 CV_EXPORTS Ptr<FilterEngine_GPU> createMorphologyFilter_GPU(int op, int type, const Mat& kernel,
\r
795 const Point& anchor = Point(-1,-1), int iterations = 1);
\r
797 //! returns 2D filter with the specified kernel
\r
798 //! supports CV_8UC1 and CV_8UC4 types
\r
799 CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,
\r
800 Point anchor = Point(-1, -1));
\r
802 //! returns the non-separable linear filter engine
\r
803 CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,
\r
804 const Point& anchor = Point(-1,-1));
\r
806 //! returns the primitive row filter with the specified kernel.
\r
807 //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 source type.
\r
808 //! there are two version of algorithm: NPP and OpenCV.
\r
809 //! NPP calls when srcType == CV_8UC1 or srcType == CV_8UC4 and bufType == srcType,
\r
810 //! otherwise calls OpenCV version.
\r
811 //! NPP supports only BORDER_CONSTANT border type.
\r
812 //! OpenCV version supports only CV_32F as buffer depth and
\r
813 //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.
\r
814 CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,
\r
815 int anchor = -1, int borderType = BORDER_CONSTANT);
\r
817 //! returns the primitive column filter with the specified kernel.
\r
818 //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 dst type.
\r
819 //! there are two version of algorithm: NPP and OpenCV.
\r
820 //! NPP calls when dstType == CV_8UC1 or dstType == CV_8UC4 and bufType == dstType,
\r
821 //! otherwise calls OpenCV version.
\r
822 //! NPP supports only BORDER_CONSTANT border type.
\r
823 //! OpenCV version supports only CV_32F as buffer depth and
\r
824 //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.
\r
825 CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,
\r
826 int anchor = -1, int borderType = BORDER_CONSTANT);
\r
828 //! returns the separable linear filter engine
\r
829 CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,
\r
830 const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT,
\r
831 int columnBorderType = -1);
\r
833 //! returns filter engine for the generalized Sobel operator
\r
834 CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize,
\r
835 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
837 //! returns the Gaussian filter engine
\r
838 CV_EXPORTS Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigma1, double sigma2 = 0,
\r
839 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
841 //! returns maximum filter
\r
842 CV_EXPORTS Ptr<BaseFilter_GPU> getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));
\r
844 //! returns minimum filter
\r
845 CV_EXPORTS Ptr<BaseFilter_GPU> getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));
\r
847 //! smooths the image using the normalized box filter
\r
848 //! supports CV_8UC1, CV_8UC4 types
\r
849 CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1));
\r
851 //! a synonym for normalized box filter
\r
852 static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, -1, ksize, anchor); }
\r
854 //! erodes the image (applies the local minimum operator)
\r
855 CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
857 //! dilates the image (applies the local maximum operator)
\r
858 CV_EXPORTS void dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
860 //! applies an advanced morphological operation to the image
\r
861 CV_EXPORTS void morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
863 //! applies non-separable 2D linear filter to the image
\r
864 CV_EXPORTS void filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1));
\r
866 //! applies separable 2D linear filter to the image
\r
867 CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,
\r
868 Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
870 //! applies generalized Sobel operator to the image
\r
871 CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1,
\r
872 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
874 //! applies the vertical or horizontal Scharr operator to the image
\r
875 CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1,
\r
876 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
878 //! smooths the image using Gaussian filter.
\r
879 CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2 = 0,
\r
880 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
882 //! applies Laplacian operator to the image
\r
883 //! supports only ksize = 1 and ksize = 3
\r
884 CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1);
\r
886 //////////////////////////////// Image Labeling ////////////////////////////////
\r
888 //!performs labeling via graph cuts
\r
889 CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf);
\r
891 ////////////////////////////////// Histograms //////////////////////////////////
\r
893 //! Compute levels with even distribution. levels will have 1 row and nLevels cols and CV_32SC1 type.
\r
894 CV_EXPORTS void evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel);
\r
895 //! Calculates histogram with evenly distributed bins for signle channel source.
\r
896 //! Supports CV_8UC1, CV_16UC1 and CV_16SC1 source types.
\r
897 //! Output hist will have one row and histSize cols and CV_32SC1 type.
\r
898 CV_EXPORTS void histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel);
\r
899 //! Calculates histogram with evenly distributed bins for four-channel source.
\r
900 //! All channels of source are processed separately.
\r
901 //! Supports CV_8UC4, CV_16UC4 and CV_16SC4 source types.
\r
902 //! Output hist[i] will have one row and histSize[i] cols and CV_32SC1 type.
\r
903 CV_EXPORTS void histEven(const GpuMat& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4]);
\r
904 //! Calculates histogram with bins determined by levels array.
\r
905 //! levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
\r
906 //! Supports CV_8UC1, CV_16UC1, CV_16SC1 and CV_32FC1 source types.
\r
907 //! Output hist will have one row and (levels.cols-1) cols and CV_32SC1 type.
\r
908 CV_EXPORTS void histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels);
\r
909 //! Calculates histogram with bins determined by levels array.
\r
910 //! All levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
\r
911 //! All channels of source are processed separately.
\r
912 //! Supports CV_8UC4, CV_16UC4, CV_16SC4 and CV_32FC4 source types.
\r
913 //! Output hist[i] will have one row and (levels[i].cols-1) cols and CV_32SC1 type.
\r
914 CV_EXPORTS void histRange(const GpuMat& src, GpuMat hist[4], const GpuMat levels[4]);
\r
916 //////////////////////////////// StereoBM_GPU ////////////////////////////////
\r
918 class CV_EXPORTS StereoBM_GPU
\r
921 enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 };
\r
923 enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 };
\r
925 //! the default constructor
\r
927 //! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8.
\r
928 StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ);
\r
930 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair
\r
931 //! Output disparity has CV_8U type.
\r
932 void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
935 void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream & stream);
\r
937 //! Some heuristics that tries to estmate
\r
938 // if current GPU will be faster then CPU in this algorithm.
\r
939 // It queries current active device.
\r
940 static bool checkIfGpuCallReasonable();
\r
946 // If avergeTexThreshold == 0 => post procesing is disabled
\r
947 // If avergeTexThreshold != 0 then disparity is set 0 in each point (x,y) where for left image
\r
948 // SumOfHorizontalGradiensInWindow(x, y, winSize) < (winSize * winSize) * avergeTexThreshold
\r
949 // i.e. input left image is low textured.
\r
950 float avergeTexThreshold;
\r
952 GpuMat minSSD, leBuf, riBuf;
\r
955 ////////////////////////// StereoBeliefPropagation ///////////////////////////
\r
956 // "Efficient Belief Propagation for Early Vision"
\r
959 class CV_EXPORTS StereoBeliefPropagation
\r
962 enum { DEFAULT_NDISP = 64 };
\r
963 enum { DEFAULT_ITERS = 5 };
\r
964 enum { DEFAULT_LEVELS = 5 };
\r
966 static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels);
\r
968 //! the default constructor
\r
969 explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP,
\r
970 int iters = DEFAULT_ITERS,
\r
971 int levels = DEFAULT_LEVELS,
\r
972 int msg_type = CV_32F);
\r
974 //! the full constructor taking the number of disparities, number of BP iterations on each level,
\r
975 //! number of levels, truncation of data cost, data weight,
\r
976 //! truncation of discontinuity cost and discontinuity single jump
\r
977 //! DataTerm = data_weight * min(fabs(I2-I1), max_data_term)
\r
978 //! DiscTerm = min(disc_single_jump * fabs(f1-f2), max_disc_term)
\r
979 //! please see paper for more details
\r
980 StereoBeliefPropagation(int ndisp, int iters, int levels,
\r
981 float max_data_term, float data_weight,
\r
982 float max_disc_term, float disc_single_jump,
\r
983 int msg_type = CV_32F);
\r
985 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
\r
986 //! if disparity is empty output type will be CV_16S else output type will be disparity.type().
\r
987 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
990 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);
\r
993 //! version for user specified data term
\r
994 void operator()(const GpuMat& data, GpuMat& disparity);
\r
995 void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);
\r
1002 float max_data_term;
\r
1003 float data_weight;
\r
1004 float max_disc_term;
\r
1005 float disc_single_jump;
\r
1009 GpuMat u, d, l, r, u2, d2, l2, r2;
\r
1010 std::vector<GpuMat> datas;
\r
1014 /////////////////////////// StereoConstantSpaceBP ///////////////////////////
\r
1015 // "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
\r
1016 // Qingxiong Yang, Liang Wang
\86, Narendra Ahuja
\r
1017 // http://vision.ai.uiuc.edu/~qyang6/
\r
1019 class CV_EXPORTS StereoConstantSpaceBP
\r
1022 enum { DEFAULT_NDISP = 128 };
\r
1023 enum { DEFAULT_ITERS = 8 };
\r
1024 enum { DEFAULT_LEVELS = 4 };
\r
1025 enum { DEFAULT_NR_PLANE = 4 };
\r
1027 static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane);
\r
1029 //! the default constructor
\r
1030 explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP,
\r
1031 int iters = DEFAULT_ITERS,
\r
1032 int levels = DEFAULT_LEVELS,
\r
1033 int nr_plane = DEFAULT_NR_PLANE,
\r
1034 int msg_type = CV_32F);
\r
1036 //! the full constructor taking the number of disparities, number of BP iterations on each level,
\r
1037 //! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
\r
1038 //! truncation of discontinuity cost, discontinuity single jump and minimum disparity threshold
\r
1039 StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane,
\r
1040 float max_data_term, float data_weight, float max_disc_term, float disc_single_jump,
\r
1041 int min_disp_th = 0,
\r
1042 int msg_type = CV_32F);
\r
1044 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
\r
1045 //! if disparity is empty output type will be CV_16S else output type will be disparity.type().
\r
1046 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
1049 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);
\r
1058 float max_data_term;
\r
1059 float data_weight;
\r
1060 float max_disc_term;
\r
1061 float disc_single_jump;
\r
1067 bool use_local_init_data_cost;
\r
1069 GpuMat u[2], d[2], l[2], r[2];
\r
1070 GpuMat disp_selected_pyr[2];
\r
1073 GpuMat data_cost_selected;
\r
1080 /////////////////////////// DisparityBilateralFilter ///////////////////////////
\r
1081 // Disparity map refinement using joint bilateral filtering given a single color image.
\r
1082 // Qingxiong Yang, Liang Wang
\86, Narendra Ahuja
\r
1083 // http://vision.ai.uiuc.edu/~qyang6/
\r
1085 class CV_EXPORTS DisparityBilateralFilter
\r
1088 enum { DEFAULT_NDISP = 64 };
\r
1089 enum { DEFAULT_RADIUS = 3 };
\r
1090 enum { DEFAULT_ITERS = 1 };
\r
1092 //! the default constructor
\r
1093 explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS);
\r
1095 //! the full constructor taking the number of disparities, filter radius,
\r
1096 //! number of iterations, truncation of data continuity, truncation of disparity continuity
\r
1097 //! and filter range sigma
\r
1098 DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range);
\r
1100 //! the disparity map refinement operator. Refine disparity map using joint bilateral filtering given a single color image.
\r
1101 //! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.
\r
1102 void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst);
\r
1105 void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream);
\r
1112 float edge_threshold;
\r
1113 float max_disc_threshold;
\r
1114 float sigma_range;
\r
1116 GpuMat table_color;
\r
1117 GpuMat table_space;
\r
1121 //////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
\r
1123 struct CV_EXPORTS HOGDescriptor
\r
1126 enum { DEFAULT_WIN_SIGMA = -1 };
\r
1127 enum { DEFAULT_NLEVELS = 64 };
\r
1128 enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };
\r
1130 HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
\r
1131 Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
\r
1132 int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
\r
1133 double threshold_L2hys=0.2, bool gamma_correction=true,
\r
1134 int nlevels=DEFAULT_NLEVELS);
\r
1136 size_t getDescriptorSize() const;
\r
1137 size_t getBlockHistogramSize() const;
\r
1138 double getWinSigma() const;
\r
1140 static vector<float> getDefaultPeopleDetector();
\r
1141 static vector<float> getPeopleDetector_48x96();
\r
1142 static vector<float> getPeopleDetector_64x128();
\r
1143 void setSVMDetector(const vector<float>& detector);
\r
1144 bool checkDetectorSize() const;
\r
1146 void detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0,
\r
1147 Size win_stride=Size(), Size padding=Size());
\r
1148 void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,
\r
1149 double hit_threshold=0, Size win_stride=Size(), Size padding=Size(),
\r
1150 double scale0=1.05, int group_threshold=2);
\r
1152 void getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors,
\r
1153 int descr_format=DESCR_FORMAT_COL_BY_COL);
\r
1157 Size block_stride;
\r
1161 double threshold_L2hys;
\r
1162 bool gamma_correction;
\r
1166 void computeBlockHistograms(const GpuMat& img);
\r
1167 void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle);
\r
1169 static int numPartsWithin(int size, int part_size, int stride);
\r
1170 static Size numPartsWithin(Size size, Size part_size, Size stride);
\r
1172 // Coefficients of the separating plane
\r
1176 // Results of the last classification step
\r
1180 // Results of the last histogram evaluation step
\r
1181 GpuMat block_hists;
\r
1183 // Gradients conputation results
\r
1184 GpuMat grad, qangle;
\r
1188 ////////////////////////////////// BruteForceMatcher //////////////////////////////////
\r
1190 class CV_EXPORTS BruteForceMatcher_GPU_base
\r
1193 enum DistType {L1Dist = 0, L2Dist};
\r
1195 explicit BruteForceMatcher_GPU_base(DistType distType = L2Dist);
\r
1197 // Add descriptors to train descriptor collection.
\r
1198 void add(const std::vector<GpuMat>& descCollection);
\r
1200 // Get train descriptors collection.
\r
1201 const std::vector<GpuMat>& getTrainDescriptors() const;
\r
1203 // Clear train descriptors collection.
\r
1206 // Return true if there are not train descriptors in collection.
\r
1207 bool empty() const;
\r
1209 // Return true if the matcher supports mask in match methods.
\r
1210 bool isMaskSupported() const;
\r
1212 // Find one best match for each query descriptor.
\r
1213 // trainIdx.at<int>(0, queryIdx) will contain best train index for queryIdx
\r
1214 // distance.at<float>(0, queryIdx) will contain distance
\r
1215 void matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1216 GpuMat& trainIdx, GpuMat& distance,
\r
1217 const GpuMat& mask = GpuMat());
\r
1219 // Download trainIdx and distance to CPU vector with DMatch
\r
1220 static void matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector<DMatch>& matches);
\r
1222 // Find one best match for each query descriptor.
\r
1223 void match(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector<DMatch>& matches,
\r
1224 const GpuMat& mask = GpuMat());
\r
1226 // Make gpu collection of trains and masks in suitable format for matchCollection function
\r
1227 void makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection,
\r
1228 const vector<GpuMat>& masks = std::vector<GpuMat>());
\r
1230 // Find one best match from train collection for each query descriptor.
\r
1231 // trainIdx.at<int>(0, queryIdx) will contain best train index for queryIdx
\r
1232 // imgIdx.at<int>(0, queryIdx) will contain best image index for queryIdx
\r
1233 // distance.at<float>(0, queryIdx) will contain distance
\r
1234 void matchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection,
\r
1235 GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
\r
1236 const GpuMat& maskCollection);
\r
1238 // Download trainIdx, imgIdx and distance to CPU vector with DMatch
\r
1239 static void matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx, const GpuMat& distance,
\r
1240 std::vector<DMatch>& matches);
\r
1242 // Find one best match from train collection for each query descriptor.
\r
1243 void match(const GpuMat& queryDescs, std::vector<DMatch>& matches,
\r
1244 const std::vector<GpuMat>& masks = std::vector<GpuMat>());
\r
1246 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1247 // trainIdx.at<int>(queryIdx, i) will contain index of i'th best trains (i < k).
\r
1248 // distance.at<float>(queryIdx, i) will contain distance.
\r
1249 // allDist is a buffer to store all distance between query descriptors and train descriptors
\r
1250 // it have size (nQuery,nTrain) and CV_32F type
\r
1251 // allDist.at<float>(queryIdx, trainIdx) will contain FLT_MAX, if trainIdx is one from k best,
\r
1252 // otherwise it will contain distance between queryIdx and trainIdx descriptors
\r
1253 void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1254 GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat());
\r
1256 // Download trainIdx and distance to CPU vector with DMatch
\r
1257 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1258 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1259 // matches vector will not contain matches for fully masked out query descriptors.
\r
1260 static void knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance,
\r
1261 std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
\r
1263 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1264 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1265 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1266 // matches vector will not contain matches for fully masked out query descriptors.
\r
1267 void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1268 std::vector< std::vector<DMatch> >& matches, int k, const GpuMat& mask = GpuMat(),
\r
1269 bool compactResult = false);
\r
1271 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1272 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1273 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1274 // matches vector will not contain matches for fully masked out query descriptors.
\r
1275 void knnMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >& matches, int knn,
\r
1276 const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false );
\r
1278 // Find best matches for each query descriptor which have distance less than maxDistance.
\r
1279 // nMatches.at<unsigned int>(0, queruIdx) will contain matches count for queryIdx.
\r
1280 // carefully nMatches can be greater than trainIdx.cols - it means that matcher didn't find all matches,
\r
1281 // because it didn't have enough memory.
\r
1282 // trainIdx.at<int>(queruIdx, i) will contain ith train index (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))
\r
1283 // distance.at<int>(queruIdx, i) will contain ith distance (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))
\r
1284 // If trainIdx is empty, then trainIdx and distance will be created with size nQuery x nTrain,
\r
1285 // otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
\r
1286 // Matches doesn't sorted.
\r
1287 void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1288 GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance, float maxDistance,
\r
1289 const GpuMat& mask = GpuMat());
\r
1291 // Download trainIdx, nMatches and distance to CPU vector with DMatch.
\r
1292 // matches will be sorted in increasing order of distances.
\r
1293 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1294 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1295 // matches vector will not contain matches for fully masked out query descriptors.
\r
1296 static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& nMatches, const GpuMat& distance,
\r
1297 std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
\r
1299 // Find best matches for each query descriptor which have distance less than maxDistance
\r
1300 // in increasing order of distances).
\r
1301 void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1302 std::vector< std::vector<DMatch> >& matches, float maxDistance,
\r
1303 const GpuMat& mask = GpuMat(), bool compactResult = false);
\r
1305 // Find best matches from train collection for each query descriptor which have distance less than
\r
1306 // maxDistance (in increasing order of distances).
\r
1307 void radiusMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >& matches, float maxDistance,
\r
1308 const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false);
\r
1311 DistType distType;
\r
1313 std::vector<GpuMat> trainDescCollection;
\r
1316 template <class Distance>
\r
1317 class CV_EXPORTS BruteForceMatcher_GPU;
\r
1319 template <typename T>
\r
1320 class CV_EXPORTS BruteForceMatcher_GPU< L1<T> > : public BruteForceMatcher_GPU_base
\r
1323 explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L1Dist) {}
\r
1324 explicit BruteForceMatcher_GPU(L1<T> /*d*/) : BruteForceMatcher_GPU_base(L1Dist) {}
\r
1326 template <typename T>
\r
1327 class CV_EXPORTS BruteForceMatcher_GPU< L2<T> > : public BruteForceMatcher_GPU_base
\r
1330 explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L2Dist) {}
\r
1331 explicit BruteForceMatcher_GPU(L2<T> /*d*/) : BruteForceMatcher_GPU_base(L2Dist) {}
\r
1334 ////////////////////////////////// CascadeClassifier //////////////////////////////////////////
\r
1335 // The cascade classifier class for object detection.
\r
1336 class CV_EXPORTS CascadeClassifier
\r
1339 struct CV_EXPORTS DTreeNode
\r
1342 float threshold; // for ordered features only
\r
1347 struct CV_EXPORTS DTree
\r
1352 struct CV_EXPORTS Stage
\r
1359 enum { BOOST = 0 };
\r
1360 enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };
\r
1362 CascadeClassifier();
\r
1363 CascadeClassifier(const string& filename);
\r
1364 ~CascadeClassifier();
\r
1366 bool empty() const;
\r
1367 bool load(const string& filename);
\r
1368 bool read(const FileNode& node);
\r
1370 void detectMultiScale( const Mat& image, vector<Rect>& objects, double scaleFactor=1.1,
\r
1371 int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size());
\r
1373 bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
\r
1374 int runAt( Ptr<FeatureEvaluator>&, Point );
\r
1376 bool isStumpBased;
\r
1383 vector<Stage> stages;
\r
1384 vector<DTree> classifiers;
\r
1385 vector<DTreeNode> nodes;
\r
1386 vector<float> leaves;
\r
1387 vector<int> subsets;
\r
1389 Ptr<FeatureEvaluator> feval;
\r
1390 Ptr<CvHaarClassifierCascade> oldCascade;
\r
1393 ////////////////////////////////// SURF //////////////////////////////////////////
\r
1395 struct CV_EXPORTS SURFParams_GPU
\r
1397 SURFParams_GPU() :
\r
1401 initialScale(2.f),
\r
1412 featuresRatio(0.01f)
\r
1416 //! The interest operator threshold
\r
1418 //! The number of octaves to process
\r
1420 //! The number of intervals in each octave
\r
1422 //! The scale associated with the first interval of the first octave
\r
1423 float initialScale;
\r
1425 //! mask parameter l_1
\r
1427 //! mask parameter l_2
\r
1429 //! mask parameter l_3
\r
1431 //! mask parameter l_4
\r
1433 //! The amount to scale the edge rejection mask
\r
1435 //! The initial sampling step in pixels.
\r
1438 //! True, if generate 128-len descriptors, false - 64-len descriptors
\r
1441 //! max features = featuresRatio * img.size().srea()
\r
1442 float featuresRatio;
\r
1445 class CV_EXPORTS SURF_GPU : public SURFParams_GPU
\r
1448 //! returns the descriptor size in float's (64 or 128)
\r
1449 int descriptorSize() const;
\r
1451 //! upload host keypoints to device memory
\r
1452 static void uploadKeypoints(const vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);
\r
1453 //! download keypoints from device to host memory
\r
1454 static void downloadKeypoints(const GpuMat& keypointsGPU, vector<KeyPoint>& keypoints);
\r
1456 //! download descriptors from device to host memory
\r
1457 static void downloadDescriptors(const GpuMat& descriptorsGPU, vector<float>& descriptors);
\r
1459 //! finds the keypoints using fast hessian detector used in SURF
\r
1460 //! supports CV_8UC1 images
\r
1461 //! keypoints will have 1 row and type CV_32FC(6)
\r
1462 //! keypoints.at<float[6]>(1, i) contains i'th keypoint
\r
1463 //! format: (x, y, size, response, angle, octave)
\r
1464 void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints);
\r
1465 //! finds the keypoints and computes their descriptors.
\r
1466 //! Optionally it can compute descriptors for the user-provided keypoints and recompute keypoints direction
\r
1467 void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints, GpuMat& descriptors,
\r
1468 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1470 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints);
\r
1471 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
\r
1472 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1474 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors,
\r
1475 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1483 GpuMat hessianBuffer;
\r
1484 GpuMat maxPosBuffer;
\r
1485 GpuMat featuresBuffer;
\r
1490 //! Speckle filtering - filters small connected components on diparity image.
\r
1491 //! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize.
\r
1492 //! Threshold for border between CC is diffThreshold;
\r
1493 CV_EXPORTS void filterSpeckles( Mat& img, uchar newVal, int maxSpeckleSize, uchar diffThreshold, Mat& buf);
\r
1496 #include "opencv2/gpu/matrix_operations.hpp"
\r
1498 #endif /* __OPENCV_GPU_HPP__ */
\r