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 //! computes the proximity map for the raster template and the image where the template is searched for
\r
632 CV_EXPORTS void matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method);
\r
635 ////////////////////////////// Matrix reductions //////////////////////////////
\r
637 //! computes mean value and standard deviation of all or selected array elements
\r
638 //! supports only CV_8UC1 type
\r
639 CV_EXPORTS void meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev);
\r
641 //! computes norm of array
\r
642 //! supports NORM_INF, NORM_L1, NORM_L2
\r
643 //! supports only CV_8UC1 type
\r
644 CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);
\r
646 //! computes norm of the difference between two arrays
\r
647 //! supports NORM_INF, NORM_L1, NORM_L2
\r
648 //! supports only CV_8UC1 type
\r
649 CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2);
\r
651 //! computes sum of array elements
\r
652 //! supports only single channel images
\r
653 CV_EXPORTS Scalar sum(const GpuMat& src);
\r
655 //! computes sum of array elements
\r
656 //! supports only single channel images
\r
657 CV_EXPORTS Scalar sum(const GpuMat& src, GpuMat& buf);
\r
659 //! computes squared sum of array elements
\r
660 //! supports only single channel images
\r
661 CV_EXPORTS Scalar sqrSum(const GpuMat& src);
\r
663 //! computes squared sum of array elements
\r
664 //! supports only single channel images
\r
665 CV_EXPORTS Scalar sqrSum(const GpuMat& src, GpuMat& buf);
\r
667 //! finds global minimum and maximum array elements and returns their values
\r
668 CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat());
\r
670 //! finds global minimum and maximum array elements and returns their values
\r
671 CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf);
\r
673 //! finds global minimum and maximum array elements and returns their values with locations
\r
674 CV_EXPORTS void minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0,
\r
675 const GpuMat& mask=GpuMat());
\r
677 //! finds global minimum and maximum array elements and returns their values with locations
\r
678 CV_EXPORTS void minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc,
\r
679 const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf);
\r
681 //! counts non-zero array elements
\r
682 CV_EXPORTS int countNonZero(const GpuMat& src);
\r
684 //! counts non-zero array elements
\r
685 CV_EXPORTS int countNonZero(const GpuMat& src, GpuMat& buf);
\r
688 //////////////////////////////// Filter Engine ////////////////////////////////
\r
691 The Base Class for 1D or Row-wise Filters
\r
693 This is the base class for linear or non-linear filters that process 1D data.
\r
694 In particular, such filters are used for the "horizontal" filtering parts in separable filters.
\r
696 class CV_EXPORTS BaseRowFilter_GPU
\r
699 BaseRowFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
700 virtual ~BaseRowFilter_GPU() {}
\r
701 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
706 The Base Class for Column-wise Filters
\r
708 This is the base class for linear or non-linear filters that process columns of 2D arrays.
\r
709 Such filters are used for the "vertical" filtering parts in separable filters.
\r
711 class CV_EXPORTS BaseColumnFilter_GPU
\r
714 BaseColumnFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
715 virtual ~BaseColumnFilter_GPU() {}
\r
716 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
721 The Base Class for Non-Separable 2D Filters.
\r
723 This is the base class for linear or non-linear 2D filters.
\r
725 class CV_EXPORTS BaseFilter_GPU
\r
728 BaseFilter_GPU(const Size& ksize_, const Point& anchor_) : ksize(ksize_), anchor(anchor_) {}
\r
729 virtual ~BaseFilter_GPU() {}
\r
730 virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
\r
736 The Base Class for Filter Engine.
\r
738 The class can be used to apply an arbitrary filtering operation to an image.
\r
739 It contains all the necessary intermediate buffers.
\r
741 class CV_EXPORTS FilterEngine_GPU
\r
744 virtual ~FilterEngine_GPU() {}
\r
746 virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1)) = 0;
\r
749 //! returns the non-separable filter engine with the specified filter
\r
750 CV_EXPORTS Ptr<FilterEngine_GPU> createFilter2D_GPU(const Ptr<BaseFilter_GPU> filter2D, int srcType, int dstType);
\r
752 //! returns the separable filter engine with the specified filters
\r
753 CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,
\r
754 const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType);
\r
756 //! returns horizontal 1D box filter
\r
757 //! supports only CV_8UC1 source type and CV_32FC1 sum type
\r
758 CV_EXPORTS Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1);
\r
760 //! returns vertical 1D box filter
\r
761 //! supports only CV_8UC1 sum type and CV_32FC1 dst type
\r
762 CV_EXPORTS Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1);
\r
764 //! returns 2D box filter
\r
765 //! supports CV_8UC1 and CV_8UC4 source type, dst type must be the same as source type
\r
766 CV_EXPORTS Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1));
\r
768 //! returns box filter engine
\r
769 CV_EXPORTS Ptr<FilterEngine_GPU> createBoxFilter_GPU(int srcType, int dstType, const Size& ksize,
\r
770 const Point& anchor = Point(-1,-1));
\r
772 //! returns 2D morphological filter
\r
773 //! only MORPH_ERODE and MORPH_DILATE are supported
\r
774 //! supports CV_8UC1 and CV_8UC4 types
\r
775 //! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height
\r
776 CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,
\r
777 Point anchor=Point(-1,-1));
\r
779 //! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
\r
780 CV_EXPORTS Ptr<FilterEngine_GPU> createMorphologyFilter_GPU(int op, int type, const Mat& kernel,
\r
781 const Point& anchor = Point(-1,-1), int iterations = 1);
\r
783 //! returns 2D filter with the specified kernel
\r
784 //! supports CV_8UC1 and CV_8UC4 types
\r
785 CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,
\r
786 Point anchor = Point(-1, -1));
\r
788 //! returns the non-separable linear filter engine
\r
789 CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,
\r
790 const Point& anchor = Point(-1,-1));
\r
792 //! returns the primitive row filter with the specified kernel.
\r
793 //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 source type.
\r
794 //! there are two version of algorithm: NPP and OpenCV.
\r
795 //! NPP calls when srcType == CV_8UC1 or srcType == CV_8UC4 and bufType == srcType,
\r
796 //! otherwise calls OpenCV version.
\r
797 //! NPP supports only BORDER_CONSTANT border type.
\r
798 //! OpenCV version supports only CV_32F as buffer depth and
\r
799 //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.
\r
800 CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,
\r
801 int anchor = -1, int borderType = BORDER_CONSTANT);
\r
803 //! returns the primitive column filter with the specified kernel.
\r
804 //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 dst type.
\r
805 //! there are two version of algorithm: NPP and OpenCV.
\r
806 //! NPP calls when dstType == CV_8UC1 or dstType == CV_8UC4 and bufType == dstType,
\r
807 //! otherwise calls OpenCV version.
\r
808 //! NPP supports only BORDER_CONSTANT border type.
\r
809 //! OpenCV version supports only CV_32F as buffer depth and
\r
810 //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.
\r
811 CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,
\r
812 int anchor = -1, int borderType = BORDER_CONSTANT);
\r
814 //! returns the separable linear filter engine
\r
815 CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,
\r
816 const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT,
\r
817 int columnBorderType = -1);
\r
819 //! returns filter engine for the generalized Sobel operator
\r
820 CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize,
\r
821 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
823 //! returns the Gaussian filter engine
\r
824 CV_EXPORTS Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigma1, double sigma2 = 0,
\r
825 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
827 //! returns maximum filter
\r
828 CV_EXPORTS Ptr<BaseFilter_GPU> getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));
\r
830 //! returns minimum filter
\r
831 CV_EXPORTS Ptr<BaseFilter_GPU> getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));
\r
833 //! smooths the image using the normalized box filter
\r
834 //! supports CV_8UC1, CV_8UC4 types
\r
835 CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1));
\r
837 //! a synonym for normalized box filter
\r
838 static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, -1, ksize, anchor); }
\r
840 //! erodes the image (applies the local minimum operator)
\r
841 CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
843 //! dilates the image (applies the local maximum operator)
\r
844 CV_EXPORTS void dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
846 //! applies an advanced morphological operation to the image
\r
847 CV_EXPORTS void morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);
\r
849 //! applies non-separable 2D linear filter to the image
\r
850 CV_EXPORTS void filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1));
\r
852 //! applies separable 2D linear filter to the image
\r
853 CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,
\r
854 Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
856 //! applies generalized Sobel operator to the image
\r
857 CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1,
\r
858 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
860 //! applies the vertical or horizontal Scharr operator to the image
\r
861 CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1,
\r
862 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
864 //! smooths the image using Gaussian filter.
\r
865 CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2 = 0,
\r
866 int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);
\r
868 //! applies Laplacian operator to the image
\r
869 //! supports only ksize = 1 and ksize = 3
\r
870 CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1);
\r
872 //////////////////////////////// Image Labeling ////////////////////////////////
\r
874 //!performs labeling via graph cuts
\r
875 CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf);
\r
877 ////////////////////////////////// Histograms //////////////////////////////////
\r
879 //! Compute levels with even distribution. levels will have 1 row and nLevels cols and CV_32SC1 type.
\r
880 CV_EXPORTS void evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel);
\r
881 //! Calculates histogram with evenly distributed bins for signle channel source.
\r
882 //! Supports CV_8UC1, CV_16UC1 and CV_16SC1 source types.
\r
883 //! Output hist will have one row and histSize cols and CV_32SC1 type.
\r
884 CV_EXPORTS void histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel);
\r
885 //! Calculates histogram with evenly distributed bins for four-channel source.
\r
886 //! All channels of source are processed separately.
\r
887 //! Supports CV_8UC4, CV_16UC4 and CV_16SC4 source types.
\r
888 //! Output hist[i] will have one row and histSize[i] cols and CV_32SC1 type.
\r
889 CV_EXPORTS void histEven(const GpuMat& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4]);
\r
890 //! Calculates histogram with bins determined by levels array.
\r
891 //! levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
\r
892 //! Supports CV_8UC1, CV_16UC1, CV_16SC1 and CV_32FC1 source types.
\r
893 //! Output hist will have one row and (levels.cols-1) cols and CV_32SC1 type.
\r
894 CV_EXPORTS void histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels);
\r
895 //! Calculates histogram with bins determined by levels array.
\r
896 //! All levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
\r
897 //! All channels of source are processed separately.
\r
898 //! Supports CV_8UC4, CV_16UC4, CV_16SC4 and CV_32FC4 source types.
\r
899 //! Output hist[i] will have one row and (levels[i].cols-1) cols and CV_32SC1 type.
\r
900 CV_EXPORTS void histRange(const GpuMat& src, GpuMat hist[4], const GpuMat levels[4]);
\r
902 //////////////////////////////// StereoBM_GPU ////////////////////////////////
\r
904 class CV_EXPORTS StereoBM_GPU
\r
907 enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 };
\r
909 enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 };
\r
911 //! the default constructor
\r
913 //! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8.
\r
914 StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ);
\r
916 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair
\r
917 //! Output disparity has CV_8U type.
\r
918 void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
921 void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream & stream);
\r
923 //! Some heuristics that tries to estmate
\r
924 // if current GPU will be faster then CPU in this algorithm.
\r
925 // It queries current active device.
\r
926 static bool checkIfGpuCallReasonable();
\r
932 // If avergeTexThreshold == 0 => post procesing is disabled
\r
933 // If avergeTexThreshold != 0 then disparity is set 0 in each point (x,y) where for left image
\r
934 // SumOfHorizontalGradiensInWindow(x, y, winSize) < (winSize * winSize) * avergeTexThreshold
\r
935 // i.e. input left image is low textured.
\r
936 float avergeTexThreshold;
\r
938 GpuMat minSSD, leBuf, riBuf;
\r
941 ////////////////////////// StereoBeliefPropagation ///////////////////////////
\r
942 // "Efficient Belief Propagation for Early Vision"
\r
945 class CV_EXPORTS StereoBeliefPropagation
\r
948 enum { DEFAULT_NDISP = 64 };
\r
949 enum { DEFAULT_ITERS = 5 };
\r
950 enum { DEFAULT_LEVELS = 5 };
\r
952 static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels);
\r
954 //! the default constructor
\r
955 explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP,
\r
956 int iters = DEFAULT_ITERS,
\r
957 int levels = DEFAULT_LEVELS,
\r
958 int msg_type = CV_32F);
\r
960 //! the full constructor taking the number of disparities, number of BP iterations on each level,
\r
961 //! number of levels, truncation of data cost, data weight,
\r
962 //! truncation of discontinuity cost and discontinuity single jump
\r
963 //! DataTerm = data_weight * min(fabs(I2-I1), max_data_term)
\r
964 //! DiscTerm = min(disc_single_jump * fabs(f1-f2), max_disc_term)
\r
965 //! please see paper for more details
\r
966 StereoBeliefPropagation(int ndisp, int iters, int levels,
\r
967 float max_data_term, float data_weight,
\r
968 float max_disc_term, float disc_single_jump,
\r
969 int msg_type = CV_32F);
\r
971 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
\r
972 //! if disparity is empty output type will be CV_16S else output type will be disparity.type().
\r
973 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
976 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);
\r
979 //! version for user specified data term
\r
980 void operator()(const GpuMat& data, GpuMat& disparity);
\r
981 void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);
\r
988 float max_data_term;
\r
990 float max_disc_term;
\r
991 float disc_single_jump;
\r
995 GpuMat u, d, l, r, u2, d2, l2, r2;
\r
996 std::vector<GpuMat> datas;
\r
1000 /////////////////////////// StereoConstantSpaceBP ///////////////////////////
\r
1001 // "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
\r
1002 // Qingxiong Yang, Liang Wang
\86, Narendra Ahuja
\r
1003 // http://vision.ai.uiuc.edu/~qyang6/
\r
1005 class CV_EXPORTS StereoConstantSpaceBP
\r
1008 enum { DEFAULT_NDISP = 128 };
\r
1009 enum { DEFAULT_ITERS = 8 };
\r
1010 enum { DEFAULT_LEVELS = 4 };
\r
1011 enum { DEFAULT_NR_PLANE = 4 };
\r
1013 static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane);
\r
1015 //! the default constructor
\r
1016 explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP,
\r
1017 int iters = DEFAULT_ITERS,
\r
1018 int levels = DEFAULT_LEVELS,
\r
1019 int nr_plane = DEFAULT_NR_PLANE,
\r
1020 int msg_type = CV_32F);
\r
1022 //! the full constructor taking the number of disparities, number of BP iterations on each level,
\r
1023 //! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
\r
1024 //! truncation of discontinuity cost, discontinuity single jump and minimum disparity threshold
\r
1025 StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane,
\r
1026 float max_data_term, float data_weight, float max_disc_term, float disc_single_jump,
\r
1027 int min_disp_th = 0,
\r
1028 int msg_type = CV_32F);
\r
1030 //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
\r
1031 //! if disparity is empty output type will be CV_16S else output type will be disparity.type().
\r
1032 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);
\r
1035 void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);
\r
1044 float max_data_term;
\r
1045 float data_weight;
\r
1046 float max_disc_term;
\r
1047 float disc_single_jump;
\r
1053 bool use_local_init_data_cost;
\r
1055 GpuMat u[2], d[2], l[2], r[2];
\r
1056 GpuMat disp_selected_pyr[2];
\r
1059 GpuMat data_cost_selected;
\r
1066 /////////////////////////// DisparityBilateralFilter ///////////////////////////
\r
1067 // Disparity map refinement using joint bilateral filtering given a single color image.
\r
1068 // Qingxiong Yang, Liang Wang
\86, Narendra Ahuja
\r
1069 // http://vision.ai.uiuc.edu/~qyang6/
\r
1071 class CV_EXPORTS DisparityBilateralFilter
\r
1074 enum { DEFAULT_NDISP = 64 };
\r
1075 enum { DEFAULT_RADIUS = 3 };
\r
1076 enum { DEFAULT_ITERS = 1 };
\r
1078 //! the default constructor
\r
1079 explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS);
\r
1081 //! the full constructor taking the number of disparities, filter radius,
\r
1082 //! number of iterations, truncation of data continuity, truncation of disparity continuity
\r
1083 //! and filter range sigma
\r
1084 DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range);
\r
1086 //! the disparity map refinement operator. Refine disparity map using joint bilateral filtering given a single color image.
\r
1087 //! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.
\r
1088 void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst);
\r
1091 void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream);
\r
1098 float edge_threshold;
\r
1099 float max_disc_threshold;
\r
1100 float sigma_range;
\r
1102 GpuMat table_color;
\r
1103 GpuMat table_space;
\r
1107 //////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
\r
1109 struct CV_EXPORTS HOGDescriptor
\r
1112 enum { DEFAULT_WIN_SIGMA = -1 };
\r
1113 enum { DEFAULT_NLEVELS = 64 };
\r
1114 enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };
\r
1116 HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
\r
1117 Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
\r
1118 int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
\r
1119 double threshold_L2hys=0.2, bool gamma_correction=true,
\r
1120 int nlevels=DEFAULT_NLEVELS);
\r
1122 size_t getDescriptorSize() const;
\r
1123 size_t getBlockHistogramSize() const;
\r
1124 double getWinSigma() const;
\r
1126 static vector<float> getDefaultPeopleDetector();
\r
1127 static vector<float> getPeopleDetector_48x96();
\r
1128 static vector<float> getPeopleDetector_64x128();
\r
1129 void setSVMDetector(const vector<float>& detector);
\r
1130 bool checkDetectorSize() const;
\r
1132 void detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0,
\r
1133 Size win_stride=Size(), Size padding=Size());
\r
1134 void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,
\r
1135 double hit_threshold=0, Size win_stride=Size(), Size padding=Size(),
\r
1136 double scale0=1.05, int group_threshold=2);
\r
1138 void getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors,
\r
1139 int descr_format=DESCR_FORMAT_COL_BY_COL);
\r
1143 Size block_stride;
\r
1147 double threshold_L2hys;
\r
1148 bool gamma_correction;
\r
1152 void computeBlockHistograms(const GpuMat& img);
\r
1153 void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle);
\r
1155 static int numPartsWithin(int size, int part_size, int stride);
\r
1156 static Size numPartsWithin(Size size, Size part_size, Size stride);
\r
1158 // Coefficients of the separating plane
\r
1162 // Results of the last classification step
\r
1166 // Results of the last histogram evaluation step
\r
1167 GpuMat block_hists;
\r
1169 // Gradients conputation results
\r
1170 GpuMat grad, qangle;
\r
1174 ////////////////////////////////// BruteForceMatcher //////////////////////////////////
\r
1176 class CV_EXPORTS BruteForceMatcher_GPU_base
\r
1179 enum DistType {L1Dist = 0, L2Dist};
\r
1181 explicit BruteForceMatcher_GPU_base(DistType distType = L2Dist);
\r
1183 // Add descriptors to train descriptor collection.
\r
1184 void add(const std::vector<GpuMat>& descCollection);
\r
1186 // Get train descriptors collection.
\r
1187 const std::vector<GpuMat>& getTrainDescriptors() const;
\r
1189 // Clear train descriptors collection.
\r
1192 // Return true if there are not train descriptors in collection.
\r
1193 bool empty() const;
\r
1195 // Return true if the matcher supports mask in match methods.
\r
1196 bool isMaskSupported() const;
\r
1198 // Find one best match for each query descriptor.
\r
1199 // trainIdx.at<int>(0, queryIdx) will contain best train index for queryIdx
\r
1200 // distance.at<float>(0, queryIdx) will contain distance
\r
1201 void matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1202 GpuMat& trainIdx, GpuMat& distance,
\r
1203 const GpuMat& mask = GpuMat());
\r
1205 // Download trainIdx and distance to CPU vector with DMatch
\r
1206 static void matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector<DMatch>& matches);
\r
1208 // Find one best match for each query descriptor.
\r
1209 void match(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector<DMatch>& matches,
\r
1210 const GpuMat& mask = GpuMat());
\r
1212 // Make gpu collection of trains and masks in suitable format for matchCollection function
\r
1213 void makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection,
\r
1214 const vector<GpuMat>& masks = std::vector<GpuMat>());
\r
1216 // Find one best match from train collection for each query descriptor.
\r
1217 // trainIdx.at<int>(0, queryIdx) will contain best train index for queryIdx
\r
1218 // imgIdx.at<int>(0, queryIdx) will contain best image index for queryIdx
\r
1219 // distance.at<float>(0, queryIdx) will contain distance
\r
1220 void matchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection,
\r
1221 GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
\r
1222 const GpuMat& maskCollection);
\r
1224 // Download trainIdx, imgIdx and distance to CPU vector with DMatch
\r
1225 static void matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx, const GpuMat& distance,
\r
1226 std::vector<DMatch>& matches);
\r
1228 // Find one best match from train collection for each query descriptor.
\r
1229 void match(const GpuMat& queryDescs, std::vector<DMatch>& matches,
\r
1230 const std::vector<GpuMat>& masks = std::vector<GpuMat>());
\r
1232 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1233 // trainIdx.at<int>(queryIdx, i) will contain index of i'th best trains (i < k).
\r
1234 // distance.at<float>(queryIdx, i) will contain distance.
\r
1235 // allDist is a buffer to store all distance between query descriptors and train descriptors
\r
1236 // it have size (nQuery,nTrain) and CV_32F type
\r
1237 // allDist.at<float>(queryIdx, trainIdx) will contain FLT_MAX, if trainIdx is one from k best,
\r
1238 // otherwise it will contain distance between queryIdx and trainIdx descriptors
\r
1239 void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1240 GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat());
\r
1242 // Download trainIdx and distance to CPU vector with DMatch
\r
1243 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1244 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1245 // matches vector will not contain matches for fully masked out query descriptors.
\r
1246 static void knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance,
\r
1247 std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
\r
1249 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1250 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1251 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1252 // matches vector will not contain matches for fully masked out query descriptors.
\r
1253 void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1254 std::vector< std::vector<DMatch> >& matches, int k, const GpuMat& mask = GpuMat(),
\r
1255 bool compactResult = false);
\r
1257 // Find k best matches for each query descriptor (in increasing order of distances).
\r
1258 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1259 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1260 // matches vector will not contain matches for fully masked out query descriptors.
\r
1261 void knnMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >& matches, int knn,
\r
1262 const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false );
\r
1264 // Find best matches for each query descriptor which have distance less than maxDistance.
\r
1265 // nMatches.at<unsigned int>(0, queruIdx) will contain matches count for queryIdx.
\r
1266 // carefully nMatches can be greater than trainIdx.cols - it means that matcher didn't find all matches,
\r
1267 // because it didn't have enough memory.
\r
1268 // trainIdx.at<int>(queruIdx, i) will contain ith train index (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))
\r
1269 // distance.at<int>(queruIdx, i) will contain ith distance (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))
\r
1270 // If trainIdx is empty, then trainIdx and distance will be created with size nQuery x nTrain,
\r
1271 // otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches
\r
1272 // Matches doesn't sorted.
\r
1273 void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1274 GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance, float maxDistance,
\r
1275 const GpuMat& mask = GpuMat());
\r
1277 // Download trainIdx, nMatches and distance to CPU vector with DMatch.
\r
1278 // matches will be sorted in increasing order of distances.
\r
1279 // compactResult is used when mask is not empty. If compactResult is false matches
\r
1280 // vector will have the same size as queryDescriptors rows. If compactResult is true
\r
1281 // matches vector will not contain matches for fully masked out query descriptors.
\r
1282 static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& nMatches, const GpuMat& distance,
\r
1283 std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
\r
1285 // Find best matches for each query descriptor which have distance less than maxDistance
\r
1286 // in increasing order of distances).
\r
1287 void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
\r
1288 std::vector< std::vector<DMatch> >& matches, float maxDistance,
\r
1289 const GpuMat& mask = GpuMat(), bool compactResult = false);
\r
1291 // Find best matches from train collection for each query descriptor which have distance less than
\r
1292 // maxDistance (in increasing order of distances).
\r
1293 void radiusMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >& matches, float maxDistance,
\r
1294 const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false);
\r
1297 DistType distType;
\r
1299 std::vector<GpuMat> trainDescCollection;
\r
1302 template <class Distance>
\r
1303 class CV_EXPORTS BruteForceMatcher_GPU;
\r
1305 template <typename T>
\r
1306 class CV_EXPORTS BruteForceMatcher_GPU< L1<T> > : public BruteForceMatcher_GPU_base
\r
1309 explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L1Dist) {}
\r
1310 explicit BruteForceMatcher_GPU(L1<T> /*d*/) : BruteForceMatcher_GPU_base(L1Dist) {}
\r
1312 template <typename T>
\r
1313 class CV_EXPORTS BruteForceMatcher_GPU< L2<T> > : public BruteForceMatcher_GPU_base
\r
1316 explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L2Dist) {}
\r
1317 explicit BruteForceMatcher_GPU(L2<T> /*d*/) : BruteForceMatcher_GPU_base(L2Dist) {}
\r
1320 ////////////////////////////////// CascadeClassifier //////////////////////////////////////////
\r
1321 // The cascade classifier class for object detection.
\r
1322 class CV_EXPORTS CascadeClassifier
\r
1325 struct CV_EXPORTS DTreeNode
\r
1328 float threshold; // for ordered features only
\r
1333 struct CV_EXPORTS DTree
\r
1338 struct CV_EXPORTS Stage
\r
1345 enum { BOOST = 0 };
\r
1346 enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };
\r
1348 CascadeClassifier();
\r
1349 CascadeClassifier(const string& filename);
\r
1350 ~CascadeClassifier();
\r
1352 bool empty() const;
\r
1353 bool load(const string& filename);
\r
1354 bool read(const FileNode& node);
\r
1356 void detectMultiScale( const Mat& image, vector<Rect>& objects, double scaleFactor=1.1,
\r
1357 int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size());
\r
1359 bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
\r
1360 int runAt( Ptr<FeatureEvaluator>&, Point );
\r
1362 bool isStumpBased;
\r
1369 vector<Stage> stages;
\r
1370 vector<DTree> classifiers;
\r
1371 vector<DTreeNode> nodes;
\r
1372 vector<float> leaves;
\r
1373 vector<int> subsets;
\r
1375 Ptr<FeatureEvaluator> feval;
\r
1376 Ptr<CvHaarClassifierCascade> oldCascade;
\r
1379 ////////////////////////////////// SURF //////////////////////////////////////////
\r
1381 struct CV_EXPORTS SURFParams_GPU
\r
1383 SURFParams_GPU() :
\r
1387 initialScale(2.f),
\r
1398 featuresRatio(0.01f)
\r
1402 //! The interest operator threshold
\r
1404 //! The number of octaves to process
\r
1406 //! The number of intervals in each octave
\r
1408 //! The scale associated with the first interval of the first octave
\r
1409 float initialScale;
\r
1411 //! mask parameter l_1
\r
1413 //! mask parameter l_2
\r
1415 //! mask parameter l_3
\r
1417 //! mask parameter l_4
\r
1419 //! The amount to scale the edge rejection mask
\r
1421 //! The initial sampling step in pixels.
\r
1424 //! True, if generate 128-len descriptors, false - 64-len descriptors
\r
1427 //! max features = featuresRatio * img.size().srea()
\r
1428 float featuresRatio;
\r
1431 class CV_EXPORTS SURF_GPU : public SURFParams_GPU
\r
1434 //! returns the descriptor size in float's (64 or 128)
\r
1435 int descriptorSize() const;
\r
1437 //! upload host keypoints to device memory
\r
1438 static void uploadKeypoints(const vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);
\r
1439 //! download keypoints from device to host memory
\r
1440 static void downloadKeypoints(const GpuMat& keypointsGPU, vector<KeyPoint>& keypoints);
\r
1442 //! download descriptors from device to host memory
\r
1443 static void downloadDescriptors(const GpuMat& descriptorsGPU, vector<float>& descriptors);
\r
1445 //! finds the keypoints using fast hessian detector used in SURF
\r
1446 //! supports CV_8UC1 images
\r
1447 //! keypoints will have 1 row and type CV_32FC(6)
\r
1448 //! keypoints.at<float[6]>(1, i) contains i'th keypoint
\r
1449 //! format: (x, y, size, response, angle, octave)
\r
1450 void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints);
\r
1451 //! finds the keypoints and computes their descriptors.
\r
1452 //! Optionally it can compute descriptors for the user-provided keypoints and recompute keypoints direction
\r
1453 void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints, GpuMat& descriptors,
\r
1454 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1456 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints);
\r
1457 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
\r
1458 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1460 void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors,
\r
1461 bool useProvidedKeypoints = false, bool calcOrientation = true);
\r
1469 GpuMat hessianBuffer;
\r
1470 GpuMat maxPosBuffer;
\r
1471 GpuMat featuresBuffer;
\r
1476 //! Speckle filtering - filters small connected components on diparity image.
\r
1477 //! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize.
\r
1478 //! Threshold for border between CC is diffThreshold;
\r
1479 CV_EXPORTS void filterSpeckles( Mat& img, uchar newVal, int maxSpeckleSize, uchar diffThreshold, Mat& buf);
\r
1482 #include "opencv2/gpu/matrix_operations.hpp"
\r
1484 #endif /* __OPENCV_GPU_HPP__ */
\r