github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/gapi/gcall.hpp (about)

     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.
     4  //
     5  // Copyright (C) 2018 Intel Corporation
     6  
     7  
     8  #ifndef OPENCV_GAPI_GCALL_HPP
     9  #define OPENCV_GAPI_GCALL_HPP
    10  
    11  #include <opencv2/gapi/garg.hpp>      // GArg
    12  #include <opencv2/gapi/gmat.hpp>      // GMat
    13  #include <opencv2/gapi/gscalar.hpp>   // GScalar
    14  #include <opencv2/gapi/gframe.hpp>    // GFrame
    15  #include <opencv2/gapi/garray.hpp>    // GArray<T>
    16  #include <opencv2/gapi/gopaque.hpp>   // GOpaque<T>
    17  
    18  namespace cv {
    19  
    20  struct GKernel;
    21  
    22  // The whole idea of this class is to represent an operation
    23  // which is applied to arguments. This is part of public API,
    24  // since it is what users should use to define kernel interfaces.
    25  
    26  class GAPI_EXPORTS GCall final
    27  {
    28  public:
    29      class Priv;
    30  
    31      explicit GCall(const GKernel &k);
    32      ~GCall();
    33  
    34      template<typename... Ts>
    35      GCall& pass(Ts&&... args)
    36      {
    37          setArgs({cv::GArg(std::move(args))...});
    38          return *this;
    39      }
    40  
    41      // A generic yield method - obtain a link to operator's particular GMat output
    42      GMat    yield      (int output = 0);
    43      GMatP   yieldP     (int output = 0);
    44      GScalar yieldScalar(int output = 0);
    45      GFrame  yieldFrame (int output = 0);
    46  
    47      template<class T> GArray<T> yieldArray(int output = 0)
    48      {
    49          return GArray<T>(yieldArray(output));
    50      }
    51  
    52      template<class T> GOpaque<T> yieldOpaque(int output = 0)
    53      {
    54          return GOpaque<T>(yieldOpaque(output));
    55      }
    56  
    57      // Internal use only
    58      Priv& priv();
    59      const Priv& priv() const;
    60  
    61      // GKernel and params can be modified, it's needed for infer<Generic>,
    62      // because information about output shapes doesn't exist in compile time
    63      GKernel& kernel();
    64      cv::util::any& params();
    65  
    66      void setArgs(std::vector<GArg> &&args);
    67  
    68  protected:
    69      std::shared_ptr<Priv> m_priv;
    70  
    71      // Public versions return a typed array or opaque, those are implementation details
    72      detail::GArrayU yieldArray(int output = 0);
    73      detail::GOpaqueU yieldOpaque(int output = 0);
    74  };
    75  
    76  } // namespace cv
    77  
    78  #endif // OPENCV_GAPI_GCALL_HPP