1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #13052 from elatkin:yl/gapi_sobel3x3_f32_v2

* GAPI: Sobel 3x3 with FP32 input

* GAPI: Sobel 3x3 with FP32 input, v2
This commit is contained in:
Evgeny Latkin
2018-11-06 23:08:50 +03:00
committed by Alexander Alekhin
parent 7a686a0c43
commit 000110e760
2 changed files with 31 additions and 0 deletions
@@ -36,6 +36,24 @@ private:
double _tol;
};
class AbsToleranceSobelFluid : public Wrappable<AbsToleranceSobelFluid>
{
public:
AbsToleranceSobelFluid(double tol) : tolerance(tol) {}
bool operator() (const cv::Mat& in1, const cv::Mat& in2) const
{
cv::Mat diff, a1, a2, b, base;
cv::absdiff(in1, in2, diff);
a1 = cv::abs(in1);
a2 = cv::abs(in2);
cv::max(a1, a2, b);
cv::max(1, b, base); // base = max{1, |in1|, |in2|}
return cv::countNonZero(diff > tolerance*base) == 0;
}
private:
double tolerance;
};
class AbsTolerance32FFluid : public Wrappable<AbsTolerance32FFluid>
{
public:
@@ -222,6 +240,18 @@ INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(SobelTestFluid32F, SobelTest,
Combine(Values(AbsToleranceSobelFluid(1e-3).to_compare_f()),
Values(CV_32FC1),
Values(3), // add kernel size=5 when implementation is ready
Values(cv::Size(1280, 720),
cv::Size(640, 480)),
Values(CV_32F),
Values(0, 1),
Values(1, 2),
Values(true, false),
Values(cv::compile_args(IMGPROC_FLUID))));
INSTANTIATE_TEST_CASE_P(boxFilterTestFluid32, BoxFilterTest,
Combine(Values(AbsTolerance32FFluid(1e-6).to_compare_f()),
Values(CV_8UC1, CV_16UC1, CV_16SC1),