#include "opencv2/core/core.hpp"\r
#include "opencv2/imgproc/imgproc.hpp"\r
#include "opencv2/objdetect/objdetect.hpp"\r
-#include "opencv2/gpu/devmem2d.hpp"\r
#include "opencv2/features2d/features2d.hpp"\r
+#include "opencv2/gpu/gpumat.hpp"\r
\r
namespace cv\r
{\r
FEATURE_SET_COMPUTE_20 = 20,\r
FEATURE_SET_COMPUTE_21 = 21,\r
GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11,\r
+ SHARED_ATOMICS = FEATURE_SET_COMPUTE_12,\r
NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13\r
};\r
\r
CV_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func);\r
CV_EXPORTS void nppError( int err, const char *file, const int line, const char *func);\r
\r
- //////////////////////////////// GpuMat ////////////////////////////////\r
- class Stream;\r
- class CudaMem;\r
-\r
- //! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.\r
- class CV_EXPORTS GpuMat\r
- {\r
- public:\r
- //! default constructor\r
- GpuMat();\r
- //! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)\r
- GpuMat(int rows, int cols, int type);\r
- GpuMat(Size size, int type);\r
- //! constucts GpuMatrix and fills it with the specified value _s.\r
- GpuMat(int rows, int cols, int type, const Scalar& s);\r
- GpuMat(Size size, int type, const Scalar& s);\r
- //! copy constructor\r
- GpuMat(const GpuMat& m);\r
-\r
- //! constructor for GpuMatrix headers pointing to user-allocated data\r
- GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP);\r
- GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP);\r
-\r
- //! creates a matrix header for a part of the bigger matrix\r
- GpuMat(const GpuMat& m, const Range& rowRange, const Range& colRange);\r
- GpuMat(const GpuMat& m, const Rect& roi);\r
-\r
- //! builds GpuMat from Mat. Perfom blocking upload to device.\r
- explicit GpuMat (const Mat& m);\r
-\r
- //! destructor - calls release()\r
- ~GpuMat();\r
-\r
- //! assignment operators\r
- GpuMat& operator = (const GpuMat& m);\r
- //! assignment operator. Perfom blocking upload to device.\r
- GpuMat& operator = (const Mat& m);\r
-\r
- //! returns lightweight DevMem2D_ structure for passing to nvcc-compiled code.\r
- // Contains just image size, data ptr and step.\r
- template <class T> operator DevMem2D_<T>() const;\r
- template <class T> operator PtrStep_<T>() const;\r
-\r
- //! pefroms blocking upload data to GpuMat.\r
- void upload(const cv::Mat& m);\r
-\r
- //! upload async\r
- void upload(const CudaMem& m, Stream& stream);\r
-\r
- //! downloads data from device to host memory. Blocking calls.\r
- operator Mat() const;\r
- void download(cv::Mat& m) const;\r
-\r
- //! download async\r
- void download(CudaMem& m, Stream& stream) const;\r
-\r
- //! returns a new GpuMatrix header for the specified row\r
- GpuMat row(int y) const;\r
- //! returns a new GpuMatrix header for the specified column\r
- GpuMat col(int x) const;\r
- //! ... for the specified row span\r
- GpuMat rowRange(int startrow, int endrow) const;\r
- GpuMat rowRange(const Range& r) const;\r
- //! ... for the specified column span\r
- GpuMat colRange(int startcol, int endcol) const;\r
- GpuMat colRange(const Range& r) const;\r
-\r
- //! returns deep copy of the GpuMatrix, i.e. the data is copied\r
- GpuMat clone() const;\r
- //! copies the GpuMatrix content to "m".\r
- // It calls m.create(this->size(), this->type()).\r
- void copyTo( GpuMat& m ) const;\r
- //! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.\r
- void copyTo( GpuMat& m, const GpuMat& mask ) const;\r
- //! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.\r
- void convertTo( GpuMat& m, int rtype, double alpha=1, double beta=0 ) const;\r
-\r
- void assignTo( GpuMat& m, int type=-1 ) const;\r
-\r
- //! sets every GpuMatrix element to s\r
- GpuMat& operator = (const Scalar& s);\r
- //! sets some of the GpuMatrix elements to s, according to the mask\r
- GpuMat& setTo(const Scalar& s, const GpuMat& mask = GpuMat());\r
- //! creates alternative GpuMatrix header for the same data, with different\r
- // number of channels and/or different number of rows. see cvReshape.\r
- GpuMat reshape(int cn, int rows = 0) const;\r
-\r
- //! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.\r
- // previous data is unreferenced if needed.\r
- void create(int rows, int cols, int type);\r
- void create(Size size, int type);\r
- //! decreases reference counter;\r
- // deallocate the data when reference counter reaches 0.\r
- void release();\r
-\r
- //! swaps with other smart pointer\r
- void swap(GpuMat& mat);\r
-\r
- //! locates GpuMatrix header within a parent GpuMatrix. See below\r
- void locateROI( Size& wholeSize, Point& ofs ) const;\r
- //! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.\r
- GpuMat& adjustROI( int dtop, int dbottom, int dleft, int dright );\r
- //! extracts a rectangular sub-GpuMatrix\r
- // (this is a generalized form of row, rowRange etc.)\r
- GpuMat operator()( Range rowRange, Range colRange ) const;\r
- GpuMat operator()( const Rect& roi ) const;\r
-\r
- //! returns true iff the GpuMatrix data is continuous\r
- // (i.e. when there are no gaps between successive rows).\r
- // similar to CV_IS_GpuMat_CONT(cvGpuMat->type)\r
- bool isContinuous() const;\r
- //! returns element size in bytes,\r
- // similar to CV_ELEM_SIZE(cvMat->type)\r
- size_t elemSize() const;\r
- //! returns the size of element channel in bytes.\r
- size_t elemSize1() const;\r
- //! returns element type, similar to CV_MAT_TYPE(cvMat->type)\r
- int type() const;\r
- //! returns element type, similar to CV_MAT_DEPTH(cvMat->type)\r
- int depth() const;\r
- //! returns element type, similar to CV_MAT_CN(cvMat->type)\r
- int channels() const;\r
- //! returns step/elemSize1()\r
- size_t step1() const;\r
- //! returns GpuMatrix size:\r
- // width == number of columns, height == number of rows\r
- Size size() const;\r
- //! returns true if GpuMatrix data is NULL\r
- bool empty() const;\r
-\r
- //! returns pointer to y-th row\r
- uchar* ptr(int y = 0);\r
- const uchar* ptr(int y = 0) const;\r
-\r
- //! template version of the above method\r
- template<typename _Tp> _Tp* ptr(int y = 0);\r
- template<typename _Tp> const _Tp* ptr(int y = 0) const;\r
-\r
- //! matrix transposition\r
- GpuMat t() const;\r
-\r
- /*! includes several bit-fields:\r
- - the magic signature\r
- - continuity flag\r
- - depth\r
- - number of channels\r
- */\r
- int flags;\r
- //! the number of rows and columns\r
- int rows, cols;\r
- //! a distance between successive rows in bytes; includes the gap if any\r
- size_t step;\r
- //! pointer to the data\r
- uchar* data;\r
-\r
- //! pointer to the reference counter;\r
- // when GpuMatrix points to user-allocated data, the pointer is NULL\r
- int* refcount;\r
-\r
- //! helper fields used in locateROI and adjustROI\r
- uchar* datastart;\r
- uchar* dataend;\r
- };\r
-\r
-//#define TemplatedGpuMat // experimental now, deprecated to use\r
-#ifdef TemplatedGpuMat\r
- #include "GpuMat_BetaDeprecated.hpp"\r
-#endif\r
-\r
- //! Creates continuous GPU matrix\r
- CV_EXPORTS void createContinuous(int rows, int cols, int type, GpuMat& m);\r
-\r
- //! Ensures that size of the given matrix is not less than (rows, cols) size\r
- //! and matrix type is match specified one too\r
- CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m);\r
-\r
//////////////////////////////// CudaMem ////////////////////////////////\r
// CudaMem is limited cv::Mat with page locked memory allocation.\r
// Page locked memory is only needed for async and faster coping to GPU.\r
// It is convertable to cv::Mat header without reference counting\r
// so you can use it with other opencv functions.\r
\r
+ // Page-locks the matrix m memory and maps it for the device(s)\r
+ CV_EXPORTS void registerPageLocked(Mat& m);\r
+ // Unmaps the memory of matrix m, and makes it pageable again.\r
+ CV_EXPORTS void unregisterPageLocked(Mat& m);\r
+\r
class CV_EXPORTS CudaMem\r
{\r
public:\r
\r
explicit Stream(Impl* impl);\r
};\r
+ \r
+\r
+ //////////////////////////////// Filter Engine ////////////////////////////////\r
+\r
+ /*!\r
+ The Base Class for 1D or Row-wise Filters\r
+\r
+ This is the base class for linear or non-linear filters that process 1D data.\r
+ In particular, such filters are used for the "horizontal" filtering parts in separable filters.\r
+ */\r
+ class CV_EXPORTS BaseRowFilter_GPU\r
+ {\r
+ public:\r
+ BaseRowFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}\r
+ virtual ~BaseRowFilter_GPU() {}\r
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
+ int ksize, anchor;\r
+ };\r
+\r
+ /*!\r
+ The Base Class for Column-wise Filters\r
+\r
+ This is the base class for linear or non-linear filters that process columns of 2D arrays.\r
+ Such filters are used for the "vertical" filtering parts in separable filters.\r
+ */\r
+ class CV_EXPORTS BaseColumnFilter_GPU\r
+ {\r
+ public:\r
+ BaseColumnFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}\r
+ virtual ~BaseColumnFilter_GPU() {}\r
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
+ int ksize, anchor;\r
+ };\r
+\r
+ /*!\r
+ The Base Class for Non-Separable 2D Filters.\r
+\r
+ This is the base class for linear or non-linear 2D filters.\r
+ */\r
+ class CV_EXPORTS BaseFilter_GPU\r
+ {\r
+ public:\r
+ BaseFilter_GPU(const Size& ksize_, const Point& anchor_) : ksize(ksize_), anchor(anchor_) {}\r
+ virtual ~BaseFilter_GPU() {}\r
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
+ Size ksize;\r
+ Point anchor;\r
+ };\r
+\r
+ /*!\r
+ The Base Class for Filter Engine.\r
+\r
+ The class can be used to apply an arbitrary filtering operation to an image.\r
+ It contains all the necessary intermediate buffers.\r
+ */\r
+ class CV_EXPORTS FilterEngine_GPU\r
+ {\r
+ public:\r
+ virtual ~FilterEngine_GPU() {}\r
+\r
+ virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) = 0;\r
+ };\r
+\r
+ //! returns the non-separable filter engine with the specified filter\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createFilter2D_GPU(const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType);\r
+\r
+ //! returns the separable filter engine with the specified filters\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,\r
+ const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType);\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,\r
+ const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType, GpuMat& buf);\r
+\r
+ //! returns horizontal 1D box filter\r
+ //! supports only CV_8UC1 source type and CV_32FC1 sum type\r
+ CV_EXPORTS Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1);\r
+\r
+ //! returns vertical 1D box filter\r
+ //! supports only CV_8UC1 sum type and CV_32FC1 dst type\r
+ CV_EXPORTS Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1);\r
+\r
+ //! returns 2D box filter\r
+ //! supports CV_8UC1 and CV_8UC4 source type, dst type must be the same as source type\r
+ CV_EXPORTS Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1));\r
+\r
+ //! returns box filter engine\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createBoxFilter_GPU(int srcType, int dstType, const Size& ksize,\r
+ const Point& anchor = Point(-1,-1));\r
+\r
+ //! returns 2D morphological filter\r
+ //! only MORPH_ERODE and MORPH_DILATE are supported\r
+ //! supports CV_8UC1 and CV_8UC4 types\r
+ //! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height\r
+ CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,\r
+ Point anchor=Point(-1,-1));\r
+\r
+ //! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createMorphologyFilter_GPU(int op, int type, const Mat& kernel,\r
+ const Point& anchor = Point(-1,-1), int iterations = 1);\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createMorphologyFilter_GPU(int op, int type, const Mat& kernel, GpuMat& buf,\r
+ const Point& anchor = Point(-1,-1), int iterations = 1);\r
+\r
+ //! returns 2D filter with the specified kernel\r
+ //! supports CV_8UC1 and CV_8UC4 types\r
+ CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,\r
+ Point anchor = Point(-1, -1));\r
+\r
+ //! returns the non-separable linear filter engine\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,\r
+ const Point& anchor = Point(-1,-1));\r
+\r
+ //! returns the primitive row filter with the specified kernel.\r
+ //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 source type.\r
+ //! there are two version of algorithm: NPP and OpenCV.\r
+ //! NPP calls when srcType == CV_8UC1 or srcType == CV_8UC4 and bufType == srcType,\r
+ //! otherwise calls OpenCV version.\r
+ //! NPP supports only BORDER_CONSTANT border type.\r
+ //! OpenCV version supports only CV_32F as buffer depth and\r
+ //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.\r
+ CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,\r
+ int anchor = -1, int borderType = BORDER_DEFAULT);\r
+\r
+ //! returns the primitive column filter with the specified kernel.\r
+ //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 dst type.\r
+ //! there are two version of algorithm: NPP and OpenCV.\r
+ //! NPP calls when dstType == CV_8UC1 or dstType == CV_8UC4 and bufType == dstType,\r
+ //! otherwise calls OpenCV version.\r
+ //! NPP supports only BORDER_CONSTANT border type.\r
+ //! OpenCV version supports only CV_32F as buffer depth and\r
+ //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.\r
+ CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,\r
+ int anchor = -1, int borderType = BORDER_DEFAULT);\r
+\r
+ //! returns the separable linear filter engine\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,\r
+ const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT,\r
+ int columnBorderType = -1);\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,\r
+ const Mat& columnKernel, GpuMat& buf, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT,\r
+ int columnBorderType = -1);\r
+\r
+ //! returns filter engine for the generalized Sobel operator\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, GpuMat& buf,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+\r
+ //! returns the Gaussian filter engine\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigma1, double sigma2 = 0,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, GpuMat& buf, double sigma1, double sigma2 = 0,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+\r
+ //! returns maximum filter\r
+ CV_EXPORTS Ptr<BaseFilter_GPU> getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));\r
+\r
+ //! returns minimum filter\r
+ CV_EXPORTS Ptr<BaseFilter_GPU> getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));\r
+\r
+ //! smooths the image using the normalized box filter\r
+ //! supports CV_8UC1, CV_8UC4 types\r
+ CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null());\r
+\r
+ //! a synonym for normalized box filter\r
+ static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null()) { boxFilter(src, dst, -1, ksize, anchor, stream); }\r
+\r
+ //! erodes the image (applies the local minimum operator)\r
+ CV_EXPORTS void erode(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);\r
+ CV_EXPORTS void erode(const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
+\r
+ //! dilates the image (applies the local maximum operator)\r
+ CV_EXPORTS void dilate(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);\r
+ CV_EXPORTS void dilate(const GpuMat& src, GpuMat& dst, const Mat& kernel, GpuMat& buf, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
+\r
+ //! applies an advanced morphological operation to the image\r
+ CV_EXPORTS void morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);\r
+ CV_EXPORTS void morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, GpuMat& buf1, GpuMat& buf2, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
+\r
+ //! applies non-separable 2D linear filter to the image\r
+ CV_EXPORTS void filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1), Stream& stream = Stream::Null());\r
+\r
+ //! applies separable 2D linear filter to the image\r
+ CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,\r
+ Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, GpuMat& buf,\r
+ Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
+\r
+ //! applies generalized Sobel operator to the image\r
+ CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, int ksize = 3, double scale = 1,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
+\r
+ //! applies the vertical or horizontal Scharr operator to the image\r
+ CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, GpuMat& buf, double scale = 1,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
+\r
+ //! smooths the image using Gaussian filter.\r
+ CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2 = 0,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
+ CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, GpuMat& buf, double sigma1, double sigma2 = 0,\r
+ int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
+\r
+ //! applies Laplacian operator to the image\r
+ //! supports only ksize = 1 and ksize = 3\r
+ CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, Stream& stream = Stream::Null());\r
\r
\r
////////////////////////////// Arithmetics ///////////////////////////////////\r
//! computes exponent of each matrix element (b = e**a)\r
//! supports only CV_32FC1 type\r
CV_EXPORTS void exp(const GpuMat& a, GpuMat& b, Stream& stream = Stream::Null());\r
+ \r
+ //! computes power of each matrix element:\r
+ // (dst(i,j) = pow( src(i,j) , power), if src.type() is integer\r
+ // (dst(i,j) = pow(fabs(src(i,j)), power), otherwise\r
+ //! supports all, except depth == CV_64F\r
+ CV_EXPORTS void pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! computes natural logarithm of absolute value of each matrix element: b = log(abs(a))\r
//! supports only CV_32FC1 type\r
//! computes per-element maximum of array and scalar (dst = max(src1, src2))\r
CV_EXPORTS void max(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
+ //! computes the weighted sum of two arrays\r
+ CV_EXPORTS void addWeighted(const GpuMat& src1, double alpha, const GpuMat& src2, double beta, double gamma, GpuMat& dst, \r
+ int dtype = -1, Stream& stream = Stream::Null());\r
+\r
\r
////////////////////////////// Image processing //////////////////////////////\r
\r
- //! DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.\r
- //! supports CV_8UC1, CV_8UC3 source types and CV_32FC1 map type\r
- CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap);\r
+ //! DST[x,y] = SRC[xmap[x,y],ymap[x,y]]\r
+ //! supports only CV_32FC1 map type\r
+ CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap,\r
+ int interpolation, int borderMode = BORDER_CONSTANT, const Scalar& borderValue = Scalar(), \r
+ Stream& stream = Stream::Null());\r
\r
//! Does mean shift filtering on GPU.\r
CV_EXPORTS void meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr,\r
CV_EXPORTS double threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxval, int type, Stream& stream = Stream::Null());\r
\r
//! resizes the image\r
- //! Supports INTER_NEAREST, INTER_LINEAR\r
- //! supports CV_8UC1, CV_8UC4 types\r
+ //! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC\r
CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null());\r
\r
//! warps the image using affine transformation\r
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC\r
CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, Stream& stream = Stream::Null());\r
\r
+ //! builds plane warping maps\r
+ CV_EXPORTS void buildWarpPlaneMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, const Mat &T, float scale,\r
+ GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null());\r
+\r
+ //! builds cylindrical warping maps\r
+ CV_EXPORTS void buildWarpCylindricalMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, float scale,\r
+ GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null());\r
+\r
+ //! builds spherical warping maps\r
+ CV_EXPORTS void buildWarpSphericalMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, float scale,\r
+ GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null());\r
+\r
//! rotate 8bit single or four channel image\r
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC\r
//! supports CV_8UC1, CV_8UC4 types\r
CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null());\r
\r
//! copies 2D array to a larger destination array and pads borders with user-specifiable constant\r
- //! supports CV_8UC1, CV_8UC4, CV_32SC1 and CV_32FC1 types\r
- CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar(), Stream& stream = Stream::Null());\r
+ CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, int borderType, const Scalar& value = Scalar(), Stream& stream = Stream::Null());\r
\r
//! computes the integral image\r
//! sum will have CV_32S type, but will contain unsigned int values\r
\r
//! computes Harris cornerness criteria at each image pixel\r
CV_EXPORTS void cornerHarris(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, double k, int borderType=BORDER_REFLECT101);\r
+ CV_EXPORTS void cornerHarris(const GpuMat& src, GpuMat& dst, GpuMat& Dx, GpuMat& Dy, int blockSize, int ksize, double k, int borderType=BORDER_REFLECT101);\r
\r
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria\r
CV_EXPORTS void cornerMinEigenVal(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, int borderType=BORDER_REFLECT101);\r
+ CV_EXPORTS void cornerMinEigenVal(const GpuMat& src, GpuMat& dst, GpuMat& Dx, GpuMat& Dy, int blockSize, int ksize, int borderType=BORDER_REFLECT101);\r
\r
//! performs per-element multiplication of two full (not packed) Fourier spectrums\r
//! supports 32FC2 matrixes only (interleaved format)\r
//! computes the proximity map for the raster template and the image where the template is searched for\r
CV_EXPORTS void matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method);\r
\r
- //! downsamples image\r
- CV_EXPORTS void downsample(const GpuMat& src, GpuMat& dst, int k=2);\r
+ //! smoothes the source image and downsamples it\r
+ CV_EXPORTS void pyrDown(const GpuMat& src, GpuMat& dst, int borderType = BORDER_DEFAULT, Stream& stream = Stream::Null());\r
+\r
+ //! upsamples the source image and then smoothes it\r
+ CV_EXPORTS void pyrUp(const GpuMat& src, GpuMat& dst, int borderType = BORDER_DEFAULT, Stream& stream = Stream::Null());\r
\r
//! performs linear blending of two images\r
//! to avoid accuracy errors sum of weigths shouldn't be very close to zero\r
CV_EXPORTS void blendLinear(const GpuMat& img1, const GpuMat& img2, const GpuMat& weights1, const GpuMat& weights2, \r
GpuMat& result, Stream& stream = Stream::Null());\r
\r
+ \r
+ struct CV_EXPORTS CannyBuf;\r
+ \r
+ CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false);\r
+ CV_EXPORTS void Canny(const GpuMat& image, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false);\r
+ CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false);\r
+ CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false);\r
+\r
+ struct CV_EXPORTS CannyBuf\r
+ {\r
+ CannyBuf() {}\r
+ explicit CannyBuf(const Size& image_size, int apperture_size = 3) {create(image_size, apperture_size);}\r
+ CannyBuf(const GpuMat& dx_, const GpuMat& dy_);\r
+\r
+ void create(const Size& image_size, int apperture_size = 3);\r
+ \r
+ void release();\r
+\r
+ GpuMat dx, dy;\r
+ GpuMat dx_buf, dy_buf;\r
+ GpuMat edgeBuf;\r
+ GpuMat trackBuf1, trackBuf2;\r
+ Ptr<FilterEngine_GPU> filterDX, filterDY;\r
+ };\r
+\r
////////////////////////////// Matrix reductions //////////////////////////////\r
\r
//! computes mean value and standard deviation of all or selected array elements\r
//! counts non-zero array elements\r
CV_EXPORTS int countNonZero(const GpuMat& src, GpuMat& buf);\r
\r
+ //! reduces a matrix to a vector\r
+ CV_EXPORTS void reduce(const GpuMat& mtx, GpuMat& vec, int dim, int reduceOp, int dtype = -1, Stream& stream = Stream::Null());\r
+\r
\r
///////////////////////////// Calibration 3D //////////////////////////////////\r
\r
int num_iters=100, float max_dist=8.0, int min_inlier_count=100, \r
vector<int>* inliers=NULL);\r
\r
- //////////////////////////////// Filter Engine ////////////////////////////////\r
-\r
- /*!\r
- The Base Class for 1D or Row-wise Filters\r
-\r
- This is the base class for linear or non-linear filters that process 1D data.\r
- In particular, such filters are used for the "horizontal" filtering parts in separable filters.\r
- */\r
- class CV_EXPORTS BaseRowFilter_GPU\r
- {\r
- public:\r
- BaseRowFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}\r
- virtual ~BaseRowFilter_GPU() {}\r
- virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
- int ksize, anchor;\r
- };\r
-\r
- /*!\r
- The Base Class for Column-wise Filters\r
-\r
- This is the base class for linear or non-linear filters that process columns of 2D arrays.\r
- Such filters are used for the "vertical" filtering parts in separable filters.\r
- */\r
- class CV_EXPORTS BaseColumnFilter_GPU\r
- {\r
- public:\r
- BaseColumnFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}\r
- virtual ~BaseColumnFilter_GPU() {}\r
- virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
- int ksize, anchor;\r
- };\r
-\r
- /*!\r
- The Base Class for Non-Separable 2D Filters.\r
-\r
- This is the base class for linear or non-linear 2D filters.\r
- */\r
- class CV_EXPORTS BaseFilter_GPU\r
- {\r
- public:\r
- BaseFilter_GPU(const Size& ksize_, const Point& anchor_) : ksize(ksize_), anchor(anchor_) {}\r
- virtual ~BaseFilter_GPU() {}\r
- virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;\r
- Size ksize;\r
- Point anchor;\r
- };\r
-\r
- /*!\r
- The Base Class for Filter Engine.\r
-\r
- The class can be used to apply an arbitrary filtering operation to an image.\r
- It contains all the necessary intermediate buffers.\r
- */\r
- class CV_EXPORTS FilterEngine_GPU\r
- {\r
- public:\r
- virtual ~FilterEngine_GPU() {}\r
-\r
- virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) = 0;\r
- };\r
-\r
- //! returns the non-separable filter engine with the specified filter\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createFilter2D_GPU(const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType);\r
-\r
- //! returns the separable filter engine with the specified filters\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,\r
- const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType);\r
-\r
- //! returns horizontal 1D box filter\r
- //! supports only CV_8UC1 source type and CV_32FC1 sum type\r
- CV_EXPORTS Ptr<BaseRowFilter_GPU> getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1);\r
-\r
- //! returns vertical 1D box filter\r
- //! supports only CV_8UC1 sum type and CV_32FC1 dst type\r
- CV_EXPORTS Ptr<BaseColumnFilter_GPU> getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1);\r
-\r
- //! returns 2D box filter\r
- //! supports CV_8UC1 and CV_8UC4 source type, dst type must be the same as source type\r
- CV_EXPORTS Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1));\r
-\r
- //! returns box filter engine\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createBoxFilter_GPU(int srcType, int dstType, const Size& ksize,\r
- const Point& anchor = Point(-1,-1));\r
-\r
- //! returns 2D morphological filter\r
- //! only MORPH_ERODE and MORPH_DILATE are supported\r
- //! supports CV_8UC1 and CV_8UC4 types\r
- //! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height\r
- CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,\r
- Point anchor=Point(-1,-1));\r
-\r
- //! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createMorphologyFilter_GPU(int op, int type, const Mat& kernel,\r
- const Point& anchor = Point(-1,-1), int iterations = 1);\r
-\r
- //! returns 2D filter with the specified kernel\r
- //! supports CV_8UC1 and CV_8UC4 types\r
- CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,\r
- Point anchor = Point(-1, -1));\r
-\r
- //! returns the non-separable linear filter engine\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,\r
- const Point& anchor = Point(-1,-1));\r
-\r
- //! returns the primitive row filter with the specified kernel.\r
- //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 source type.\r
- //! there are two version of algorithm: NPP and OpenCV.\r
- //! NPP calls when srcType == CV_8UC1 or srcType == CV_8UC4 and bufType == srcType,\r
- //! otherwise calls OpenCV version.\r
- //! NPP supports only BORDER_CONSTANT border type.\r
- //! OpenCV version supports only CV_32F as buffer depth and\r
- //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.\r
- CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,\r
- int anchor = -1, int borderType = BORDER_CONSTANT);\r
-\r
- //! returns the primitive column filter with the specified kernel.\r
- //! supports only CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 dst type.\r
- //! there are two version of algorithm: NPP and OpenCV.\r
- //! NPP calls when dstType == CV_8UC1 or dstType == CV_8UC4 and bufType == dstType,\r
- //! otherwise calls OpenCV version.\r
- //! NPP supports only BORDER_CONSTANT border type.\r
- //! OpenCV version supports only CV_32F as buffer depth and\r
- //! BORDER_REFLECT101, BORDER_REPLICATE and BORDER_CONSTANT border types.\r
- CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,\r
- int anchor = -1, int borderType = BORDER_CONSTANT);\r
-\r
- //! returns the separable linear filter engine\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,\r
- const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT,\r
- int columnBorderType = -1);\r
-\r
- //! returns filter engine for the generalized Sobel operator\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize,\r
- int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
-\r
- //! returns the Gaussian filter engine\r
- CV_EXPORTS Ptr<FilterEngine_GPU> createGaussianFilter_GPU(int type, Size ksize, double sigma1, double sigma2 = 0,\r
- int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1);\r
-\r
- //! returns maximum filter\r
- CV_EXPORTS Ptr<BaseFilter_GPU> getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));\r
-\r
- //! returns minimum filter\r
- CV_EXPORTS Ptr<BaseFilter_GPU> getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));\r
-\r
- //! smooths the image using the normalized box filter\r
- //! supports CV_8UC1, CV_8UC4 types\r
- CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null());\r
-\r
- //! a synonym for normalized box filter\r
- static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null()) { boxFilter(src, dst, -1, ksize, anchor, stream); }\r
-\r
- //! erodes the image (applies the local minimum operator)\r
- CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
-\r
- //! dilates the image (applies the local maximum operator)\r
- CV_EXPORTS void dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
-\r
- //! applies an advanced morphological operation to the image\r
- CV_EXPORTS void morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null());\r
-\r
- //! applies non-separable 2D linear filter to the image\r
- CV_EXPORTS void filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1), Stream& stream = Stream::Null());\r
-\r
- //! applies separable 2D linear filter to the image\r
- CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,\r
- Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
-\r
- //! applies generalized Sobel operator to the image\r
- CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1,\r
- int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
-\r
- //! applies the vertical or horizontal Scharr operator to the image\r
- CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1,\r
- int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
-\r
- //! smooths the image using Gaussian filter.\r
- CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2 = 0,\r
- int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null());\r
-\r
- //! applies Laplacian operator to the image\r
- //! supports only ksize = 1 and ksize = 3\r
- CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, Stream& stream = Stream::Null());\r
-\r
//////////////////////////////// Image Labeling ////////////////////////////////\r
\r
//!performs labeling via graph cuts\r
//! Supports CV_8UC1, CV_16UC1 and CV_16SC1 source types.\r
//! Output hist will have one row and histSize cols and CV_32SC1 type.\r
CV_EXPORTS void histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());\r
+ CV_EXPORTS void histEven(const GpuMat& src, GpuMat& hist, GpuMat& buf, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());\r
//! Calculates histogram with evenly distributed bins for four-channel source.\r
//! All channels of source are processed separately.\r
//! Supports CV_8UC4, CV_16UC4 and CV_16SC4 source types.\r
//! Output hist[i] will have one row and histSize[i] cols and CV_32SC1 type.\r
CV_EXPORTS void histEven(const GpuMat& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null());\r
+ CV_EXPORTS void histEven(const GpuMat& src, GpuMat hist[4], GpuMat& buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null());\r
//! Calculates histogram with bins determined by levels array.\r
//! levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.\r
//! Supports CV_8UC1, CV_16UC1, CV_16SC1 and CV_32FC1 source types.\r
//! Output hist will have one row and (levels.cols-1) cols and CV_32SC1 type.\r
CV_EXPORTS void histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels, Stream& stream = Stream::Null());\r
+ CV_EXPORTS void histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels, GpuMat& buf, Stream& stream = Stream::Null());\r
//! Calculates histogram with bins determined by levels array.\r
//! All levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.\r
//! All channels of source are processed separately.\r
//! Supports CV_8UC4, CV_16UC4, CV_16SC4 and CV_32FC4 source types.\r
//! Output hist[i] will have one row and (levels[i].cols-1) cols and CV_32SC1 type.\r
CV_EXPORTS void histRange(const GpuMat& src, GpuMat hist[4], const GpuMat levels[4], Stream& stream = Stream::Null());\r
+ CV_EXPORTS void histRange(const GpuMat& src, GpuMat hist[4], const GpuMat levels[4], GpuMat& buf, Stream& stream = Stream::Null());\r
+ \r
+ //! Calculates histogram for 8u one channel image\r
+ //! Output hist will have one row, 256 cols and CV32SC1 type.\r
+ CV_EXPORTS void calcHist(const GpuMat& src, GpuMat& hist, Stream& stream = Stream::Null());\r
+ CV_EXPORTS void calcHist(const GpuMat& src, GpuMat& hist, GpuMat& buf, Stream& stream = Stream::Null());\r
+ \r
+ //! normalizes the grayscale image brightness and contrast by normalizing its histogram\r
+ CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null());\r
+ CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, Stream& stream = Stream::Null());\r
+ CV_EXPORTS void equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, GpuMat& buf, Stream& stream = Stream::Null());\r
\r
//////////////////////////////// StereoBM_GPU ////////////////////////////////\r
\r
GpuMat& trainIdx, GpuMat& distance,\r
const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());\r
\r
- // Download trainIdx and distance to CPU vector with DMatch\r
+ // Download trainIdx and distance and convert it to CPU vector with DMatch\r
static void matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector<DMatch>& matches);\r
+ // Convert trainIdx and distance to vector with DMatch\r
+ static void matchConvert(const Mat& trainIdx, const Mat& distance, std::vector<DMatch>& matches);\r
\r
// Find one best match for each query descriptor.\r
void match(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector<DMatch>& matches,\r
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,\r
const GpuMat& maskCollection, Stream& stream = Stream::Null());\r
\r
- // Download trainIdx, imgIdx and distance to CPU vector with DMatch\r
- static void matchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance,\r
- std::vector<DMatch>& matches);\r
+ // Download trainIdx, imgIdx and distance and convert it to vector with DMatch\r
+ static void matchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector<DMatch>& matches);\r
+ // Convert trainIdx, imgIdx and distance to vector with DMatch\r
+ static void matchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector<DMatch>& matches);\r
\r
// Find one best match from train collection for each query descriptor.\r
- void match(const GpuMat& queryDescs, std::vector<DMatch>& matches,\r
- const std::vector<GpuMat>& masks = std::vector<GpuMat>());\r
+ void match(const GpuMat& queryDescs, std::vector<DMatch>& matches, const std::vector<GpuMat>& masks = std::vector<GpuMat>());\r
\r
// Find k best matches for each query descriptor (in increasing order of distances).\r
// trainIdx.at<int>(queryIdx, i) will contain index of i'th best trains (i < k).\r
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,\r
GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());\r
\r
- // Download trainIdx and distance to CPU vector with DMatch\r
+ // Download trainIdx and distance and convert it to vector with DMatch\r
// compactResult is used when mask is not empty. If compactResult is false matches\r
// vector will have the same size as queryDescriptors rows. If compactResult is true\r
// matches vector will not contain matches for fully masked out query descriptors.\r
static void knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance,\r
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
+ // Convert trainIdx and distance to vector with DMatch\r
+ static void knnMatchConvert(const Mat& trainIdx, const Mat& distance,\r
+ std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
\r
// Find k best matches for each query descriptor (in increasing order of distances).\r
// compactResult is used when mask is not empty. If compactResult is false matches\r
const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false );\r
\r
// Find best matches for each query descriptor which have distance less than maxDistance.\r
- // nMatches.at<unsigned int>(0, queruIdx) will contain matches count for queryIdx.\r
+ // nMatches.at<int>(0, queryIdx) will contain matches count for queryIdx.\r
// carefully nMatches can be greater than trainIdx.cols - it means that matcher didn't find all matches,\r
// because it didn't have enough memory.\r
- // trainIdx.at<int>(queruIdx, i) will contain ith train index (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))\r
- // distance.at<int>(queruIdx, i) will contain ith distance (i < min(nMatches.at<unsigned int>(0, queruIdx), trainIdx.cols))\r
- // If trainIdx is empty, then trainIdx and distance will be created with size nQuery x nTrain,\r
+ // trainIdx.at<int>(queruIdx, i) will contain ith train index (i < min(nMatches.at<int>(0, queruIdx), trainIdx.cols))\r
+ // distance.at<int>(queruIdx, i) will contain ith distance (i < min(nMatches.at<int>(0, queruIdx), trainIdx.cols))\r
+ // If trainIdx is empty, then trainIdx and distance will be created with size nQuery x (nTrain / 2),\r
// otherwize user can pass own allocated trainIdx and distance with size nQuery x nMaxMatches\r
// Matches doesn't sorted.\r
- void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,\r
- GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance, float maxDistance,\r
+ void radiusMatchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,\r
+ GpuMat& trainIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance,\r
const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());\r
\r
- // Download trainIdx, nMatches and distance to CPU vector with DMatch.\r
+ // Download trainIdx, nMatches and distance and convert it to vector with DMatch.\r
// matches will be sorted in increasing order of distances.\r
// compactResult is used when mask is not empty. If compactResult is false matches\r
// vector will have the same size as queryDescriptors rows. If compactResult is true\r
// matches vector will not contain matches for fully masked out query descriptors.\r
- static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& nMatches, const GpuMat& distance,\r
+ static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, const GpuMat& nMatches,\r
+ std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
+ // Convert trainIdx, nMatches and distance to vector with DMatch.\r
+ static void radiusMatchConvert(const Mat& trainIdx, const Mat& distance, const Mat& nMatches,\r
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
\r
// Find best matches for each query descriptor which have distance less than maxDistance\r
std::vector< std::vector<DMatch> >& matches, float maxDistance,\r
const GpuMat& mask = GpuMat(), bool compactResult = false);\r
\r
+ // Find best matches for each query descriptor which have distance less than maxDistance.\r
+ // Matches doesn't sorted.\r
+ void radiusMatchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection,\r
+ GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance,\r
+ const GpuMat& maskCollection, Stream& stream = Stream::Null());\r
+\r
+ // Download trainIdx, imgIdx, nMatches and distance and convert it to vector with DMatch.\r
+ // matches will be sorted in increasing order of distances.\r
+ // compactResult is used when mask is not empty. If compactResult is false matches\r
+ // vector will have the same size as queryDescriptors rows. If compactResult is true\r
+ // matches vector will not contain matches for fully masked out query descriptors.\r
+ static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, const GpuMat& nMatches,\r
+ std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
+ // Convert trainIdx, nMatches and distance to vector with DMatch.\r
+ static void radiusMatchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, const Mat& nMatches,\r
+ std::vector< std::vector<DMatch> >& matches, bool compactResult = false);\r
+\r
// Find best matches from train collection for each query descriptor which have distance less than\r
// maxDistance (in increasing order of distances).\r
void radiusMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >& matches, float maxDistance,\r
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors, \r
bool useProvidedKeypoints = false);\r
\r
+ void releaseMemory();\r
+\r
//! max keypoints = min(keypointsRatio * img.size().area(), 65535)\r
float keypointsRatio;\r
\r