// This file is part of OpenCV project. // 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) 2021 Intel Corporation #ifndef OPENCV_GAPI_PYTHON_BRIDGE_HPP #define OPENCV_GAPI_PYTHON_BRIDGE_HPP #include #include #include #define ID(T, E) T #define ID_(T, E) ID(T, E), #define WRAP_ARGS(T, E, G) \ G(T, E) #define SWITCH(type, LIST_G, HC) \ switch(type) { \ LIST_G(HC, HC) \ default: \ GAPI_Assert(false && "Unsupported type"); \ } #define GARRAY_TYPE_LIST_G(G, G2) \ WRAP_ARGS(bool , cv::gapi::ArgType::CV_BOOL, G) \ WRAP_ARGS(int , cv::gapi::ArgType::CV_INT, G) \ WRAP_ARGS(double , cv::gapi::ArgType::CV_DOUBLE, G) \ WRAP_ARGS(float , cv::gapi::ArgType::CV_FLOAT, G) \ WRAP_ARGS(std::string , cv::gapi::ArgType::CV_STRING, G) \ WRAP_ARGS(cv::Point , cv::gapi::ArgType::CV_POINT, G) \ WRAP_ARGS(cv::Point2f , cv::gapi::ArgType::CV_POINT2F, G) \ WRAP_ARGS(cv::Size , cv::gapi::ArgType::CV_SIZE, G) \ WRAP_ARGS(cv::Rect , cv::gapi::ArgType::CV_RECT, G) \ WRAP_ARGS(cv::Scalar , cv::gapi::ArgType::CV_SCALAR, G) \ WRAP_ARGS(cv::Mat , cv::gapi::ArgType::CV_MAT, G) \ WRAP_ARGS(cv::GMat , cv::gapi::ArgType::CV_GMAT, G2) #define GOPAQUE_TYPE_LIST_G(G, G2) \ WRAP_ARGS(bool , cv::gapi::ArgType::CV_BOOL, G) \ WRAP_ARGS(int , cv::gapi::ArgType::CV_INT, G) \ WRAP_ARGS(double , cv::gapi::ArgType::CV_DOUBLE, G) \ WRAP_ARGS(float , cv::gapi::ArgType::CV_FLOAT, G) \ WRAP_ARGS(std::string , cv::gapi::ArgType::CV_STRING, G) \ WRAP_ARGS(cv::Point , cv::gapi::ArgType::CV_POINT, G) \ WRAP_ARGS(cv::Point2f , cv::gapi::ArgType::CV_POINT2F, G) \ WRAP_ARGS(cv::Size , cv::gapi::ArgType::CV_SIZE, G) \ WRAP_ARGS(cv::Rect , cv::gapi::ArgType::CV_RECT, G2) \ namespace cv { namespace gapi { // NB: cv.gapi.CV_BOOL in python enum ArgType { CV_BOOL, CV_INT, CV_DOUBLE, CV_FLOAT, CV_STRING, CV_POINT, CV_POINT2F, CV_SIZE, CV_RECT, CV_SCALAR, CV_MAT, CV_GMAT, }; } // namespace gapi namespace detail { template