convert.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_OWN_CONVERT_HPP
  7. #define OPENCV_GAPI_OWN_CONVERT_HPP
  8. #if !defined(GAPI_STANDALONE)
  9. #include <opencv2/gapi/opencv_includes.hpp>
  10. #include <opencv2/gapi/own/types.hpp>
  11. #include <opencv2/gapi/own/mat.hpp>
  12. #include "opencv2/gapi/own/scalar.hpp"
  13. namespace cv
  14. {
  15. inline cv::gapi::own::Mat to_own(Mat const& m) { return {m.rows, m.cols, m.type(), m.data, m.step};};
  16. cv::gapi::own::Mat to_own(Mat&&) = delete;
  17. inline cv::gapi::own::Scalar to_own(const cv::Scalar& s) { return {s[0], s[1], s[2], s[3]}; };
  18. inline cv::gapi::own::Size to_own (const Size& s) { return {s.width, s.height}; };
  19. inline cv::gapi::own::Rect to_own (const Rect& r) { return {r.x, r.y, r.width, r.height}; };
  20. namespace gapi
  21. {
  22. namespace own
  23. {
  24. inline cv::Mat to_ocv(Mat const& m) { return {m.rows, m.cols, m.type(), m.data, m.step};};
  25. cv::Mat to_ocv(Mat&&) = delete;
  26. inline cv::Scalar to_ocv(const Scalar& s) { return {s[0], s[1], s[2], s[3]}; };
  27. inline cv::Size to_ocv (const Size& s) { return cv::Size(s.width, s.height); };
  28. inline cv::Rect to_ocv (const Rect& r) { return cv::Rect(r.x, r.y, r.width, r.height); };
  29. } // namespace own
  30. } // namespace gapi
  31. } // namespace cv
  32. #endif // !defined(GAPI_STANDALONE)
  33. #endif // OPENCV_GAPI_OWN_CONVERT_HPP