gscalar.hpp 2.3 KB

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