|
|
|
@ -54,19 +54,10 @@ namespace |
|
|
|
|
|
|
|
|
|
TEST_P(Filter2DTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, borderType = 0, dtype = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, borderType, dtype, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, dtype, initOut); |
|
|
|
|
|
|
|
|
|
cv::Point anchor = {-1, -1}; |
|
|
|
|
double delta = 0; |
|
|
|
|
|
|
|
|
|
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1 ); |
|
|
|
|
cv::Mat kernel = cv::Mat(kernSize, kernSize, CV_32FC1); |
|
|
|
|
cv::Scalar kernMean = cv::Scalar(1.0); |
|
|
|
|
cv::Scalar kernStddev = cv::Scalar(2.0/3); |
|
|
|
|
randn(kernel, kernMean, kernStddev); |
|
|
|
@ -76,7 +67,7 @@ TEST_P(Filter2DTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::filter2D(in, dtype, kernel, anchor, delta, borderType); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::filter2D(in_mat1, out_mat_ocv, dtype, kernel, anchor, delta, borderType); |
|
|
|
@ -90,27 +81,20 @@ TEST_P(Filter2DTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(BoxFilterTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int filterSize = 0, borderType = 0, dtype = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, filterSize, sz, borderType, dtype, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, dtype, initOut); |
|
|
|
|
|
|
|
|
|
cv::Point anchor = {-1, -1}; |
|
|
|
|
bool normalize = true; |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType); |
|
|
|
|
auto out = cv::gapi::boxFilter(in, dtype, cv::Size(filterSize, filterSize), anchor, normalize, |
|
|
|
|
borderType); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor, normalize, borderType); |
|
|
|
|
cv::boxFilter(in_mat1, out_mat_ocv, dtype, cv::Size(filterSize, filterSize), anchor, |
|
|
|
|
normalize, borderType); |
|
|
|
|
} |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
@ -121,19 +105,10 @@ TEST_P(BoxFilterTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(SepFilterTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, dtype = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, dtype, initOut, compile_args) = GetParam(); |
|
|
|
|
|
|
|
|
|
cv::Mat kernelX(kernSize, 1, CV_32F); |
|
|
|
|
cv::Mat kernelY(kernSize, 1, CV_32F); |
|
|
|
|
randu(kernelX, -1, 1); |
|
|
|
|
randu(kernelY, -1, 1); |
|
|
|
|
initMatrixRandN(type, sz, dtype, initOut); |
|
|
|
|
|
|
|
|
|
cv::Point anchor = cv::Point(-1, -1); |
|
|
|
|
|
|
|
|
@ -142,7 +117,7 @@ TEST_P(SepFilterTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::sepFilter(in, dtype, kernelX, kernelY, anchor, cv::Scalar() ); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::sepFilter2D(in_mat1, out_mat_ocv, dtype, kernelX, kernelY ); |
|
|
|
@ -156,15 +131,6 @@ TEST_P(SepFilterTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(BlurTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int filterSize = 0, borderType = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, filterSize, sz, borderType, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Point anchor = {-1, -1}; |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
@ -172,7 +138,7 @@ TEST_P(BlurTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::blur(in, cv::Size(filterSize, filterSize), anchor, borderType); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::blur(in_mat1, out_mat_ocv, cv::Size(filterSize, filterSize), anchor, borderType); |
|
|
|
@ -186,15 +152,6 @@ TEST_P(BlurTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(GaussianBlurTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF,type, kernSize, sz, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Size kSize = cv::Size(kernSize, kernSize); |
|
|
|
|
double sigmaX = rand(); |
|
|
|
|
|
|
|
|
@ -203,7 +160,7 @@ TEST_P(GaussianBlurTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::gaussianBlur(in, kSize, sigmaX); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::GaussianBlur(in_mat1, out_mat_ocv, kSize, sigmaX); |
|
|
|
@ -217,21 +174,12 @@ TEST_P(GaussianBlurTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(MedianBlurTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::medianBlur(in, kernSize); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::medianBlur(in_mat1, out_mat_ocv, kernSize); |
|
|
|
@ -245,15 +193,6 @@ TEST_P(MedianBlurTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(ErodeTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, kernType = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
@ -261,7 +200,7 @@ TEST_P(ErodeTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::erode(in, kernel); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::erode(in_mat1, out_mat_ocv, kernel); |
|
|
|
@ -275,15 +214,6 @@ TEST_P(ErodeTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(Erode3x3Test, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int numIters = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
@ -291,7 +221,7 @@ TEST_P(Erode3x3Test, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::erode3x3(in, numIters); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::erode(in_mat1, out_mat_ocv, kernel, cv::Point(-1, -1), numIters); |
|
|
|
@ -305,15 +235,6 @@ TEST_P(Erode3x3Test, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(DilateTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, kernType = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, kernType, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Mat kernel = cv::getStructuringElement(kernType, cv::Size(kernSize, kernSize)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
@ -321,7 +242,7 @@ TEST_P(DilateTest, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::dilate(in, kernel); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::dilate(in_mat1, out_mat_ocv, kernel); |
|
|
|
@ -335,15 +256,6 @@ TEST_P(DilateTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(Dilate3x3Test, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int numIters = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, sz, initOut, numIters, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, type, initOut); |
|
|
|
|
|
|
|
|
|
cv::Mat kernel = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(3,3)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
@ -351,7 +263,7 @@ TEST_P(Dilate3x3Test, AccuracyTest) |
|
|
|
|
auto out = cv::gapi::dilate3x3(in, numIters); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::dilate(in_mat1, out_mat_ocv, kernel, cv::Point(-1,-1), numIters); |
|
|
|
@ -363,24 +275,14 @@ TEST_P(Dilate3x3Test, AccuracyTest) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST_P(SobelTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, dtype = 0, dx = 0, dy = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, dtype, dx, dy, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(type, sz, dtype, initOut); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::Sobel(in, dtype, dx, dy, kernSize ); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::Sobel(in_mat1, out_mat_ocv, dtype, dx, dy, kernSize); |
|
|
|
@ -394,24 +296,15 @@ TEST_P(SobelTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(SobelXYTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type = 0; |
|
|
|
|
int kernSize = 0, dtype = 0, order = 0, border_type = 0, border_val = 0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, kernSize, sz, dtype, order, border_type, border_val, compile_args) = GetParam(); |
|
|
|
|
|
|
|
|
|
cv::Mat out_mat_ocv2; |
|
|
|
|
cv::Mat out_mat_gapi2; |
|
|
|
|
|
|
|
|
|
initMatrixRandN(type, sz, dtype); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::SobelXY(in, dtype, order, kernSize, 1, 0, border_type, border_val); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(cv::GIn(in), cv::GOut(std::get<0>(out), std::get<1>(out))); |
|
|
|
|
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat_gapi2), std::move(compile_args)); |
|
|
|
|
c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat_gapi2), getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
// workaround for cv::Sobel
|
|
|
|
@ -436,19 +329,12 @@ TEST_P(SobelXYTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(EqHistTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, sz, initOut, compile_args) = GetParam(); |
|
|
|
|
initMatrixRandN(CV_8UC1, sz, CV_8UC1, initOut); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::equalizeHist(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::equalizeHist(in_mat1, out_mat_ocv); |
|
|
|
@ -456,29 +342,18 @@ TEST_P(EqHistTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(GetParam())); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(CannyTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
MatType type; |
|
|
|
|
int apSize = 0; |
|
|
|
|
double thrLow = 0.0, thrUp = 0.0; |
|
|
|
|
cv::Size sz; |
|
|
|
|
bool l2gr = false, initOut = false; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, type, sz, thrLow, thrUp, apSize, l2gr, initOut, compile_args) = GetParam(); |
|
|
|
|
|
|
|
|
|
initMatrixRandN(type, sz, CV_8UC1, initOut); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::Canny(in, thrLow, thrUp, apSize, l2gr); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::Canny(in_mat1, out_mat_ocv, thrLow, thrUp, apSize, l2gr); |
|
|
|
@ -492,17 +367,12 @@ TEST_P(CannyTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(RGB2GrayTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::RGB2Gray(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2GRAY); |
|
|
|
@ -510,23 +380,18 @@ TEST_P(RGB2GrayTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(BGR2GrayTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC1, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::BGR2Gray(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2GRAY); |
|
|
|
@ -534,23 +399,18 @@ TEST_P(BGR2GrayTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(RGB2YUVTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::RGB2YUV(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2YUV); |
|
|
|
@ -558,24 +418,18 @@ TEST_P(RGB2YUVTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(YUV2RGBTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::YUV2RGB(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2RGB); |
|
|
|
@ -583,19 +437,12 @@ TEST_P(YUV2RGBTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(NV12toRGBTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
cv::Size sz; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, sz, compile_args) = GetParam(); |
|
|
|
|
|
|
|
|
|
initMatrixRandN(CV_8UC1, sz, CV_8UC3); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in_y; |
|
|
|
|
cv::GMat in_uv; |
|
|
|
@ -606,7 +453,7 @@ TEST_P(NV12toRGBTest, AccuracyTest) |
|
|
|
|
cv::randn(in_mat_uv, cv::Scalar::all(127), cv::Scalar::all(40.f)); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(cv::GIn(in_y, in_uv), cv::GOut(out)); |
|
|
|
|
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), std::move(compile_args)); |
|
|
|
|
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColorTwoPlane(in_mat1, in_mat_uv, out_mat_ocv, cv::COLOR_YUV2RGB_NV12); |
|
|
|
@ -620,13 +467,6 @@ TEST_P(NV12toRGBTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(NV12toBGRTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
compare_f cmpF; |
|
|
|
|
cv::Size sz; |
|
|
|
|
cv::GCompileArgs compile_args; |
|
|
|
|
std::tie(cmpF, sz, compile_args) = GetParam(); |
|
|
|
|
|
|
|
|
|
initMatrixRandN(CV_8UC1, sz, CV_8UC3); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in_y; |
|
|
|
|
cv::GMat in_uv; |
|
|
|
@ -637,7 +477,7 @@ TEST_P(NV12toBGRTest, AccuracyTest) |
|
|
|
|
cv::randn(in_mat_uv, cv::Scalar::all(127), cv::Scalar::all(40.f)); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(cv::GIn(in_y, in_uv), cv::GOut(out)); |
|
|
|
|
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), std::move(compile_args)); |
|
|
|
|
c.apply(cv::gin(in_mat1, in_mat_uv), cv::gout(out_mat_gapi), getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColorTwoPlane(in_mat1, in_mat_uv, out_mat_ocv, cv::COLOR_YUV2BGR_NV12); |
|
|
|
@ -651,17 +491,12 @@ TEST_P(NV12toBGRTest, AccuracyTest) |
|
|
|
|
|
|
|
|
|
TEST_P(RGB2LabTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::RGB2Lab(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2Lab); |
|
|
|
@ -669,23 +504,18 @@ TEST_P(RGB2LabTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(BGR2LUVTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::BGR2LUV(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2Luv); |
|
|
|
@ -693,23 +523,18 @@ TEST_P(BGR2LUVTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(LUV2BGRTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::LUV2BGR(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_Luv2BGR); |
|
|
|
@ -717,23 +542,18 @@ TEST_P(LUV2BGRTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(BGR2YUVTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::BGR2YUV(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BGR2YUV); |
|
|
|
@ -741,23 +561,18 @@ TEST_P(BGR2YUVTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(YUV2BGRTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::YUV2BGR(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_YUV2BGR); |
|
|
|
@ -765,23 +580,18 @@ TEST_P(YUV2BGRTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(RGB2HSVTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::RGB2HSV(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_RGB2HSV); |
|
|
|
@ -789,23 +599,18 @@ TEST_P(RGB2HSVTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(BayerGR2RGBTest, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC1, std::get<1>(param), CV_8UC3, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::BayerGR2RGB(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
cv::cvtColor(in_mat1, out_mat_ocv, cv::COLOR_BayerGR2RGB); |
|
|
|
@ -813,23 +618,18 @@ TEST_P(BayerGR2RGBTest, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(RGB2YUV422Test, AccuracyTest) |
|
|
|
|
{ |
|
|
|
|
auto param = GetParam(); |
|
|
|
|
auto compile_args = std::get<3>(param); |
|
|
|
|
compare_f cmpF = std::get<0>(param); |
|
|
|
|
initMatrixRandN(CV_8UC3, std::get<1>(param), CV_8UC2, std::get<2>(param)); |
|
|
|
|
|
|
|
|
|
// G-API code //////////////////////////////////////////////////////////////
|
|
|
|
|
cv::GMat in; |
|
|
|
|
auto out = cv::gapi::RGB2YUV422(in); |
|
|
|
|
|
|
|
|
|
cv::GComputation c(in, out); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, std::move(compile_args)); |
|
|
|
|
c.apply(in_mat1, out_mat_gapi, getCompileArgs()); |
|
|
|
|
// OpenCV code /////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
convertRGB2YUV422Ref(in_mat1, out_mat_ocv); |
|
|
|
@ -837,7 +637,7 @@ TEST_P(RGB2YUV422Test, AccuracyTest) |
|
|
|
|
// Comparison //////////////////////////////////////////////////////////////
|
|
|
|
|
{ |
|
|
|
|
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), std::get<1>(param)); |
|
|
|
|
EXPECT_EQ(out_mat_gapi.size(), sz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|