#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
CV_EXPORTS int getCudaEnabledDeviceCount();\r
\r
//! Functions below throw cv::Expception if the library is compiled without Cuda.\r
- CV_EXPORTS string getDeviceName(int device);\r
+\r
CV_EXPORTS void setDevice(int device);\r
CV_EXPORTS int getDevice();\r
\r
- CV_EXPORTS void getComputeCapability(int device, int& major, int& minor);\r
- CV_EXPORTS int getNumberOfSMs(int device);\r
+ //! Explicitly destroys and cleans up all resources associated with the current device in the current process. \r
+ //! Any subsequent API call to this device will reinitialize the device.\r
+ CV_EXPORTS void resetDevice();\r
\r
- CV_EXPORTS void getGpuMemInfo(size_t& free, size_t& total);\r
+ enum FeatureSet\r
+ {\r
+ FEATURE_SET_COMPUTE_10 = 10,\r
+ FEATURE_SET_COMPUTE_11 = 11,\r
+ FEATURE_SET_COMPUTE_12 = 12,\r
+ FEATURE_SET_COMPUTE_13 = 13,\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 bool hasNativeDoubleSupport(int device);\r
- CV_EXPORTS bool hasAtomicsSupport(int device);\r
+ // Gives information about what GPU archs this OpenCV GPU module was \r
+ // compiled for\r
+ class CV_EXPORTS TargetArchs\r
+ {\r
+ public:\r
+ static bool builtWith(FeatureSet feature_set);\r
+ static bool has(int major, int minor);\r
+ static bool hasPtx(int major, int minor);\r
+ static bool hasBin(int major, int minor);\r
+ static bool hasEqualOrLessPtx(int major, int minor);\r
+ static bool hasEqualOrGreater(int major, int minor);\r
+ static bool hasEqualOrGreaterPtx(int major, int minor);\r
+ static bool hasEqualOrGreaterBin(int major, int minor);\r
+ private:\r
+ TargetArchs();\r
+ };\r
\r
- //////////////////////////////// Error handling ////////////////////////\r
+ // Gives information about the given GPU\r
+ class CV_EXPORTS DeviceInfo\r
+ {\r
+ public:\r
+ // Creates DeviceInfo object for the current GPU\r
+ DeviceInfo() : device_id_(getDevice()) { query(); }\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
+ // Creates DeviceInfo object for the given GPU\r
+ DeviceInfo(int device_id) : device_id_(device_id) { query(); }\r
\r
- //////////////////////////////// GpuMat ////////////////////////////////\r
- class Stream;\r
- class CudaMem;\r
+ string name() const { return name_; }\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
+ // Return compute capability versions\r
+ int majorVersion() const { return majorVersion_; }\r
+ int minorVersion() const { return minorVersion_; }\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
+ int multiProcessorCount() const { return multi_processor_count_; }\r
\r
- //! returns pointer to y-th row\r
- uchar* ptr(int y = 0);\r
- const uchar* ptr(int y = 0) const;\r
+ size_t freeMemory() const;\r
+ size_t totalMemory() 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
+ // Checks whether device supports the given feature\r
+ bool supports(FeatureSet feature_set) const;\r
\r
- //! matrix transposition\r
- GpuMat t() const;\r
+ // Checks whether the GPU module can be run on the given device\r
+ bool isCompatible() 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
+ int deviceID() const { return device_id_; }\r
\r
- //! pointer to the reference counter;\r
- // when GpuMatrix points to user-allocated data, the pointer is NULL\r
- int* refcount;\r
+ private:\r
+ void query();\r
+ void queryMemory(size_t& free_memory, size_t& total_memory) const;\r
\r
- //! helper fields used in locateROI and adjustROI\r
- uchar* datastart;\r
- uchar* dataend;\r
+ int device_id_;\r
+\r
+ string name_;\r
+ int multi_processor_count_;\r
+ int majorVersion_;\r
+ int minorVersion_;\r
};\r
\r
-//#define TemplatedGpuMat // experimental now, deprecated to use\r
-#ifdef TemplatedGpuMat\r
- #include "GpuMat_BetaDeprecated.hpp"\r
-#endif\r
+ //////////////////////////////// Error handling ////////////////////////\r
\r
- //! creates continuous GPU matrix\r
- CV_EXPORTS void createContinuous(int rows, int cols, int type, GpuMat& m);\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
//////////////////////////////// CudaMem ////////////////////////////////\r
// CudaMem is limited cv::Mat with page locked memory allocation.\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
void enqueueCopy(const GpuMat& src, GpuMat& dst);\r
\r
- void enqueueMemSet(const GpuMat& src, Scalar val);\r
- void enqueueMemSet(const GpuMat& src, Scalar val, const GpuMat& mask);\r
+ void enqueueMemSet(GpuMat& src, Scalar val);\r
+ void enqueueMemSet(GpuMat& src, Scalar val, const GpuMat& mask);\r
\r
// converts matrix type, ex from float to uchar depending on type\r
void enqueueConvert(const GpuMat& src, GpuMat& dst, int type, double a = 1, double b = 0);\r
+\r
+ static Stream& Null();\r
+\r
+ operator bool() const;\r
+\r
private:\r
void create();\r
void release();\r
+\r
struct Impl;\r
Impl *impl;\r
+\r
friend struct StreamAccessor;\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
\r
//! transposes the matrix\r
//! supports matrix with element size = 1, 4 and 8 bytes (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc)\r
- CV_EXPORTS void transpose(const GpuMat& src1, GpuMat& dst);\r
+ CV_EXPORTS void transpose(const GpuMat& src1, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! reverses the order of the rows, columns or both in a matrix\r
//! supports CV_8UC1, CV_8UC4 types\r
- CV_EXPORTS void flip(const GpuMat& a, GpuMat& b, int flipCode);\r
+ CV_EXPORTS void flip(const GpuMat& a, GpuMat& b, int flipCode, Stream& stream = Stream::Null());\r
\r
//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))\r
//! destination array will have the depth type as lut and the same channels number as source\r
//! supports CV_8UC1, CV_8UC3 types\r
- CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst);\r
+ CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! makes multi-channel array out of several single-channel arrays\r
- CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst);\r
+ CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! makes multi-channel array out of several single-channel arrays\r
- CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst);\r
-\r
- //! makes multi-channel array out of several single-channel arrays (async version)\r
- CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream);\r
-\r
- //! makes multi-channel array out of several single-channel arrays (async version)\r
- CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream);\r
+ CV_EXPORTS void merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! copies each plane of a multi-channel array to a dedicated array\r
- CV_EXPORTS void split(const GpuMat& src, GpuMat* dst);\r
+ CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, Stream& stream = Stream::Null());\r
\r
//! copies each plane of a multi-channel array to a dedicated array\r
- CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst);\r
-\r
- //! copies each plane of a multi-channel array to a dedicated array (async version)\r
- CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, const Stream& stream);\r
-\r
- //! copies each plane of a multi-channel array to a dedicated array (async version)\r
- CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream);\r
+ CV_EXPORTS void split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null());\r
\r
//! computes magnitude of complex (x(i).re, x(i).im) vector\r
//! supports only CV_32FC2 type\r
- CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude);\r
+ CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes squared magnitude of complex (x(i).re, x(i).im) vector\r
//! supports only CV_32FC2 type\r
- CV_EXPORTS void magnitudeSqr(const GpuMat& x, GpuMat& magnitude);\r
+ CV_EXPORTS void magnitudeSqr(const GpuMat& x, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes magnitude of each (x(i), y(i)) vector\r
//! supports only floating-point source\r
- CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);\r
- //! async version\r
- CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);\r
+ CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes squared magnitude of each (x(i), y(i)) vector\r
//! supports only floating-point source\r
- CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);\r
- //! async version\r
- CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);\r
+ CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null());\r
\r
//! computes angle (angle(i)) of each (x(i), y(i)) vector\r
//! supports only floating-point source\r
- CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees = false);\r
- //! async version\r
- CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream);\r
+ CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees = false, Stream& stream = Stream::Null());\r
\r
//! converts Cartesian coordinates to polar\r
//! supports only floating-point source\r
- CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees = false);\r
- //! async version\r
- CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream);\r
+ CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees = false, Stream& stream = Stream::Null());\r
\r
//! converts polar coordinates to Cartesian\r
//! supports only floating-point source\r
- CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees = false);\r
- //! async version\r
- CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream);\r
+ CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees = false, Stream& stream = Stream::Null());\r
\r
\r
//////////////////////////// Per-element operations ////////////////////////////////////\r
\r
//! adds one matrix to another (c = a + b)\r
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types\r
- CV_EXPORTS void add(const GpuMat& a, const GpuMat& b, GpuMat& c);\r
+ CV_EXPORTS void add(const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream = Stream::Null());\r
//! adds scalar to a matrix (c = a + s)\r
//! supports CV_32FC1 and CV_32FC2 type\r
- CV_EXPORTS void add(const GpuMat& a, const Scalar& sc, GpuMat& c);\r
+ CV_EXPORTS void add(const GpuMat& a, const Scalar& sc, GpuMat& c, Stream& stream = Stream::Null());\r
\r
//! subtracts one matrix from another (c = a - b)\r
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types\r
- CV_EXPORTS void subtract(const GpuMat& a, const GpuMat& b, GpuMat& c);\r
+ CV_EXPORTS void subtract(const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream = Stream::Null());\r
//! subtracts scalar from a matrix (c = a - s)\r
//! supports CV_32FC1 and CV_32FC2 type\r
- CV_EXPORTS void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c);\r
+ CV_EXPORTS void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c, Stream& stream = Stream::Null());\r
\r
//! computes element-wise product of the two arrays (c = a * b)\r
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types\r
- CV_EXPORTS void multiply(const GpuMat& a, const GpuMat& b, GpuMat& c);\r
+ CV_EXPORTS void multiply(const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream = Stream::Null());\r
//! multiplies matrix to a scalar (c = a * s)\r
- //! supports CV_32FC1 and CV_32FC2 type\r
- CV_EXPORTS void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c);\r
+ //! supports CV_32FC1 type\r
+ CV_EXPORTS void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c, Stream& stream = Stream::Null());\r
\r
//! computes element-wise quotient of the two arrays (c = a / b)\r
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types\r
- CV_EXPORTS void divide(const GpuMat& a, const GpuMat& b, GpuMat& c);\r
+ CV_EXPORTS void divide(const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream = Stream::Null());\r
//! computes element-wise quotient of matrix and scalar (c = a / s)\r
- //! supports CV_32FC1 and CV_32FC2 type\r
- CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c);\r
+ //! supports CV_32FC1 type\r
+ CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c, Stream& stream = Stream::Null());\r
\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);\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
- CV_EXPORTS void log(const GpuMat& a, GpuMat& b);\r
+ CV_EXPORTS void log(const GpuMat& a, GpuMat& b, Stream& stream = Stream::Null());\r
\r
//! computes element-wise absolute difference of two arrays (c = abs(a - b))\r
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types\r
- CV_EXPORTS void absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c);\r
+ CV_EXPORTS void absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c, Stream& stream = Stream::Null());\r
//! computes element-wise absolute difference of array and scalar (c = abs(a - s))\r
//! supports only CV_32FC1 type\r
- CV_EXPORTS void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c);\r
+ CV_EXPORTS void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c, Stream& stream = Stream::Null());\r
\r
//! compares elements of two arrays (c = a <cmpop> b)\r
//! supports CV_8UC4, CV_32FC1 types\r
- CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop);\r
+ CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop, Stream& stream = Stream::Null());\r
\r
//! performs per-elements bit-wise inversion\r
- CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat());\r
- //! async version\r
- CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream);\r
+ CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null());\r
\r
//! calculates per-element bit-wise disjunction of two arrays\r
- CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());\r
- //! async version\r
- CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);\r
+ CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null());\r
\r
//! calculates per-element bit-wise conjunction of two arrays\r
- CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());\r
- //! async version\r
- CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);\r
+ CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null());\r
\r
//! calculates per-element bit-wise "exclusive or" operation\r
- CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());\r
- //! async version\r
- CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);\r
+ CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null());\r
\r
//! computes per-element minimum of two arrays (dst = min(src1, src2))\r
- CV_EXPORTS void min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst);\r
- //! Async version\r
- CV_EXPORTS void min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream);\r
+ CV_EXPORTS void min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! computes per-element minimum of array and scalar (dst = min(src1, src2))\r
- CV_EXPORTS void min(const GpuMat& src1, double src2, GpuMat& dst);\r
- //! Async version\r
- CV_EXPORTS void min(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream);\r
+ CV_EXPORTS void min(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
//! computes per-element maximum of two arrays (dst = max(src1, src2))\r
- CV_EXPORTS void max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst);\r
- //! Async version\r
- CV_EXPORTS void max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream);\r
+ CV_EXPORTS void max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null());\r
\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);\r
- //! Async version\r
- CV_EXPORTS void max(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream);\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 void meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int sp, int sr,\r
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));\r
\r
- //! Does mean shift segmentation with elimiation of small regions.\r
+ //! Does mean shift segmentation with elimination of small regions.\r
CV_EXPORTS void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int minsize,\r
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));\r
\r
//! Does coloring of disparity image: [0..ndisp) -> [0..240, 1, 1] in HSV.\r
//! Supported types of input disparity: CV_8U, CV_16S.\r
//! Output disparity has CV_8UC4 type in BGRA format (alpha = 255).\r
- CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp);\r
- //! async version\r
- CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, const Stream& stream);\r
+ CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, Stream& stream = Stream::Null());\r
\r
//! Reprojects disparity image to 3D space.\r
//! Supports CV_8U and CV_16S types of input disparity.\r
//! The output is a 4-channel floating-point (CV_32FC4) matrix.\r
//! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.\r
//! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.\r
- CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q);\r
- //! async version\r
- CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, const Stream& stream);\r
+ CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, Stream& stream = Stream::Null());\r
\r
//! converts image from one color space to another\r
- CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0);\r
- //! async version\r
- CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, const Stream& stream);\r
+ CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0, Stream& stream = Stream::Null());\r
\r
- //! applies fixed threshold to the image.\r
- //! Now supports only THRESH_TRUNC threshold type and one channels float source.\r
- CV_EXPORTS double threshold(const GpuMat& src, GpuMat& dst, double thresh);\r
+ //! applies fixed threshold to the image\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
- CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR);\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 warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR);\r
+ CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, Stream& stream = Stream::Null());\r
\r
//! warps the image using perspective 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);\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);\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());\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
//! supports only CV_8UC1 source type\r
- CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum);\r
+ CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum, Stream& stream = Stream::Null());\r
+\r
+ //! buffered version\r
+ CV_EXPORTS void integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, Stream& stream = Stream::Null());\r
\r
//! computes the integral image and integral for the squared image\r
//! sum will have CV_32S type, sqsum - CV32F type\r
//! supports only CV_8UC1 source type\r
- CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum);\r
+ CV_EXPORTS void integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum, Stream& stream = Stream::Null());\r
\r
//! computes squared integral image\r
//! result matrix will have 64F type, but will contain 64U values\r
//! supports source images of 8UC1 type only\r
- CV_EXPORTS void sqrIntegral(const GpuMat& src, GpuMat& sqsum);\r
+ CV_EXPORTS void sqrIntegral(const GpuMat& src, GpuMat& sqsum, Stream& stream = Stream::Null());\r
\r
//! computes vertical sum, supports only CV_32FC1 images\r
CV_EXPORTS void columnSum(const GpuMat& src, GpuMat& sum);\r
//! computes the standard deviation of integral images\r
//! supports only CV_32SC1 source type and CV_32FC1 sqr type\r
//! output will have CV_32FC1 type\r
- CV_EXPORTS void rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect);\r
-\r
- //! applies Canny edge detector and produces the edge map\r
- //! supprots only CV_8UC1 source type\r
- //! disabled until fix crash\r
- CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double threshold1, double threshold2, int apertureSize = 3);\r
+ CV_EXPORTS void rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect, Stream& stream = Stream::Null());\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
+ //! 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
\r
//! computes norm of array\r
//! supports NORM_INF, NORM_L1, NORM_L2\r
- //! supports only CV_8UC1 type\r
+ //! supports all matrices except 64F\r
CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);\r
\r
+ //! computes norm of array\r
+ //! supports NORM_INF, NORM_L1, NORM_L2\r
+ //! supports all matrices except 64F\r
+ CV_EXPORTS double norm(const GpuMat& src1, int normType, GpuMat& buf);\r
+\r
//! computes norm of the difference between two arrays\r
//! supports NORM_INF, NORM_L1, NORM_L2\r
//! supports only CV_8UC1 type\r
//! supports only single channel images\r
CV_EXPORTS Scalar sum(const GpuMat& src, GpuMat& buf);\r
\r
+ //! computes sum of array elements absolute values\r
+ //! supports only single channel images\r
+ CV_EXPORTS Scalar absSum(const GpuMat& src);\r
+\r
+ //! computes sum of array elements absolute values\r
+ //! supports only single channel images\r
+ CV_EXPORTS Scalar absSum(const GpuMat& src, GpuMat& buf);\r
+\r
//! computes squared sum of array elements\r
//! supports only single channel images\r
CV_EXPORTS Scalar sqrSum(const GpuMat& src);\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
- //////////////////////////////// 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) = 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) = 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) = 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)) = 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));\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)) { boxFilter(src, dst, -1, ksize, anchor); }\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
-\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
-\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
\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));\r
+ ///////////////////////////// Calibration 3D //////////////////////////////////\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 transformPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec,\r
+ GpuMat& dst, 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 projectPoints(const GpuMat& src, const Mat& rvec, const Mat& tvec,\r
+ const Mat& camera_mat, const Mat& dist_coef, GpuMat& dst, \r
+ 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
-\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
-\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);\r
+ CV_EXPORTS void solvePnPRansac(const Mat& object, const Mat& image, const Mat& camera_mat,\r
+ const Mat& dist_coef, Mat& rvec, Mat& tvec, bool use_extrinsic_guess=false,\r
+ int num_iters=100, float max_dist=8.0, int min_inlier_count=100, \r
+ vector<int>* inliers=NULL);\r
\r
//////////////////////////////// Image Labeling ////////////////////////////////\r
\r
//!performs labeling via graph cuts\r
- CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf);\r
+ CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf, Stream& stream = Stream::Null());\r
\r
////////////////////////////////// Histograms //////////////////////////////////\r
\r
//! Calculates histogram with evenly distributed bins for signle channel source.\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);\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]);\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);\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]);\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
\r
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair\r
//! Output disparity has CV_8U type.\r
- void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity);\r
-\r
- //! async version\r
- void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream & stream);\r
+ void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null());\r
\r
//! Some heuristics that tries to estmate\r
- // if current GPU will be faster then CPU in this algorithm.\r
+ // if current GPU will be faster than CPU in this algorithm.\r
// It queries current active device.\r
static bool checkIfGpuCallReasonable();\r
\r
\r
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,\r
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().\r
- void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);\r
-\r
- //! async version\r
- void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);\r
+ void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null());\r
\r
\r
//! version for user specified data term\r
- void operator()(const GpuMat& data, GpuMat& disparity);\r
- void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);\r
+ void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream = Stream::Null());\r
\r
int ndisp;\r
\r
\r
/////////////////////////// StereoConstantSpaceBP ///////////////////////////\r
// "A Constant-Space Belief Propagation Algorithm for Stereo Matching"\r
- // Qingxiong Yang, Liang Wang\86, Narendra Ahuja\r
+ // Qingxiong Yang, Liang Wang, Narendra Ahuja\r
// http://vision.ai.uiuc.edu/~qyang6/\r
\r
class CV_EXPORTS StereoConstantSpaceBP\r
\r
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,\r
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().\r
- void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);\r
-\r
- //! async version\r
- void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);\r
+ void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null());\r
\r
int ndisp;\r
\r
\r
/////////////////////////// DisparityBilateralFilter ///////////////////////////\r
// Disparity map refinement using joint bilateral filtering given a single color image.\r
- // Qingxiong Yang, Liang Wang\86, Narendra Ahuja\r
+ // Qingxiong Yang, Liang Wang, Narendra Ahuja\r
// http://vision.ai.uiuc.edu/~qyang6/\r
\r
class CV_EXPORTS DisparityBilateralFilter\r
\r
//! the disparity map refinement operator. Refine disparity map using joint bilateral filtering given a single color image.\r
//! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.\r
- void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst);\r
-\r
- //! async version\r
- void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream);\r
+ void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream = Stream::Null());\r
\r
private:\r
int ndisp;\r
\r
struct CV_EXPORTS HOGDescriptor\r
{\r
- public:\r
enum { DEFAULT_WIN_SIGMA = -1 };\r
enum { DEFAULT_NLEVELS = 64 };\r
enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };\r
\r
size_t getDescriptorSize() const;\r
size_t getBlockHistogramSize() const;\r
- double getWinSigma() const;\r
\r
- static vector<float> getDefaultPeopleDetector();\r
- static vector<float> getPeopleDetector_48x96();\r
- static vector<float> getPeopleDetector_64x128();\r
void setSVMDetector(const vector<float>& detector);\r
- bool checkDetectorSize() const;\r
\r
- void detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0,\r
- Size win_stride=Size(), Size padding=Size());\r
+ static vector<float> getDefaultPeopleDetector();\r
+ static vector<float> getPeopleDetector48x96();\r
+ static vector<float> getPeopleDetector64x128();\r
+\r
+ void detect(const GpuMat& img, vector<Point>& found_locations, \r
+ double hit_threshold=0, Size win_stride=Size(), \r
+ Size padding=Size());\r
+\r
void detectMultiScale(const GpuMat& img, vector<Rect>& found_locations,\r
- double hit_threshold=0, Size win_stride=Size(), Size padding=Size(),\r
- double scale0=1.05, int group_threshold=2);\r
+ double hit_threshold=0, Size win_stride=Size(), \r
+ Size padding=Size(), double scale0=1.05, \r
+ int group_threshold=2);\r
\r
- void getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors,\r
+ void getDescriptors(const GpuMat& img, Size win_stride, \r
+ GpuMat& descriptors,\r
int descr_format=DESCR_FORMAT_COL_BY_COL);\r
\r
Size win_size;\r
void computeBlockHistograms(const GpuMat& img);\r
void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle);\r
\r
+ double getWinSigma() const;\r
+ bool checkDetectorSize() const;\r
+\r
static int numPartsWithin(int size, int part_size, int stride);\r
static Size numPartsWithin(Size size, Size part_size, Size stride);\r
\r
GpuMat detector;\r
\r
// Results of the last classification step\r
- GpuMat labels;\r
+ GpuMat labels, labels_buf;\r
Mat labels_host;\r
\r
// Results of the last histogram evaluation step\r
- GpuMat block_hists;\r
+ GpuMat block_hists, block_hists_buf;\r
\r
// Gradients conputation results\r
- GpuMat grad, qangle;\r
+ GpuMat grad, qangle, grad_buf, qangle_buf;\r
+\r
+ // returns subbuffer with required size, reallocates buffer if nessesary.\r
+ static GpuMat getBuffer(const Size& sz, int type, GpuMat& buf);\r
+ static GpuMat getBuffer(int rows, int cols, int type, GpuMat& buf);\r
+\r
+ std::vector<GpuMat> image_scales;\r
};\r
\r
\r
class CV_EXPORTS BruteForceMatcher_GPU_base\r
{\r
public:\r
- enum DistType {L1Dist = 0, L2Dist};\r
+ enum DistType {L1Dist = 0, L2Dist, HammingDist};\r
\r
explicit BruteForceMatcher_GPU_base(DistType distType = L2Dist);\r
\r
// distance.at<float>(0, queryIdx) will contain distance\r
void matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,\r
GpuMat& trainIdx, GpuMat& distance,\r
- const GpuMat& mask = GpuMat());\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
// distance.at<float>(0, queryIdx) will contain distance\r
void matchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection,\r
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,\r
- const GpuMat& maskCollection);\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, 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
// allDist.at<float>(queryIdx, trainIdx) will contain FLT_MAX, if trainIdx is one from k best,\r
// otherwise it will contain distance between queryIdx and trainIdx descriptors\r
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,\r
- GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat());\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
- const GpuMat& mask = GpuMat());\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
const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false);\r
\r
- private:\r
DistType distType;\r
\r
+ private:\r
std::vector<GpuMat> trainDescCollection;\r
};\r
\r
explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(L2Dist) {}\r
explicit BruteForceMatcher_GPU(L2<T> /*d*/) : BruteForceMatcher_GPU_base(L2Dist) {}\r
};\r
+ template <> class CV_EXPORTS BruteForceMatcher_GPU< HammingLUT > : public BruteForceMatcher_GPU_base\r
+ {\r
+ public:\r
+ explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(HammingDist) {}\r
+ explicit BruteForceMatcher_GPU(HammingLUT /*d*/) : BruteForceMatcher_GPU_base(HammingDist) {}\r
+ };\r
+ template <> class CV_EXPORTS BruteForceMatcher_GPU< Hamming > : public BruteForceMatcher_GPU_base\r
+ {\r
+ public:\r
+ explicit BruteForceMatcher_GPU() : BruteForceMatcher_GPU_base(HammingDist) {}\r
+ explicit BruteForceMatcher_GPU(Hamming /*d*/) : BruteForceMatcher_GPU_base(HammingDist) {}\r
+ };\r
\r
- ////////////////////////////////// CascadeClassifier //////////////////////////////////////////\r
+ ////////////////////////////////// CascadeClassifier_GPU //////////////////////////////////////////\r
// The cascade classifier class for object detection.\r
- class CV_EXPORTS CascadeClassifier\r
+ class CV_EXPORTS CascadeClassifier_GPU\r
{\r
public:\r
- struct CV_EXPORTS DTreeNode\r
- {\r
- int featureIdx;\r
- float threshold; // for ordered features only\r
- int left;\r
- int right;\r
- };\r
-\r
- struct CV_EXPORTS DTree\r
- {\r
- int nodeCount;\r
- };\r
-\r
- struct CV_EXPORTS Stage\r
- {\r
- int first;\r
- int ntrees;\r
- float threshold;\r
- };\r
-\r
- enum { BOOST = 0 };\r
- enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };\r
-\r
- CascadeClassifier();\r
- CascadeClassifier(const string& filename);\r
- ~CascadeClassifier();\r
+ CascadeClassifier_GPU();\r
+ CascadeClassifier_GPU(const string& filename);\r
+ ~CascadeClassifier_GPU();\r
\r
bool empty() const;\r
bool load(const string& filename);\r
- bool read(const FileNode& node);\r
-\r
- void detectMultiScale( const Mat& image, vector<Rect>& objects, double scaleFactor=1.1,\r
- int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size());\r
-\r
- bool setImage( Ptr<FeatureEvaluator>&, const Mat& );\r
- int runAt( Ptr<FeatureEvaluator>&, Point );\r
+ void release();\r
\r
- bool isStumpBased;\r
+ /* returns number of detected objects */\r
+ int detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size());\r
\r
- int stageType;\r
- int featureType;\r
- int ncategories;\r
- Size origWinSize;\r
+ bool findLargestObject;\r
+ bool visualizeInPlace;\r
\r
- vector<Stage> stages;\r
- vector<DTree> classifiers;\r
- vector<DTreeNode> nodes;\r
- vector<float> leaves;\r
- vector<int> subsets;\r
+ Size getClassifierSize() const;\r
+ private:\r
\r
- Ptr<FeatureEvaluator> feval;\r
- Ptr<CvHaarClassifierCascade> oldCascade;\r
+ struct CascadeClassifierImpl;\r
+ CascadeClassifierImpl* impl;\r
};\r
\r
////////////////////////////////// SURF //////////////////////////////////////////\r
- \r
- struct CV_EXPORTS SURFParams_GPU \r
- {\r
- SURFParams_GPU() :\r
- threshold(0.1f), \r
- nOctaves(4),\r
- nIntervals(4),\r
- initialScale(2.f),\r
-\r
- l1(3.f/1.5f),\r
- l2(5.f/1.5f),\r
- l3(3.f/1.5f),\r
- l4(1.f/1.5f),\r
- edgeScale(0.81f),\r
- initialStep(1),\r
-\r
- extended(true),\r
-\r
- featuresRatio(0.01f)\r
- {\r
- }\r
-\r
- //! The interest operator threshold\r
- float threshold;\r
- //! The number of octaves to process\r
- int nOctaves;\r
- //! The number of intervals in each octave\r
- int nIntervals;\r
- //! The scale associated with the first interval of the first octave\r
- float initialScale;\r
-\r
- //! mask parameter l_1\r
- float l1;\r
- //! mask parameter l_2 \r
- float l2;\r
- //! mask parameter l_3\r
- float l3;\r
- //! mask parameter l_4\r
- float l4;\r
- //! The amount to scale the edge rejection mask\r
- float edgeScale;\r
- //! The initial sampling step in pixels.\r
- int initialStep;\r
-\r
- //! True, if generate 128-len descriptors, false - 64-len descriptors\r
- bool extended;\r
-\r
- //! max features = featuresRatio * img.size().srea()\r
- float featuresRatio;\r
- };\r
\r
- class CV_EXPORTS SURF_GPU : public SURFParams_GPU\r
+ class CV_EXPORTS SURF_GPU : public CvSURFParams\r
{\r
public:\r
+ enum KeypointLayout \r
+ {\r
+ SF_X = 0,\r
+ SF_Y,\r
+ SF_LAPLACIAN,\r
+ SF_SIZE,\r
+ SF_DIR,\r
+ SF_HESSIAN,\r
+ SF_FEATURE_STRIDE\r
+ };\r
+\r
+ //! the default constructor\r
+ SURF_GPU();\r
+ //! the full constructor taking all the necessary parameters\r
+ explicit SURF_GPU(double _hessianThreshold, int _nOctaves=4,\r
+ int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f, bool _upright = false);\r
+\r
//! returns the descriptor size in float's (64 or 128)\r
int descriptorSize() const;\r
\r
//! upload host keypoints to device memory\r
- static void uploadKeypoints(const vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);\r
+ void uploadKeypoints(const vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);\r
//! download keypoints from device to host memory\r
- static void downloadKeypoints(const GpuMat& keypointsGPU, vector<KeyPoint>& keypoints);\r
+ void downloadKeypoints(const GpuMat& keypointsGPU, vector<KeyPoint>& keypoints);\r
\r
//! download descriptors from device to host memory\r
- static void downloadDescriptors(const GpuMat& descriptorsGPU, vector<float>& descriptors);\r
+ void downloadDescriptors(const GpuMat& descriptorsGPU, vector<float>& descriptors);\r
\r
//! finds the keypoints using fast hessian detector used in SURF\r
//! supports CV_8UC1 images\r
- //! keypoints will have 1 row and type CV_32FC(6)\r
- //! keypoints.at<float[6]>(1, i) contains i'th keypoint\r
- //! format: (x, y, size, response, angle, octave)\r
+ //! keypoints will have nFeature cols and 6 rows\r
+ //! keypoints.ptr<float>(SF_X)[i] will contain x coordinate of i'th feature\r
+ //! keypoints.ptr<float>(SF_Y)[i] will contain y coordinate of i'th feature\r
+ //! keypoints.ptr<float>(SF_LAPLACIAN)[i] will contain laplacian sign of i'th feature\r
+ //! keypoints.ptr<float>(SF_SIZE)[i] will contain size of i'th feature\r
+ //! keypoints.ptr<float>(SF_DIR)[i] will contain orientation of i'th feature\r
+ //! keypoints.ptr<float>(SF_HESSIAN)[i] will contain response of i'th feature\r
void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints);\r
//! finds the keypoints and computes their descriptors. \r
//! Optionally it can compute descriptors for the user-provided keypoints and recompute keypoints direction\r
void operator()(const GpuMat& img, const GpuMat& mask, GpuMat& keypoints, GpuMat& descriptors, \r
- bool useProvidedKeypoints = false, bool calcOrientation = true);\r
- \r
+ bool useProvidedKeypoints = false);\r
+\r
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints);\r
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors, \r
- bool useProvidedKeypoints = false, bool calcOrientation = true);\r
- \r
+ bool useProvidedKeypoints = false);\r
+\r
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors, \r
- bool useProvidedKeypoints = false, bool calcOrientation = true);\r
+ bool useProvidedKeypoints = false);\r
+\r
+ void releaseMemory();\r
+\r
+ //! max keypoints = min(keypointsRatio * img.size().area(), 65535)\r
+ float keypointsRatio;\r
\r
- GpuMat sum;\r
- GpuMat sumf;\r
+ GpuMat sum, mask1, maskSum, intBuffer;\r
\r
- GpuMat mask1;\r
- GpuMat maskSum;\r
+ GpuMat det, trace;\r
\r
- GpuMat hessianBuffer;\r
GpuMat maxPosBuffer;\r
- GpuMat featuresBuffer;\r
};\r
\r
}\r