added to gpu module linear filters for int and float source types.
refactored gpu module.
This commit is contained in:
@@ -50,7 +50,7 @@ namespace cv
|
||||
// Simple lightweight structure that encapsulates image ptr on device, its pitch and its sizes.
|
||||
// It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
|
||||
|
||||
template<typename T = unsigned char>
|
||||
template <typename T>
|
||||
struct DevMem2D_
|
||||
{
|
||||
typedef T elem_t;
|
||||
@@ -60,16 +60,21 @@ namespace cv
|
||||
int rows;
|
||||
T* ptr;
|
||||
size_t step;
|
||||
size_t elem_step;
|
||||
|
||||
DevMem2D_() : cols(0), rows(0), ptr(0), step(0) {}
|
||||
DevMem2D_() : cols(0), rows(0), ptr(0), step(0), elem_step(0) {}
|
||||
|
||||
DevMem2D_(int rows_, int cols_, T *ptr_, size_t step_)
|
||||
: cols(cols_), rows(rows_), ptr(ptr_), step(step_) {}
|
||||
: cols(cols_), rows(rows_), ptr(ptr_), step(step_), elem_step(step_ / sizeof(T)) {}
|
||||
|
||||
template <typename U>
|
||||
explicit DevMem2D_(const DevMem2D_<U>& d)
|
||||
: cols(d.cols), rows(d.rows), ptr((T*)d.ptr), step(d.step), elem_step(d.step / sizeof(T)) {}
|
||||
|
||||
size_t elemSize() const { return elem_size; }
|
||||
};
|
||||
|
||||
typedef DevMem2D_<> DevMem2D;
|
||||
typedef DevMem2D_<unsigned char> DevMem2D;
|
||||
typedef DevMem2D_<float> DevMem2Df;
|
||||
typedef DevMem2D_<int> DevMem2Di;
|
||||
}
|
||||
|
@@ -636,7 +636,7 @@ namespace cv
|
||||
|
||||
//! returns the separable filter engine with the specified filters
|
||||
CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU>& rowFilter,
|
||||
const Ptr<BaseColumnFilter_GPU>& columnFilter, bool rowFilterFirst = true);
|
||||
const Ptr<BaseColumnFilter_GPU>& columnFilter);
|
||||
|
||||
//! returns horizontal 1D box filter
|
||||
//! supports only CV_8UC1 source type and CV_32FC1 sum type
|
||||
@@ -658,7 +658,7 @@ namespace cv
|
||||
//! only MORPH_ERODE and MORPH_DILATE are supported
|
||||
//! supports CV_8UC1 and CV_8UC4 types
|
||||
//! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height
|
||||
CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const GpuMat& kernel, const Size& ksize,
|
||||
CV_EXPORTS Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,
|
||||
Point anchor=Point(-1,-1));
|
||||
|
||||
//! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
|
||||
@@ -667,25 +667,24 @@ namespace cv
|
||||
|
||||
//! returns 2D filter with the specified kernel
|
||||
//! supports CV_8UC1 and CV_8UC4 types
|
||||
//! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height
|
||||
CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const GpuMat& kernel, const Size& ksize,
|
||||
Point anchor = Point(-1, -1), int nDivisor = 1);
|
||||
CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,
|
||||
Point anchor = Point(-1, -1));
|
||||
|
||||
//! returns the non-separable linear filter engine
|
||||
CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,
|
||||
const Point& anchor = Point(-1,-1));
|
||||
|
||||
//! returns the primitive row filter with the specified kernel
|
||||
CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const GpuMat& rowKernel,
|
||||
int anchor = -1, int nDivisor = 1);
|
||||
CV_EXPORTS Ptr<BaseRowFilter_GPU> getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,
|
||||
int anchor = -1);
|
||||
|
||||
//! returns the primitive column filter with the specified kernel
|
||||
CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const GpuMat& columnKernel,
|
||||
int anchor = -1, int nDivisor = 1);
|
||||
CV_EXPORTS Ptr<BaseColumnFilter_GPU> getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,
|
||||
int anchor = -1);
|
||||
|
||||
//! returns the separable linear filter engine
|
||||
CV_EXPORTS Ptr<FilterEngine_GPU> createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,
|
||||
const Mat& columnKernel, const Point& anchor = Point(-1,-1), bool rowFilterFirst = true);
|
||||
const Mat& columnKernel, const Point& anchor = Point(-1,-1));
|
||||
|
||||
//! returns filter engine for the generalized Sobel operator
|
||||
CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize);
|
||||
@@ -720,7 +719,7 @@ namespace cv
|
||||
|
||||
//! applies separable 2D linear filter to the image
|
||||
CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,
|
||||
Point anchor = Point(-1,-1), bool rowFilterFirst = true);
|
||||
Point anchor = Point(-1,-1));
|
||||
|
||||
//! applies generalized Sobel operator to the image
|
||||
CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1);
|
||||
|
Reference in New Issue
Block a user