Publishing 2019 R3 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / test / common / gapi_core_tests_inl.hpp
index bf0ac98..5b22ef9 100644 (file)
@@ -2,13 +2,13 @@
 // It is subject to the license terms in the LICENSE file found in the top-level directory
 // of this distribution and at http://opencv.org/license.html.
 //
-// Copyright (C) 2018 Intel Corporation
+// Copyright (C) 2018-2019 Intel Corporation
 
 
 #ifndef OPENCV_GAPI_CORE_TESTS_INL_HPP
 #define OPENCV_GAPI_CORE_TESTS_INL_HPP
 
-#include "opencv2/gapi/core.hpp"
+#include <opencv2/gapi/core.hpp>
 #include "gapi_core_tests.hpp"
 
 namespace opencv_test
@@ -16,15 +16,6 @@ namespace opencv_test
 
 TEST_P(MathOpTest, MatricesAccuracyTest )
 {
-    mathOp opType = ADD;
-    int type = 0, dtype = 0;
-    cv::Size sz;
-    double scale = 1; // mul, div
-    bool testWithScalar = false, initOutMatr = false, doReverseOp = false;
-    cv::GCompileArgs compile_args;
-    std::tie(opType, testWithScalar, type, scale, sz, dtype, initOutMatr, doReverseOp, compile_args) = GetParam();
-    initMatsRandU(type, sz, dtype, initOutMatr);
-
     // G-API code & corresponding OpenCV code ////////////////////////////////
     cv::GMat in1, in2, out;
     if( testWithScalar )
@@ -82,7 +73,7 @@ TEST_P(MathOpTest, MatricesAccuracyTest )
         }
         }
         cv::GComputation c(GIn(in1, sc1), GOut(out));
-        c.apply(gin(in_mat1, sc), gout(out_mat_gapi), std::move(compile_args));
+        c.apply(gin(in_mat1, sc), gout(out_mat_gapi), getCompileArgs());
     }
     else
     {
@@ -118,7 +109,7 @@ TEST_P(MathOpTest, MatricesAccuracyTest )
             FAIL() << "no such math operation type for matrix and matrix!";
         }}
         cv::GComputation c(GIn(in1, in2), GOut(out));
-        c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+        c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
     }
 
     // Comparison //////////////////////////////////////////////////////////////
@@ -148,22 +139,14 @@ TEST_P(MathOpTest, MatricesAccuracyTest )
 
 TEST_P(MulDoubleTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    int dtype = std::get<2>(param);
-    cv::Size sz_in = std::get<1>(param);
-    bool initOut = std::get<3>(param);
-
     auto& rng = cv::theRNG();
     double d = rng.uniform(0.0, 10.0);
-    auto compile_args = std::get<4>(param);
-    initMatrixRandU(type, sz_in, dtype, initOut);
 
     // G-API code ////////////////////////////////////////////////////////////
     cv::GMat in1, out;
     out = cv::gapi::mulC(in1, d, dtype);
     cv::GComputation c(in1, out);
-    c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
+    c.apply(in_mat1, out_mat_gapi, getCompileArgs());
 
     // OpenCV code ///////////////////////////////////////////////////////////
     cv::multiply(in_mat1, d, out_mat_ocv, 1, dtype);
@@ -187,26 +170,19 @@ TEST_P(MulDoubleTest, AccuracyTest)
 #else
     EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
 #endif
-    EXPECT_EQ(out_mat_gapi.size(), sz_in);
+    EXPECT_EQ(out_mat_gapi.size(), sz);
 }
 
 TEST_P(DivTest, DISABLED_DivByZeroTest)  // https://github.com/opencv/opencv/pull/12826
 {
-    int type = 0, dtype = 0;
-    cv::Size sz_in;
-    bool initOut = false;
-    cv::GCompileArgs compile_args;
-    std::tie(type, sz_in, dtype, initOut, compile_args) = GetParam();
-
-    initMatrixRandU(type, sz_in, dtype, initOut);
-    in_mat2 = cv::Mat(sz_in, type);
+    in_mat2 = cv::Mat(sz, type);
     in_mat2.setTo(cv::Scalar::all(0));
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::div(in1, in2, 1.0, dtype);
     cv::GComputation c(GIn(in1, in2), GOut(out));
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -216,19 +192,12 @@ TEST_P(DivTest, DISABLED_DivByZeroTest)  // https://github.com/opencv/opencv/pul
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(DivCTest, DISABLED_DivByZeroTest)  // https://github.com/opencv/opencv/pull/12826
 {
-    int type = 0, dtype = 0;
-    cv::Size sz_in;
-    bool initOut = false;
-    cv::GCompileArgs compile_args;
-    std::tie(type, sz_in, dtype, initOut, compile_args) = GetParam();
-
-    initMatrixRandU(type, sz_in, dtype, initOut);
     sc = cv::Scalar::all(0);
 
     // G-API code //////////////////////////////////////////////////////////////
@@ -237,7 +206,7 @@ TEST_P(DivCTest, DISABLED_DivByZeroTest)  // https://github.com/opencv/opencv/pu
     auto out = cv::gapi::divC(in1, sc1, dtype);
     cv::GComputation c(GIn(in1, sc1), GOut(out));
 
-    c.apply(gin(in_mat1, sc), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, sc), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -247,19 +216,13 @@ TEST_P(DivCTest, DISABLED_DivByZeroTest)  // https://github.com/opencv/opencv/pu
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        cv::Mat zeros = cv::Mat::zeros(sz_in, type);
+        cv::Mat zeros = cv::Mat::zeros(sz, type);
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != zeros));
     }
 }
 
 TEST_P(MeanTest, AccuracyTest)
 {
-    int type = 0;
-    bool initOut = false;
-    cv::Size sz_in;
-    cv::GCompileArgs compile_args;
-    std::tie(type, sz_in, initOut, compile_args) = GetParam();
-    initMatrixRandU(type, sz_in, initOut);
     cv::Scalar out_norm;
     cv::Scalar out_norm_ocv;
 
@@ -268,7 +231,7 @@ TEST_P(MeanTest, AccuracyTest)
     auto out = cv::gapi::mean(in);
 
     cv::GComputation c(cv::GIn(in), cv::GOut(out));
-    c.apply(cv::gin(in_mat1), cv::gout(out_norm), std::move(compile_args));
+    c.apply(cv::gin(in_mat1), cv::gout(out_norm), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         out_norm_ocv = cv::mean(in_mat1);
@@ -281,14 +244,7 @@ TEST_P(MeanTest, AccuracyTest)
 
 TEST_P(MaskTest, AccuracyTest)
 {
-    int type = 0;
-    bool initOut = false;
-    cv::Size sz_in;
-    cv::GCompileArgs compile_args;
-    std::tie(type, sz_in, initOut, compile_args) = GetParam();
-    initMatrixRandU(type, sz_in, type, initOut);
-
-    in_mat2 = cv::Mat(sz_in, CV_8UC1);
+    in_mat2 = cv::Mat(sz, CV_8UC1);
     cv::randu(in_mat2, cv::Scalar::all(0), cv::Scalar::all(255));
     in_mat2 = in_mat2 > 128;
 
@@ -297,7 +253,7 @@ TEST_P(MaskTest, AccuracyTest)
     auto out = cv::gapi::mask(in, m);
 
     cv::GComputation c(cv::GIn(in, m), cv::GOut(out));
-    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), std::move(compile_args));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         out_mat_ocv = cv::Mat::zeros(in_mat1.size(), in_mat1.type());
@@ -311,17 +267,12 @@ TEST_P(MaskTest, AccuracyTest)
 
 TEST_P(Polar2CartTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<0>(param);
-    auto compile_args = std::get<2>(param);
-    initMatsRandU(CV_32FC1, sz_in, CV_32FC1, std::get<1>(param));
-
     cv::Mat out_mat2;
     cv::Mat out_mat_ocv2;
-    if(std::get<1>(param) == true)
+    if (dtype != -1)
     {
-        out_mat2 = cv::Mat(sz_in, CV_32FC1);
-        out_mat_ocv2 = cv::Mat(sz_in, CV_32FC1);
+        out_mat2 = cv::Mat(sz, dtype);
+        out_mat_ocv2 = cv::Mat(sz, dtype);
     }
 
     // G-API code //////////////////////////////////////////////////////////////
@@ -329,7 +280,7 @@ TEST_P(Polar2CartTest, AccuracyTest)
     std::tie(out1, out2) = cv::gapi::polarToCart(in1, in2);
 
     cv::GComputation c(GIn(in1, in2), GOut(out1, out2));
-    c.apply(gin(in_mat1,in_mat2), gout(out_mat_gapi, out_mat2), std::move(compile_args));
+    c.apply(gin(in_mat1,in_mat2), gout(out_mat_gapi, out_mat2), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         cv::polarToCart(in_mat1, in_mat2, out_mat_ocv, out_mat_ocv2);
@@ -361,19 +312,14 @@ TEST_P(Polar2CartTest, AccuracyTest)
 
         EXPECT_EQ(0, cv::countNonZero(difx > 1e-6*absx));
         EXPECT_EQ(0, cv::countNonZero(dify > 1e-6*absy));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(Cart2PolarTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<0>(param);
-    auto compile_args = std::get<2>(param);
-    initMatsRandU(CV_32FC1, sz_in, CV_32FC1, std::get<1>(param));
-
-    cv::Mat out_mat2(sz_in, CV_32FC1);
-    cv::Mat out_mat_ocv2(sz_in, CV_32FC1);
+    cv::Mat out_mat2(sz, dtype);
+    cv::Mat out_mat_ocv2(sz, dtype);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2, out1, out2;
@@ -414,20 +360,12 @@ TEST_P(Cart2PolarTest, AccuracyTest)
         //        (expected relative accuracy like 1e-6)
         EXPECT_EQ(0, cv::countNonZero(difm > 1e-6*absm));
         EXPECT_EQ(0, cv::countNonZero(difa > 1e-3*absa));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(CmpTest, AccuracyTest)
 {
-    CmpTypes opType = CMP_EQ;
-    int type = 0;
-    cv::Size sz;
-    bool testWithScalar = false, initOutMatr = false;
-    cv::GCompileArgs compile_args;
-    std::tie(opType, testWithScalar, type, sz, initOutMatr, compile_args) = GetParam();
-    initMatsRandU(type, sz, CV_8U, initOutMatr);
-
     // G-API code & corresponding OpenCV code ////////////////////////////////
     cv::GMat in1, out;
     if( testWithScalar )
@@ -447,7 +385,7 @@ TEST_P(CmpTest, AccuracyTest)
         cv::compare(in_mat1, sc, out_mat_ocv, opType);
 
         cv::GComputation c(GIn(in1, in2), GOut(out));
-        c.apply(gin(in_mat1, sc), gout(out_mat_gapi), std::move(compile_args));
+        c.apply(gin(in_mat1, sc), gout(out_mat_gapi), getCompileArgs());
     }
     else
     {
@@ -466,7 +404,7 @@ TEST_P(CmpTest, AccuracyTest)
         cv::compare(in_mat1, in_mat2, out_mat_ocv, opType);
 
         cv::GComputation c(GIn(in1, in2), GOut(out));
-        c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+        c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
     }
 
     // Comparison //////////////////////////////////////////////////////////////
@@ -478,14 +416,6 @@ TEST_P(CmpTest, AccuracyTest)
 
 TEST_P(BitwiseTest, AccuracyTest)
 {
-    bitwiseOp opType = AND;
-    int type = 0;
-    cv::Size sz;
-    bool initOutMatr = false;
-    cv::GCompileArgs compile_args;
-    std::tie(opType, type, sz, initOutMatr, compile_args) = GetParam();
-    initMatsRandU(type, sz, type, initOutMatr);
-
     // G-API code & corresponding OpenCV code ////////////////////////////////
     cv::GMat in1, in2, out;
     switch(opType)
@@ -514,7 +444,7 @@ TEST_P(BitwiseTest, AccuracyTest)
         }
     }
     cv::GComputation c(GIn(in1, in2), GOut(out));
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // Comparison //////////////////////////////////////////////////////////////
     {
@@ -525,17 +455,12 @@ TEST_P(BitwiseTest, AccuracyTest)
 
 TEST_P(NotTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatrixRandU(std::get<0>(param), sz_in, std::get<0>(param), std::get<2>(param));
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in;
     auto out = cv::gapi::bitwise_not(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 /////////////////////////////////////////////////////////////
     {
@@ -544,18 +469,13 @@ TEST_P(NotTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(SelectTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatsRandU(type, sz_in, type, std::get<2>(param));
-    cv::Mat in_mask(sz_in, CV_8UC1);
+    cv::Mat in_mask(sz, CV_8UC1);
     cv::randu(in_mask, cv::Scalar::all(0), cv::Scalar::all(255));
 
     // G-API code //////////////////////////////////////////////////////////////
@@ -563,7 +483,7 @@ TEST_P(SelectTest, AccuracyTest)
     auto out = cv::gapi::select(in1, in2, in3);
     cv::GComputation c(GIn(in1, in2, in3), GOut(out));
 
-    c.apply(gin(in_mat1, in_mat2, in_mask), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2, in_mask), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -573,23 +493,18 @@ TEST_P(SelectTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(MinTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatsRandU(std::get<0>(param), sz_in, std::get<0>(param), std::get<2>(param));
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::min(in1, in2);
     cv::GComputation c(GIn(in1, in2), GOut(out));
 
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -598,23 +513,18 @@ TEST_P(MinTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(MaxTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatsRandU(std::get<0>(param), sz_in, std::get<0>(param), std::get<2>(param));
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::max(in1, in2);
     cv::GComputation c(GIn(in1, in2), GOut(out));
 
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -623,23 +533,18 @@ TEST_P(MaxTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(AbsDiffTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatsRandU(std::get<0>(param), sz_in, std::get<0>(param), std::get<2>(param));
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::absDiff(in1, in2);
     cv::GComputation c(GIn(in1, in2), GOut(out));
 
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -648,24 +553,19 @@ TEST_P(AbsDiffTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(AbsDiffCTest, AccuracyTest)
 {
-    auto param = GetParam();
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatsRandU(std::get<0>(param), sz_in, std::get<0>(param), std::get<2>(param));
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1;
     cv::GScalar sc1;
     auto out = cv::gapi::absDiffC(in1, sc1);
     cv::GComputation c(cv::GIn(in1, sc1), cv::GOut(out));
 
-    c.apply(gin(in_mat1, sc), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, sc), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -674,20 +574,12 @@ TEST_P(AbsDiffCTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(SumTest, AccuracyTest)
 {
-    auto param = GetParam();
-    compare_scalar_f cmpF = get<3>(GetParam());
-    MatType type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<4>(param);
-    initMatrixRandU(type, sz_in, type, std::get<2>(param));
-
-
     cv::Scalar out_sum;
     cv::Scalar out_sum_ocv;
 
@@ -696,7 +588,7 @@ TEST_P(SumTest, AccuracyTest)
     auto out = cv::gapi::sum(in);
 
     cv::GComputation c(cv::GIn(in), cv::GOut(out));
-    c.apply(cv::gin(in_mat1), cv::gout(out_sum), std::move(compile_args));
+    c.apply(cv::gin(in_mat1), cv::gout(out_sum), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         out_sum_ocv = cv::sum(in_mat1);
@@ -709,25 +601,17 @@ TEST_P(SumTest, AccuracyTest)
 
 TEST_P(AddWeightedTest, AccuracyTest)
 {
-    int type = 0, dtype = 0;
-    cv::Size sz_in;
-    bool initOut = false;
-    cv::GCompileArgs compile_args;
-    compare_f cmpF;
-    std::tie(type, sz_in, dtype, initOut, cmpF, compile_args) = GetParam();
-
     auto& rng = cv::theRNG();
     double alpha = rng.uniform(0.0, 1.0);
     double beta = rng.uniform(0.0, 1.0);
     double gamma = rng.uniform(0.0, 1.0);
-    initMatsRandU(type, sz_in, dtype, initOut);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::addWeighted(in1, alpha, in2, beta, gamma, dtype);
     cv::GComputation c(GIn(in1, in2), GOut(out));
 
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -735,20 +619,11 @@ TEST_P(AddWeightedTest, AccuracyTest)
     }
     // Comparison //////////////////////////////////////////////////////////////
     EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
-    EXPECT_EQ(out_mat_gapi.size(), sz_in);
-
+    EXPECT_EQ(out_mat_gapi.size(), sz);
 }
 
 TEST_P(NormTest, AccuracyTest)
 {
-    compare_scalar_f cmpF;
-    NormTypes opType = NORM_INF;
-    int type = 0;
-    cv::Size sz;
-    cv::GCompileArgs compile_args;
-    std::tie(opType, type, sz, cmpF, compile_args) = GetParam();
-    initMatrixRandU(type, sz, type, false);
-
     cv::Scalar out_norm;
     cv::Scalar out_norm_ocv;
 
@@ -764,7 +639,7 @@ TEST_P(NormTest, AccuracyTest)
     }
     out_norm_ocv = cv::norm(in_mat1, opType);
     cv::GComputation c(GIn(in1), GOut(out));
-    c.apply(gin(in_mat1), gout(out_norm), std::move(compile_args));
+    c.apply(gin(in_mat1), gout(out_norm), getCompileArgs());
 
     // Comparison //////////////////////////////////////////////////////////////
     {
@@ -774,16 +649,12 @@ TEST_P(NormTest, AccuracyTest)
 
 TEST_P(IntegralTest, AccuracyTest)
 {
-    int type = std::get<0>(GetParam());
-    cv::Size sz_in = std::get<1>(GetParam());
-    auto compile_args = std::get<2>(GetParam());
-
     int type_out = (type == CV_8U) ? CV_32SC1 : CV_64FC1;
-    cv::Mat in_mat1(sz_in, type);
+    in_mat1 = cv::Mat(sz, type);
 
     cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(255));
 
-    cv::Size sz_out = cv::Size(sz_in.width + 1, sz_in.height + 1);
+    cv::Size sz_out = cv::Size(sz.width + 1, sz.height + 1);
     cv::Mat out_mat1(sz_out, type_out);
     cv::Mat out_mat_ocv1(sz_out, type_out);
 
@@ -795,7 +666,7 @@ TEST_P(IntegralTest, AccuracyTest)
     std::tie(out1, out2)  = cv::gapi::integral(in1, type_out, CV_64FC1);
     cv::GComputation c(cv::GIn(in1), cv::GOut(out1, out2));
 
-    c.apply(cv::gin(in_mat1), cv::gout(out_mat1, out_mat2), std::move(compile_args));
+    c.apply(cv::gin(in_mat1), cv::gout(out_mat1, out_mat2), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -810,15 +681,8 @@ TEST_P(IntegralTest, AccuracyTest)
 
 TEST_P(ThresholdTest, AccuracyTestBinary)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-    int tt = std::get<2>(param);
-
-    auto compile_args = std::get<4>(param);
     cv::Scalar thr = initScalarRandU(50);
     cv::Scalar maxval = initScalarRandU(50) + cv::Scalar(50, 50, 50, 50);
-    initMatrixRandU(type, sz_in, type, std::get<3>(param));
     cv::Scalar out_scalar;
 
     // G-API code //////////////////////////////////////////////////////////////
@@ -827,7 +691,7 @@ TEST_P(ThresholdTest, AccuracyTestBinary)
     out = cv::gapi::threshold(in1, th1, mv1, tt);
     cv::GComputation c(GIn(in1, th1, mv1), GOut(out));
 
-    c.apply(gin(in_mat1, thr, maxval), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, thr, maxval), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -835,21 +699,14 @@ TEST_P(ThresholdTest, AccuracyTestBinary)
     }
     // Comparison //////////////////////////////////////////////////////////////
     {
-        ASSERT_EQ(out_mat_gapi.size(), sz_in);
+        ASSERT_EQ(out_mat_gapi.size(), sz);
         EXPECT_EQ(0, cv::norm(out_mat_ocv, out_mat_gapi, NORM_L1));
     }
 }
 
 TEST_P(ThresholdOTTest, AccuracyTestOtsu)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-    int tt = std::get<2>(param);
-
-    auto compile_args = std::get<4>(param);
     cv::Scalar maxval = initScalarRandU(50) + cv::Scalar(50, 50, 50, 50);
-    initMatrixRandU(type, sz_in, type, std::get<3>(param));
     cv::Scalar out_gapi_scalar;
     double ocv_res;
 
@@ -859,7 +716,7 @@ TEST_P(ThresholdOTTest, AccuracyTestOtsu)
     std::tie<cv::GMat, cv::GScalar>(out, scout) = cv::gapi::threshold(in1, mv1, tt);
     cv::GComputation c(cv::GIn(in1, mv1), cv::GOut(out, scout));
 
-    c.apply(gin(in_mat1, maxval), gout(out_mat_gapi, out_gapi_scalar), std::move(compile_args));
+    c.apply(gin(in_mat1, maxval), gout(out_mat_gapi, out_gapi_scalar), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -868,21 +725,15 @@ TEST_P(ThresholdOTTest, AccuracyTestOtsu)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
         EXPECT_EQ(ocv_res, out_gapi_scalar.val[0]);
     }
 }
 
 TEST_P(InRangeTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-
-    auto compile_args = std::get<3>(param);
     cv::Scalar thrLow = initScalarRandU(100);
     cv::Scalar thrUp = initScalarRandU(100) + cv::Scalar(100, 100, 100, 100);
-    initMatrixRandU(type, sz_in, type, std::get<2>(param));
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1;
@@ -890,7 +741,7 @@ TEST_P(InRangeTest, AccuracyTest)
     auto out = cv::gapi::inRange(in1, th1, mv1);
     cv::GComputation c(GIn(in1, th1, mv1), GOut(out));
 
-    c.apply(gin(in_mat1, thrLow, thrUp), gout(out_mat_gapi), std::move(compile_args));
+    c.apply(gin(in_mat1, thrLow, thrUp), gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -899,26 +750,22 @@ TEST_P(InRangeTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(Split3Test, AccuracyTest)
 {
-    cv::Size sz_in = std::get<0>(GetParam());
-    auto compile_args = std::get<1>(GetParam());
-    initMatrixRandU(CV_8UC3, sz_in, CV_8UC1);
-
-    cv::Mat out_mat2 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat3 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat_ocv2 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat_ocv3 = cv::Mat(sz_in, CV_8UC1);
+    cv::Mat out_mat2 = cv::Mat(sz, dtype);
+    cv::Mat out_mat3 = cv::Mat(sz, dtype);
+    cv::Mat out_mat_ocv2 = cv::Mat(sz, dtype);
+    cv::Mat out_mat_ocv3 = cv::Mat(sz, dtype);
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, out1, out2, out3;
     std::tie(out1, out2, out3)  = cv::gapi::split3(in1);
     cv::GComputation c(cv::GIn(in1), cv::GOut(out1, out2, out3));
 
-    c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat2, out_mat3), std::move(compile_args));
+    c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat2, out_mat3), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         std::vector<cv::Mat> out_mats_ocv = {out_mat_ocv, out_mat_ocv2, out_mat_ocv3};
@@ -934,22 +781,19 @@ TEST_P(Split3Test, AccuracyTest)
 
 TEST_P(Split4Test, AccuracyTest)
 {
-    cv::Size sz_in = std::get<0>(GetParam());
-    auto compile_args = std::get<1>(GetParam());
-    initMatrixRandU(CV_8UC4, sz_in, CV_8UC1);
-    cv::Mat out_mat2 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat3 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat4 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat_ocv2 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat_ocv3 = cv::Mat(sz_in, CV_8UC1);
-    cv::Mat out_mat_ocv4 = cv::Mat(sz_in, CV_8UC1);
+    cv::Mat out_mat2 = cv::Mat(sz, dtype);
+    cv::Mat out_mat3 = cv::Mat(sz, dtype);
+    cv::Mat out_mat4 = cv::Mat(sz, dtype);
+    cv::Mat out_mat_ocv2 = cv::Mat(sz, dtype);
+    cv::Mat out_mat_ocv3 = cv::Mat(sz, dtype);
+    cv::Mat out_mat_ocv4 = cv::Mat(sz, dtype);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, out1, out2, out3, out4;
     std::tie(out1, out2, out3, out4)  = cv::gapi::split4(in1);
     cv::GComputation c(cv::GIn(in1), cv::GOut(out1, out2, out3, out4));
 
-    c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat2, out_mat3, out_mat4), std::move(compile_args));
+    c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi, out_mat2, out_mat3, out_mat4), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         std::vector<cv::Mat> out_mats_ocv = {out_mat_ocv, out_mat_ocv2, out_mat_ocv3, out_mat_ocv4};
@@ -964,7 +808,8 @@ TEST_P(Split4Test, AccuracyTest)
     }
 }
 
-static void ResizeAccuracyTest(compare_f cmpF, int type, int interp, cv::Size sz_in, cv::Size sz_out, double fx, double fy, cv::GCompileArgs&& compile_args)
+static void ResizeAccuracyTest(const CompareMats& cmpF, int type, int interp, cv::Size sz_in,
+    cv::Size sz_out, double fx, double fy, cv::GCompileArgs&& compile_args)
 {
     cv::Mat in_mat1 (sz_in, type );
     cv::Scalar mean = cv::Scalar::all(127);
@@ -996,31 +841,48 @@ static void ResizeAccuracyTest(compare_f cmpF, int type, int interp, cv::Size sz
 
 TEST_P(ResizeTest, AccuracyTest)
 {
-    compare_f cmpF;
-    int type = 0, interp = 0;
-    cv::Size sz_in, sz_out;
-    cv::GCompileArgs compile_args;
-    std::tie(cmpF, type, interp, sz_in, sz_out, compile_args) = GetParam();
-    ResizeAccuracyTest(cmpF, type, interp, sz_in, sz_out, 0.0, 0.0, std::move(compile_args));
+    ResizeAccuracyTest(cmpF, type, interp, sz, sz_out, 0.0, 0.0, getCompileArgs());
 }
 
 TEST_P(ResizeTestFxFy, AccuracyTest)
 {
-    compare_f cmpF;
-    int type = 0, interp = 0;
-    cv::Size sz_in;
-    double fx = 0.0, fy = 0.0;
-    cv::GCompileArgs compile_args;
-    std::tie(cmpF, type, interp, sz_in, fx, fy, compile_args) = GetParam();
-    ResizeAccuracyTest(cmpF, type, interp, sz_in, cv::Size{0, 0}, fx, fy, std::move(compile_args));
+    ResizeAccuracyTest(cmpF, type, interp, sz, cv::Size{0, 0}, fx, fy, getCompileArgs());
+}
+
+TEST_P(ResizePTest, AccuracyTest)
+{
+    constexpr int planeNum = 3;
+    cv::Size sz_in_p {sz.width,  sz.height*planeNum};
+    cv::Size sz_out_p{sz_out.width, sz_out.height*planeNum};
+
+    cv::Mat in_mat(sz_in_p, CV_8UC1);
+    cv::randn(in_mat, cv::Scalar::all(127.0f), cv::Scalar::all(40.f));
+
+    cv::Mat out_mat    (sz_out_p, CV_8UC1);
+    cv::Mat out_mat_ocv_p(sz_out_p, CV_8UC1);
+
+    cv::GMatP in;
+    auto out = cv::gapi::resizeP(in, sz_out, interp);
+    cv::GComputation c(cv::GIn(in), cv::GOut(out));
+
+    c.compile(cv::descr_of(in_mat).asPlanar(planeNum), getCompileArgs())
+             (cv::gin(in_mat), cv::gout(out_mat));
+
+    for (int i = 0; i < planeNum; i++) {
+        const cv::Mat in_mat_roi = in_mat(cv::Rect(0, i*sz.height,  sz.width,  sz.height));
+        cv::Mat out_mat_roi = out_mat_ocv_p(cv::Rect(0, i*sz_out.height, sz_out.width, sz_out.height));
+        cv::resize(in_mat_roi, out_mat_roi, sz_out, 0, 0, interp);
+    }
+
+    // Comparison //////////////////////////////////////////////////////////////
+    {
+        EXPECT_TRUE(cmpF(out_mat, out_mat_ocv_p));
+    }
 }
 
 TEST_P(Merge3Test, AccuracyTest)
 {
-    cv::Size sz_in = std::get<0>(GetParam());
-    initMatsRandU(CV_8UC1, sz_in, CV_8UC3);
-    auto compile_args = std::get<1>(GetParam());
-    cv::Mat in_mat3(sz_in,  CV_8UC1);
+    cv::Mat in_mat3(sz, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
 
@@ -1031,7 +893,7 @@ TEST_P(Merge3Test, AccuracyTest)
     auto out = cv::gapi::merge3(in1, in2, in3);
 
     cv::GComputation c(cv::GIn(in1, in2, in3), cv::GOut(out));
-    c.apply(cv::gin(in_mat1, in_mat2, in_mat3), cv::gout(out_mat_gapi), std::move(compile_args));
+    c.apply(cv::gin(in_mat1, in_mat2, in_mat3), cv::gout(out_mat_gapi), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         std::vector<cv::Mat> in_mats_ocv = {in_mat1, in_mat2, in_mat3};
@@ -1045,11 +907,8 @@ TEST_P(Merge3Test, AccuracyTest)
 
 TEST_P(Merge4Test, AccuracyTest)
 {
-    cv::Size sz_in = std::get<0>(GetParam());
-    initMatsRandU(CV_8UC1, sz_in, CV_8UC4);
-    auto compile_args = std::get<1>(GetParam());
-    cv::Mat in_mat3(sz_in,  CV_8UC1);
-    cv::Mat in_mat4(sz_in,  CV_8UC1);
+    cv::Mat in_mat3(sz, type);
+    cv::Mat in_mat4(sz, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
 
@@ -1061,7 +920,7 @@ TEST_P(Merge4Test, AccuracyTest)
     auto out = cv::gapi::merge4(in1, in2, in3, in4);
 
     cv::GComputation c(cv::GIn(in1, in2, in3, in4), cv::GOut(out));
-    c.apply(cv::gin(in_mat1, in_mat2, in_mat3, in_mat4), cv::gout(out_mat_gapi), std::move(compile_args));
+    c.apply(cv::gin(in_mat1, in_mat2, in_mat3, in_mat4), cv::gout(out_mat_gapi), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         std::vector<cv::Mat> in_mats_ocv = {in_mat1, in_mat2, in_mat3, in_mat4};
@@ -1075,12 +934,7 @@ TEST_P(Merge4Test, AccuracyTest)
 
 TEST_P(RemapTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_in = std::get<1>(param);
-    auto compile_args = std::get<3>(param);
-    initMatrixRandU(type, sz_in, type, std::get<2>(param));
-    cv::Mat in_map1(sz_in,  CV_16SC2);
+    cv::Mat in_map1(sz, CV_16SC2);
     cv::Mat in_map2 = cv::Mat();
     cv::randu(in_map1, cv::Scalar::all(0), cv::Scalar::all(255));
     cv::Scalar bv = cv::Scalar();
@@ -1090,7 +944,7 @@ TEST_P(RemapTest, AccuracyTest)
     auto out = cv::gapi::remap(in1, in_map1, in_map2, cv::INTER_NEAREST,  cv::BORDER_REPLICATE, bv);
     cv::GComputation c(in1, out);
 
-    c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
+    c.apply(in_mat1, out_mat_gapi, getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -1099,25 +953,18 @@ TEST_P(RemapTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(FlipTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    int flipCode =  std::get<1>(param);
-    cv::Size sz_in = std::get<2>(param);
-    initMatrixRandU(type, sz_in, type, false);
-    auto compile_args = std::get<4>(GetParam());
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in;
     auto out = cv::gapi::flip(in, flipCode);
 
     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::flip(in_mat1, out_mat_ocv, flipCode);
@@ -1125,24 +972,17 @@ TEST_P(FlipTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(CropTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Rect rect_to = std::get<1>(param);
-    cv::Size sz_in = std::get<2>(param);
-    auto compile_args = std::get<4>(param);
-
-    initMatrixRandU(type, sz_in, type, false);
     cv::Size sz_out = cv::Size(rect_to.width, rect_to.height);
-    if( std::get<3>(param) == true )
+    if (dtype != -1)
     {
-        out_mat_gapi = cv::Mat(sz_out, type);
-        out_mat_ocv = cv::Mat(sz_out, type);
+        out_mat_gapi = cv::Mat(sz_out, dtype);
+        out_mat_ocv = cv::Mat(sz_out, dtype);
     }
 
     // G-API code //////////////////////////////////////////////////////////////
@@ -1150,7 +990,7 @@ TEST_P(CropTest, AccuracyTest)
     auto out = cv::gapi::crop(in, rect_to);
 
     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::Mat(in_mat1, rect_to).copyTo(out_mat_ocv);
@@ -1164,17 +1004,14 @@ TEST_P(CropTest, AccuracyTest)
 
 TEST_P(ConcatHorTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_out = std::get<1>(param);
-    auto compile_args = std::get<2>(param);
+    cv::Size sz_out = sz;
 
     int wpart = sz_out.width / 4;
     cv::Size sz_in1 = cv::Size(wpart, sz_out.height);
     cv::Size sz_in2 = cv::Size(sz_out.width - wpart, sz_out.height);
 
-    cv::Mat in_mat1 (sz_in1, type );
-    cv::Mat in_mat2 (sz_in2, type);
+    in_mat1 = cv::Mat(sz_in1, type );
+    in_mat2 = cv::Mat(sz_in2, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
 
@@ -1182,17 +1019,17 @@ TEST_P(ConcatHorTest, AccuracyTest)
     cv::randn(in_mat2, mean, stddev);
 
     cv::Mat out_mat(sz_out, type);
-    cv::Mat out_mat_ocv(sz_out, type);
+    out_mat_ocv = cv::Mat(sz_out, type);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::concatHor(in1, in2);
 
     cv::GComputation c(GIn(in1, in2), GOut(out));
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
-        cv::hconcat(in_mat1, in_mat2, out_mat_ocv );
+        cv::hconcat(in_mat1, in_mat2, out_mat_ocv);
     }
     // Comparison //////////////////////////////////////////////////////////////
     {
@@ -1202,17 +1039,14 @@ TEST_P(ConcatHorTest, AccuracyTest)
 
 TEST_P(ConcatVertTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_out = std::get<1>(param);
-    auto compile_args = std::get<2>(param);
+    cv::Size sz_out = sz;
 
     int hpart = sz_out.height * 2/3;
     cv::Size sz_in1 = cv::Size(sz_out.width, hpart);
     cv::Size sz_in2 = cv::Size(sz_out.width, sz_out.height - hpart);
 
-    cv::Mat in_mat1 (sz_in1, type);
-    cv::Mat in_mat2 (sz_in2, type);
+    in_mat1 = cv::Mat(sz_in1, type);
+    in_mat2 = cv::Mat(sz_in2, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
 
@@ -1220,14 +1054,14 @@ TEST_P(ConcatVertTest, AccuracyTest)
     cv::randn(in_mat2, mean, stddev);
 
     cv::Mat out_mat(sz_out, type);
-    cv::Mat out_mat_ocv(sz_out, type);
+    out_mat_ocv = cv::Mat(sz_out, type);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in1, in2;
     auto out = cv::gapi::concatVert(in1, in2);
 
     cv::GComputation c(GIn(in1, in2), GOut(out));
-    c.apply(gin(in_mat1, in_mat2), gout(out_mat), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2), gout(out_mat), getCompileArgs());
     // OpenCV code /////////////////////////////////////////////////////////////
     {
         cv::vconcat(in_mat1, in_mat2, out_mat_ocv );
@@ -1240,10 +1074,7 @@ TEST_P(ConcatVertTest, AccuracyTest)
 
 TEST_P(ConcatVertVecTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_out = std::get<1>(param);
-    auto compile_args = std::get<2>(param);
+    cv::Size sz_out = sz;
 
     int hpart1 = sz_out.height * 2/5;
     int hpart2 = sz_out.height / 5;
@@ -1251,9 +1082,9 @@ TEST_P(ConcatVertVecTest, AccuracyTest)
     cv::Size sz_in2 = cv::Size(sz_out.width, hpart2);
     cv::Size sz_in3 = cv::Size(sz_out.width, sz_out.height - hpart1 - hpart2);
 
-    cv::Mat in_mat1 (sz_in1, type);
-    cv::Mat in_mat2 (sz_in2, type);
-    cv::Mat in_mat3 (sz_in3, type);
+    in_mat1 = cv::Mat(sz_in1, type);
+    in_mat2 = cv::Mat(sz_in2, type);
+    cv::Mat in_mat3(sz_in3, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
 
@@ -1262,7 +1093,7 @@ TEST_P(ConcatVertVecTest, AccuracyTest)
     cv::randn(in_mat3, mean, stddev);
 
     cv::Mat out_mat(sz_out, type);
-    cv::Mat out_mat_ocv(sz_out, type);
+    out_mat_ocv = cv::Mat(sz_out, type);
 
     // G-API code //////////////////////////////////////////////////////////////
     std::vector <cv::GMat> mats(3);
@@ -1271,7 +1102,7 @@ TEST_P(ConcatVertVecTest, AccuracyTest)
     std::vector <cv::Mat> cvmats = {in_mat1, in_mat2, in_mat3};
 
     cv::GComputation c({mats[0], mats[1], mats[2]}, {out});
-    c.apply(gin(in_mat1, in_mat2, in_mat3), gout(out_mat), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2, in_mat3), gout(out_mat), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -1285,10 +1116,7 @@ TEST_P(ConcatVertVecTest, AccuracyTest)
 
 TEST_P(ConcatHorVecTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type = std::get<0>(param);
-    cv::Size sz_out = std::get<1>(param);
-    auto compile_args = std::get<2>(param);
+    cv::Size sz_out = sz;
 
     int wpart1 = sz_out.width / 3;
     int wpart2 = sz_out.width / 4;
@@ -1296,8 +1124,8 @@ TEST_P(ConcatHorVecTest, AccuracyTest)
     cv::Size sz_in2 = cv::Size(wpart2, sz_out.height);
     cv::Size sz_in3 = cv::Size(sz_out.width - wpart1 - wpart2, sz_out.height);
 
-    cv::Mat in_mat1 (sz_in1, type);
-    cv::Mat in_mat2 (sz_in2, type);
+    in_mat1 = cv::Mat(sz_in1, type);
+    in_mat2 = cv::Mat(sz_in2, type);
     cv::Mat in_mat3 (sz_in3, type);
     cv::Scalar mean = cv::Scalar::all(127);
     cv::Scalar stddev = cv::Scalar::all(40.f);
@@ -1307,7 +1135,7 @@ TEST_P(ConcatHorVecTest, AccuracyTest)
     cv::randn(in_mat3, mean, stddev);
 
     cv::Mat out_mat(sz_out, type);
-    cv::Mat out_mat_ocv(sz_out, type);
+    out_mat_ocv = cv::Mat(sz_out, type);
 
     // G-API code //////////////////////////////////////////////////////////////
     std::vector <cv::GMat> mats(3);
@@ -1316,7 +1144,7 @@ TEST_P(ConcatHorVecTest, AccuracyTest)
     std::vector <cv::Mat> cvmats = {in_mat1, in_mat2, in_mat3};
 
     cv::GComputation c({mats[0], mats[1], mats[2]}, {out});
-    c.apply(gin(in_mat1, in_mat2, in_mat3), gout(out_mat), std::move(compile_args));
+    c.apply(gin(in_mat1, in_mat2, in_mat3), gout(out_mat), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -1330,14 +1158,11 @@ TEST_P(ConcatHorVecTest, AccuracyTest)
 
 TEST_P(LUTTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type_mat = std::get<0>(param);
-    int type_lut = std::get<1>(param);
+    int type_mat = type;
+    int type_lut = dtype;
     int type_out = CV_MAKETYPE(CV_MAT_DEPTH(type_lut), CV_MAT_CN(type_mat));
-    cv::Size sz_in = std::get<2>(param);
-    auto compile_args = std::get<4>(GetParam());
 
-    initMatrixRandU(type_mat, sz_in, type_out);
+    initMatrixRandU(type_mat, sz, type_out);
     cv::Size sz_lut = cv::Size(1, 256);
     cv::Mat in_lut(sz_lut, type_lut);
     cv::randu(in_lut, cv::Scalar::all(0), cv::Scalar::all(255));
@@ -1347,7 +1172,7 @@ TEST_P(LUTTest, AccuracyTest)
     auto out = cv::gapi::LUT(in, in_lut);
 
     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::LUT(in_mat1, in_lut, out_mat_ocv);
@@ -1355,52 +1180,42 @@ TEST_P(LUTTest, AccuracyTest)
     // Comparison //////////////////////////////////////////////////////////////
     {
         EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(ConvertToTest, AccuracyTest)
 {
-    auto param = GetParam();
-    int type_mat = std::get<0>(param);
-    int depth_to = std::get<1>(param);
-    cv::Size sz_in = std::get<2>(param);
+    int type_mat = type;
+    int depth_to = dtype;
     int type_out = CV_MAKETYPE(depth_to, CV_MAT_CN(type_mat));
-    initMatrixRandU(type_mat, sz_in, type_out);
-    auto compile_args = std::get<3>(GetParam());
+    initMatrixRandU(type_mat, sz, type_out);
 
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in;
-    auto out = cv::gapi::convertTo(in, depth_to);
+    auto out = cv::gapi::convertTo(in, depth_to, alpha, beta);
 
     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 /////////////////////////////////////////////////////////////
     {
-        in_mat1.convertTo(out_mat_ocv, depth_to);
+        in_mat1.convertTo(out_mat_ocv, depth_to, alpha, beta);
     }
     // Comparison //////////////////////////////////////////////////////////////
     {
-        EXPECT_EQ(0, cv::countNonZero(out_mat_ocv != out_mat_gapi));
-        EXPECT_EQ(out_mat_gapi.size(), sz_in);
+        EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
+        EXPECT_EQ(out_mat_gapi.size(), sz);
     }
 }
 
 TEST_P(PhaseTest, AccuracyTest)
 {
-    int img_type = -1;
-    cv::Size img_size;
-    bool angle_in_degrees = false;
-    cv::GCompileArgs compile_args;
-    std::tie(img_type, img_size, angle_in_degrees, compile_args) = GetParam();
-    initMatsRandU(img_type, img_size, img_type);
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in_x, in_y;
     auto out = cv::gapi::phase(in_x, in_y, angle_in_degrees);
 
     cv::GComputation c(in_x, in_y, out);
-    c.apply(in_mat1, in_mat2, out_mat_gapi, std::move(compile_args));
+    c.apply(in_mat1, in_mat2, out_mat_gapi, getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     cv::phase(in_mat1, in_mat2, out_mat_ocv, angle_in_degrees);
@@ -1414,18 +1229,12 @@ TEST_P(PhaseTest, AccuracyTest)
 
 TEST_P(SqrtTest, AccuracyTest)
 {
-    int img_type = -1;
-    cv::Size img_size;
-    cv::GCompileArgs compile_args;
-    std::tie(img_type, img_size, compile_args) = GetParam();
-    initMatrixRandU(img_type, img_size, img_type);
-
     // G-API code //////////////////////////////////////////////////////////////
     cv::GMat in;
     auto out = cv::gapi::sqrt(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::sqrt(in_mat1, out_mat_ocv);
@@ -1439,27 +1248,14 @@ 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);
+    initMatrixRandN(type, sz, CV_MAKETYPE(ddepth, CV_MAT_CN(type)));
 
     // 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));
+    c.apply(cv::gin(in_mat1), cv::gout(out_mat_gapi), getCompileArgs());
 
     // OpenCV code /////////////////////////////////////////////////////////////
     {
@@ -1472,6 +1268,249 @@ TEST_P(NormalizeTest, Test)
     }
 }
 
+TEST_P(BackendOutputAllocationTest, EmptyOutput)
+{
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+
+    EXPECT_TRUE(out_mat_gapi.empty());
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+    EXPECT_FALSE(out_mat_gapi.empty());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: output is allocated to the needed size
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi.size());
+}
+
+TEST_P(BackendOutputAllocationTest, CorrectlyPreallocatedOutput)
+{
+    out_mat_gapi = cv::Mat(sz, type);
+    auto out_mat_gapi_ref = out_mat_gapi;  // shallow copy to ensure previous data is not deleted
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::add(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::add(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: output is not reallocated
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi.size());
+
+    EXPECT_EQ(out_mat_gapi_ref.data, out_mat_gapi.data);
+}
+
+TEST_P(BackendOutputAllocationTest, IncorrectOutputMeta)
+{
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::add(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+
+    const auto run_and_compare = [&c, this] ()
+    {
+        auto out_mat_gapi_ref = out_mat_gapi; // shallow copy to ensure previous data is not deleted
+
+        // G-API code //////////////////////////////////////////////////////////////
+        c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+
+        // OpenCV code /////////////////////////////////////////////////////////////
+        cv::add(in_mat1, in_mat2, out_mat_ocv, cv::noArray());
+
+        // Comparison //////////////////////////////////////////////////////////////
+        // Expected: size is changed, type is changed, output is reallocated
+        EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+        EXPECT_EQ(sz, out_mat_gapi.size());
+        EXPECT_EQ(type, out_mat_gapi.type());
+
+        EXPECT_NE(out_mat_gapi_ref.data, out_mat_gapi.data);
+    };
+
+    const auto chan = CV_MAT_CN(type);
+
+    out_mat_gapi = cv::Mat(sz, CV_MAKE_TYPE(CV_64F, chan));
+    run_and_compare();
+
+    out_mat_gapi = cv::Mat(sz, CV_MAKE_TYPE(CV_MAT_DEPTH(type), chan + 1));
+    run_and_compare();
+}
+
+TEST_P(BackendOutputAllocationTest, SmallerPreallocatedSize)
+{
+    out_mat_gapi = cv::Mat(sz / 2, type);
+    auto out_mat_gapi_ref = out_mat_gapi; // shallow copy to ensure previous data is not deleted
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: size is changed, output is reallocated due to original size < curr size
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi.size());
+
+    EXPECT_NE(out_mat_gapi_ref.data, out_mat_gapi.data);
+}
+
+TEST_P(BackendOutputAllocationTest, SmallerPreallocatedSizeWithSubmatrix)
+{
+    out_mat_gapi = cv::Mat(sz / 2, type);
+
+    cv::Mat out_mat_gapi_submat = out_mat_gapi(cv::Rect({10, 0}, sz / 5));
+    EXPECT_EQ(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+
+    auto out_mat_gapi_submat_ref = out_mat_gapi_submat; // shallow copy to ensure previous data is not deleted
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi_submat), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: submatrix is reallocated and is "detached", original matrix is unchanged
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi_submat != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi_submat.size());
+    EXPECT_EQ(sz / 2, out_mat_gapi.size());
+
+    EXPECT_NE(out_mat_gapi_submat_ref.data, out_mat_gapi_submat.data);
+    EXPECT_NE(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+}
+
+TEST_P(BackendOutputAllocationTest, LargerPreallocatedSize)
+{
+    out_mat_gapi = cv::Mat(sz * 2, type);
+    auto out_mat_gapi_ref = out_mat_gapi; // shallow copy to ensure previous data is not deleted
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: size is changed, output is reallocated
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi.size());
+
+    EXPECT_NE(out_mat_gapi_ref.data, out_mat_gapi.data);
+}
+
+TEST_P(BackendOutputAllocationLargeSizeWithCorrectSubmatrixTest,
+    LargerPreallocatedSizeWithCorrectSubmatrix)
+{
+    out_mat_gapi = cv::Mat(sz * 2, type);
+    auto out_mat_gapi_ref = out_mat_gapi; // shallow copy to ensure previous data is not deleted
+
+    cv::Mat out_mat_gapi_submat = out_mat_gapi(cv::Rect({5, 8}, sz));
+    EXPECT_EQ(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+
+    auto out_mat_gapi_submat_ref = out_mat_gapi_submat;
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi_submat), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: submatrix is not reallocated, original matrix is not reallocated
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi_submat != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi_submat.size());
+    EXPECT_EQ(sz * 2, out_mat_gapi.size());
+
+    EXPECT_EQ(out_mat_gapi_ref.data, out_mat_gapi.data);
+    EXPECT_EQ(out_mat_gapi_submat_ref.data, out_mat_gapi_submat.data);
+    EXPECT_EQ(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+}
+
+TEST_P(BackendOutputAllocationTest, LargerPreallocatedSizeWithSmallSubmatrix)
+{
+    out_mat_gapi = cv::Mat(sz * 2, type);
+    auto out_mat_gapi_ref = out_mat_gapi; // shallow copy to ensure previous data is not deleted
+
+    cv::Mat out_mat_gapi_submat = out_mat_gapi(cv::Rect({5, 8}, sz / 2));
+    EXPECT_EQ(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+
+    auto out_mat_gapi_submat_ref = out_mat_gapi_submat;
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::mul(in1, in2);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+    c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi_submat), getCompileArgs());
+
+    // OpenCV code /////////////////////////////////////////////////////////////
+    cv::multiply(in_mat1, in_mat2, out_mat_ocv);
+
+    // Comparison //////////////////////////////////////////////////////////////
+    // Expected: submatrix is reallocated and is "detached", original matrix is unchanged
+    EXPECT_EQ(0, cv::countNonZero(out_mat_gapi_submat != out_mat_ocv));
+    EXPECT_EQ(sz, out_mat_gapi_submat.size());
+    EXPECT_EQ(sz * 2, out_mat_gapi.size());
+
+    EXPECT_EQ(out_mat_gapi_ref.data, out_mat_gapi.data);
+    EXPECT_NE(out_mat_gapi_submat_ref.data, out_mat_gapi_submat.data);
+    EXPECT_NE(out_mat_gapi.data, out_mat_gapi_submat.datastart);
+}
+
+TEST_P(ReInitOutTest, TestWithAdd)
+{
+    in_mat1 = cv::Mat(sz, type);
+    in_mat2 = cv::Mat(sz, type);
+    cv::randu(in_mat1, cv::Scalar::all(0), cv::Scalar::all(100));
+    cv::randu(in_mat2, cv::Scalar::all(0), cv::Scalar::all(100));
+
+    // G-API code //////////////////////////////////////////////////////////////
+    cv::GMat in1, in2, out;
+    out = cv::gapi::add(in1, in2, dtype);
+    cv::GComputation c(cv::GIn(in1, in2), cv::GOut(out));
+
+    const auto run_and_compare = [&c, this] ()
+    {
+        // G-API code //////////////////////////////////////////////////////////////
+        c.apply(cv::gin(in_mat1, in_mat2), cv::gout(out_mat_gapi), getCompileArgs());
+
+        // OpenCV code /////////////////////////////////////////////////////////////
+        cv::add(in_mat1, in_mat2, out_mat_ocv, cv::noArray());
+
+        // Comparison //////////////////////////////////////////////////////////////
+        EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
+        EXPECT_EQ(out_mat_gapi.size(), sz);
+    };
+
+    // run for uninitialized output
+    run_and_compare();
+
+    // run for initialized output (can be initialized with a different size)
+    initOutMats(out_sz, type);
+    run_and_compare();
+}
+
 } // opencv_test
 
 #endif //OPENCV_GAPI_CORE_TESTS_INL_HPP