Merge pull request #13721 from smirnov-alexey:gapi_add_normalize
GAPI: Add normalize kernel in G-API (#13721) * Add normalize kernel in G-API In addition add several tests on new kernel * Fix indentations and normalize test structure * Move normalize kernel from imgproc to core Set default parameter ddepth to -1 * Fix alignment
This commit is contained in:
committed by
Alexander Alekhin
parent
fcec053d59
commit
315e7fbbee
@@ -148,6 +148,7 @@ struct LUTTest : public TestParams<std::tuple<int, int, cv::Size,bool,
|
||||
struct ConvertToTest : public TestParams<std::tuple<int, int, cv::Size, cv::GCompileArgs>> {};
|
||||
struct PhaseTest : public TestParams<std::tuple<int, cv::Size, bool, cv::GCompileArgs>> {};
|
||||
struct SqrtTest : public TestParams<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
|
||||
struct NormalizeTest : public TestParams<std::tuple<compare_f,MatType,cv::Size,double,double,int,MatType,bool,cv::GCompileArgs>> {};
|
||||
} // opencv_test
|
||||
|
||||
#endif //OPENCV_GAPI_CORE_TESTS_HPP
|
||||
|
||||
@@ -1437,6 +1437,40 @@ TEST_P(SqrtTest, AccuracyTest)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(NormalizeTest, Test)
|
||||
{
|
||||
auto param = GetParam();
|
||||
|
||||
compare_f cmpF;
|
||||
MatType type, ddepth;
|
||||
cv::Size sz;
|
||||
double a = 0 , b = 0;
|
||||
int norm_type = 0;
|
||||
bool createOut = 0;
|
||||
cv::GCompileArgs compile_args;
|
||||
|
||||
std::tie(cmpF, type, sz, a, b, norm_type, ddepth, createOut, compile_args) = GetParam();
|
||||
int dtype = CV_MAKETYPE(ddepth, CV_MAT_CN(type));
|
||||
|
||||
initMatsRandN(type, sz, dtype, createOut);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::normalize(in, a, b, norm_type, ddepth);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi), std::move(compile_args));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::normalize(in_mat1, out_mat_ocv, a, b, norm_type, ddepth);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
}
|
||||
|
||||
} // opencv_test
|
||||
|
||||
|
||||
@@ -625,6 +625,7 @@ TEST_P(YUV2BGRTest, AccuracyTest)
|
||||
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param));
|
||||
}
|
||||
}
|
||||
|
||||
} // opencv_test
|
||||
|
||||
#endif //OPENCV_GAPI_IMGPROC_TESTS_INL_HPP
|
||||
|
||||
Reference in New Issue
Block a user