gscalar.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef OPENCV_GAPI_GSCALAR_HPP
  7. #define OPENCV_GAPI_GSCALAR_HPP
  8. #include <ostream>
  9. #include <opencv2/gapi/opencv_includes.hpp>
  10. #include <opencv2/gapi/gcommon.hpp> // GShape
  11. #include <opencv2/gapi/util/optional.hpp>
  12. namespace cv
  13. {
  14. // Forward declaration; GNode and GOrigin are an internal
  15. // (user-inaccessible) classes.
  16. class GNode;
  17. struct GOrigin;
  18. /** \addtogroup gapi_data_objects
  19. * @{
  20. */
  21. class GAPI_EXPORTS_W_SIMPLE GScalar
  22. {
  23. public:
  24. GAPI_WRAP GScalar(); // Empty constructor
  25. explicit GScalar(const cv::Scalar& s); // Constant value constructor from cv::Scalar
  26. explicit GScalar(cv::Scalar&& s); // Constant value move-constructor from cv::Scalar
  27. GScalar(double v0); // Constant value constructor from double
  28. GScalar(const GNode &n, std::size_t out); // Operation result constructor
  29. GOrigin& priv(); // Internal use only
  30. const GOrigin& priv() const; // Internal use only
  31. private:
  32. std::shared_ptr<GOrigin> m_priv;
  33. };
  34. /** @} */
  35. /**
  36. * \addtogroup gapi_meta_args
  37. * @{
  38. */
  39. struct GScalarDesc
  40. {
  41. // NB.: right now it is empty
  42. inline bool operator== (const GScalarDesc &) const
  43. {
  44. return true; // NB: implement this method if GScalar meta appears
  45. }
  46. inline bool operator!= (const GScalarDesc &rhs) const
  47. {
  48. return !(*this == rhs);
  49. }
  50. };
  51. static inline GScalarDesc empty_scalar_desc() { return GScalarDesc(); }
  52. GAPI_EXPORTS GScalarDesc descr_of(const cv::Scalar &scalar);
  53. std::ostream& operator<<(std::ostream& os, const cv::GScalarDesc &desc);
  54. } // namespace cv
  55. #endif // OPENCV_GAPI_GSCALAR_HPP