Merge pull request #16745 from Volskig:mp/ocv-gapi-standalone-size
G-API: Unification of own:: structures with cv:: (Size, Point, Rect) * deowned Size Rect Point * Deownded Size Rect Point * With Scalar
This commit is contained in:
committed by
GitHub
parent
557ac3dbaf
commit
277f0d270f
@@ -17,7 +17,6 @@
|
||||
#include <opencv2/gapi/gcommon.hpp>
|
||||
#include <opencv2/gapi/gkernel.hpp>
|
||||
#include <opencv2/gapi/garg.hpp>
|
||||
#include <opencv2/gapi/own/types.hpp>
|
||||
|
||||
#include <opencv2/gapi/fluid/gfluidbuffer.hpp>
|
||||
|
||||
@@ -109,7 +108,7 @@ public:
|
||||
*/
|
||||
struct GFluidOutputRois
|
||||
{
|
||||
std::vector<cv::gapi::own::Rect> rois;
|
||||
std::vector<cv::Rect> rois;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <opencv2/gapi/opencv_includes.hpp>
|
||||
#include <opencv2/gapi/gcommon.hpp> // GShape
|
||||
|
||||
#include <opencv2/gapi/own/types.hpp> // cv::gapi::own::Size
|
||||
#include <opencv2/gapi/own/convert.hpp> // to_own
|
||||
#include <opencv2/gapi/own/assert.hpp>
|
||||
|
||||
// TODO GAPI_EXPORTS or so
|
||||
@@ -82,11 +80,11 @@ struct GAPI_EXPORTS GMatDesc
|
||||
// FIXME: Default initializers in C++14
|
||||
int depth;
|
||||
int chan;
|
||||
cv::gapi::own::Size size; // NB.: no multi-dimensional cases covered yet
|
||||
cv::Size size; // NB.: no multi-dimensional cases covered yet
|
||||
bool planar;
|
||||
std::vector<int> dims; // FIXME: Maybe it's real questionable to have it here
|
||||
|
||||
GMatDesc(int d, int c, cv::gapi::own::Size s, bool p = false)
|
||||
GMatDesc(int d, int c, cv::Size s, bool p = false)
|
||||
: depth(d), chan(c), size(s), planar(p) {}
|
||||
|
||||
GMatDesc(int d, const std::vector<int> &dd)
|
||||
@@ -122,23 +120,13 @@ struct GAPI_EXPORTS GMatDesc
|
||||
// Meta combinator: return a new GMatDesc which differs in size by delta
|
||||
// (all other fields are taken unchanged from this GMatDesc)
|
||||
// FIXME: a better name?
|
||||
GMatDesc withSizeDelta(cv::gapi::own::Size delta) const
|
||||
GMatDesc withSizeDelta(cv::Size delta) const
|
||||
{
|
||||
GMatDesc desc(*this);
|
||||
desc.size += delta;
|
||||
return desc;
|
||||
}
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
GMatDesc withSizeDelta(cv::Size delta) const
|
||||
{
|
||||
return withSizeDelta(to_own(delta));
|
||||
}
|
||||
|
||||
GMatDesc withSize(cv::Size sz) const
|
||||
{
|
||||
return withSize(to_own(sz));
|
||||
}
|
||||
|
||||
bool canDescribe(const cv::Mat& mat) const;
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
// Meta combinator: return a new GMatDesc which differs in size by delta
|
||||
@@ -147,10 +135,10 @@ struct GAPI_EXPORTS GMatDesc
|
||||
// This is an overload.
|
||||
GMatDesc withSizeDelta(int dx, int dy) const
|
||||
{
|
||||
return withSizeDelta(cv::gapi::own::Size{dx,dy});
|
||||
return withSizeDelta(cv::Size{dx,dy});
|
||||
}
|
||||
|
||||
GMatDesc withSize(cv::gapi::own::Size sz) const
|
||||
GMatDesc withSize(cv::Size sz) const
|
||||
{
|
||||
GMatDesc desc(*this);
|
||||
desc.size = sz;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
|
||||
#include <opencv2/gapi/opencv_includes.hpp>
|
||||
#include <opencv2/gapi/own/types.hpp>
|
||||
#include <opencv2/gapi/own/mat.hpp>
|
||||
|
||||
namespace cv
|
||||
@@ -33,12 +32,6 @@ namespace cv
|
||||
? cv::gapi::own::Mat{m.rows, m.cols, m.type(), m.data, m.step}
|
||||
: cv::gapi::own::Mat{to_own<int>(m.size), m.type(), m.data};
|
||||
};
|
||||
|
||||
inline cv::gapi::own::Size to_own (const Size& s) { return {s.width, s.height}; };
|
||||
|
||||
inline cv::gapi::own::Rect to_own (const Rect& r) { return {r.x, r.y, r.width, r.height}; };
|
||||
|
||||
|
||||
namespace gapi
|
||||
{
|
||||
namespace own
|
||||
@@ -49,10 +42,6 @@ namespace own
|
||||
: cv::Mat{m.dims, m.type(), m.data};
|
||||
}
|
||||
cv::Mat to_ocv(Mat&&) = delete;
|
||||
inline cv::Size to_ocv (const Size& s) { return cv::Size(s.width, s.height); };
|
||||
|
||||
inline cv::Rect to_ocv (const Rect& r) { return cv::Rect(r.x, r.y, r.width, r.height); };
|
||||
|
||||
} // namespace own
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define OPENCV_GAPI_CV_DEFS_HPP
|
||||
|
||||
#if defined(GAPI_STANDALONE)
|
||||
#include <opencv2/gapi/own/types.hpp> // cv::gapi::own::Rect/Size/Point
|
||||
#include <opencv2/gapi/own/scalar.hpp> // cv::gapi::own::Scalar
|
||||
|
||||
// Simulate OpenCV definitions taken from various
|
||||
@@ -139,6 +140,9 @@ enum InterpolationFlags{
|
||||
INTER_MAX = 7,
|
||||
};
|
||||
// replacement of cv's structures:
|
||||
using Rect = gapi::own::Rect;
|
||||
using Size = gapi::own::Size;
|
||||
using Point = gapi::own::Point;
|
||||
using Scalar = gapi::own::Scalar;
|
||||
} // namespace cv
|
||||
|
||||
|
||||
Reference in New Issue
Block a user