github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/gapi/own/scalar.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_GAPI_OWN_SCALAR_HPP
     9  #define OPENCV_GAPI_GAPI_OWN_SCALAR_HPP
    10  
    11  #include <opencv2/gapi/own/exports.hpp>
    12  
    13  namespace cv
    14  {
    15  namespace gapi
    16  {
    17  namespace own
    18  {
    19  
    20  class GAPI_EXPORTS Scalar
    21  {
    22  public:
    23      Scalar() = default;
    24      explicit Scalar(double v0) { val[0] = v0; };
    25      Scalar(double v0, double v1, double v2 = 0, double v3 = 0)
    26          : val{v0, v1, v2, v3}
    27      {
    28      }
    29  
    30      const double& operator[](int i) const { return val[i]; }
    31            double& operator[](int i)       { return val[i]; }
    32  
    33      static Scalar all(double v0) { return Scalar(v0, v0, v0, v0); }
    34  
    35      double val[4] = {0};
    36  };
    37  
    38  inline bool operator==(const Scalar& lhs, const Scalar& rhs)
    39  {
    40      return std::equal(std::begin(lhs.val), std::end(lhs.val), std::begin(rhs.val));
    41  }
    42  
    43  } // namespace own
    44  } // namespace gapi
    45  } // namespace cv
    46  
    47  #endif // OPENCV_GAPI_GAPI_OWN_SCALAR_HPP