Commit 0f95f0d8 authored by Alexander Alekhin's avatar Alexander Alekhin

ocl: rewrite filter2D

parent 0bf9ece9
...@@ -718,8 +718,9 @@ namespace cv ...@@ -718,8 +718,9 @@ namespace cv
CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU( int srcType, int dstType, int dx, int dy, int ksize, int borderType = BORDER_DEFAULT ); CV_EXPORTS Ptr<FilterEngine_GPU> createDerivFilter_GPU( int srcType, int dstType, int dx, int dy, int ksize, int borderType = BORDER_DEFAULT );
//! applies Laplacian operator to the image //! applies Laplacian operator to the image
// supports only ksize = 1 and ksize = 3 8UC1 8UC4 32FC1 32FC4 data type // supports only ksize = 1 and ksize = 3
CV_EXPORTS void Laplacian(const oclMat &src, oclMat &dst, int ddepth, int ksize = 1, double scale = 1); CV_EXPORTS void Laplacian(const oclMat &src, oclMat &dst, int ddepth, int ksize = 1, double scale = 1,
double delta=0, int borderType=BORDER_DEFAULT);
//! returns 2D box filter //! returns 2D box filter
// dst type must be the same as source type // dst type must be the same as source type
...@@ -731,11 +732,12 @@ namespace cv ...@@ -731,11 +732,12 @@ namespace cv
const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT); const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT);
//! returns 2D filter with the specified kernel //! returns 2D filter with the specified kernel
// supports CV_8UC1 and CV_8UC4 types // supports: dst type must be the same as source type
CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat &kernel, const Size &ksize, CV_EXPORTS Ptr<BaseFilter_GPU> getLinearFilter_GPU(int srcType, int dstType, const Mat &kernel, const Size &ksize,
const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT); const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT);
//! returns the non-separable linear filter engine //! returns the non-separable linear filter engine
// supports: dst type must be the same as source type
CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat &kernel, CV_EXPORTS Ptr<FilterEngine_GPU> createLinearFilter_GPU(int srcType, int dstType, const Mat &kernel,
const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT); const Point &anchor = Point(-1, -1), int borderType = BORDER_DEFAULT);
...@@ -762,10 +764,8 @@ namespace cv ...@@ -762,10 +764,8 @@ namespace cv
} }
//! applies non-separable 2D linear filter to the image //! applies non-separable 2D linear filter to the image
// Note, at the moment this function only works when anchor point is in the kernel center
// and kernel size supported is either 3x3 or 5x5; otherwise the function will fail to output valid result
CV_EXPORTS void filter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &kernel, CV_EXPORTS void filter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &kernel,
Point anchor = Point(-1, -1), int borderType = BORDER_DEFAULT); Point anchor = Point(-1, -1), double delta = 0.0, int borderType = BORDER_DEFAULT);
//! applies separable 2D linear filter to the image //! applies separable 2D linear filter to the image
CV_EXPORTS void sepFilter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &kernelX, const Mat &kernelY, CV_EXPORTS void sepFilter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &kernelX, const Mat &kernelY,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -160,8 +160,8 @@ OCL_TEST_P(LaplacianTest, Accuracy) ...@@ -160,8 +160,8 @@ OCL_TEST_P(LaplacianTest, Accuracy)
{ {
random_roi(); random_roi();
Laplacian(src_roi, dst_roi, -1, ksize, scale); // TODO FIXIT , 0, borderType); Laplacian(src_roi, dst_roi, -1, ksize, scale, 0, borderType);
ocl::Laplacian(gsrc_roi, gdst_roi, -1, ksize, scale); // TODO FIXIT , 0, borderType); ocl::Laplacian(gsrc_roi, gdst_roi, -1, ksize, scale, 0, borderType);
Near(); Near();
} }
...@@ -298,7 +298,7 @@ OCL_TEST_P(Filter2D, Mat) ...@@ -298,7 +298,7 @@ OCL_TEST_P(Filter2D, Mat)
kernel *= 1.0 / (double)(ksize * ksize); kernel *= 1.0 / (double)(ksize * ksize);
cv::filter2D(src_roi, dst_roi, -1, kernel, anchor, 0.0, borderType); cv::filter2D(src_roi, dst_roi, -1, kernel, anchor, 0.0, borderType);
ocl::filter2D(gsrc_roi, gdst_roi, -1, kernel, anchor, /* TODO FIXIT 0.0,*/ borderType); ocl::filter2D(gsrc_roi, gdst_roi, -1, kernel, anchor, 0.0, borderType);
Near(); Near();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment