1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
5 // Copyright (C) 2018-2019 Intel Corporation
8 #include "test_precomp.hpp"
13 // FIXME: avoid code duplication
14 // The below graph and config is taken from ComplexIslands test suite
15 TEST(GExecutor, SmokeTest)
22 tmp[0] = cv::gapi::bitwise_not(cv::gapi::bitwise_not(in[0]));
23 tmp[1] = cv::gapi::boxFilter(in[1], -1, cv::Size(3,3));
24 tmp[2] = tmp[0] + tmp[1]; // FIXME: handle tmp[2] = tmp[0]+tmp[2] typo
25 scl = cv::gapi::sum(tmp[1]);
26 tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
27 out[0] = tmp[2] + scl;
28 out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
31 // ........................... .........
32 // (in1) -> NotNot ->(tmp0) --> Add ---------> (tmp2) --> AddC -------> (out1)
33 // :.....................^...: :..^....:
37 // .....................:......... :
38 // (in2) -> Blur -> (tmp1) ----'--> Sum ----> (scl0) ----'
39 // :..........:..................: isl1
40 // : ..............................
41 // `------------> Median -> (tmp3) --> Blur -------> (out2)
42 // :............................:
44 cv::gapi::island("isl0", cv::GIn(in[0], tmp[1]), cv::GOut(tmp[2]));
45 cv::gapi::island("isl1", cv::GIn(tmp[1]), cv::GOut(out[1]));
47 cv::Mat in_mat1 = cv::Mat::eye(32, 32, CV_8UC1);
48 cv::Mat in_mat2 = cv::Mat::eye(32, 32, CV_8UC1);
52 cv::GComputation(cv::GIn(in[0], in[1]), cv::GOut(out[0], out[1]))
53 .apply(cv::gin(in_mat1, in_mat2), cv::gout(out_gapi[0], out_gapi[1]));
64 ocv_tmp0 = in_mat1; // skip !(!)
65 cv::boxFilter(in_mat2, ocv_tmp1, -1, cv::Size(3,3));
66 ocv_tmp2 = ocv_tmp0 + ocv_tmp1;
67 ocv_scl = cv::sum(ocv_tmp1);
68 cv::medianBlur(ocv_tmp1, ocv_tmp3, 3);
69 out_ocv[0] = ocv_tmp2 + ocv_scl;
70 cv::boxFilter(ocv_tmp3, out_ocv[1], -1, cv::Size(3,3));
73 EXPECT_EQ(0, cv::countNonZero(out_gapi[0] != out_ocv[0]));
74 EXPECT_EQ(0, cv::countNonZero(out_gapi[1] != out_ocv[1]));
76 // FIXME: check that GIslandModel has more than 1 island (e.g. fusion
77 // with breakdown worked)
80 // FIXME: Add explicit tests on GMat/GScalar/GArray<T> being connectors
81 // between executed islands
83 } // namespace opencv_test