Merge pull request #16995 from mpashchenkov:mp/ocv-gapi-standalone-mat
G-API: Mat's "deownification" * deowned Mat * boner * Removed canDescribe test for own::Mat * Removed STANDALONE flag for apply() and operator() * Removed: desc_tests for own::Mat, descr_of for own::Mat. * Returned: tests, cv::gapi::own::descr_of; fixed alignment; Removed own::Mat's headers * Removed unused header own/mat.hpp from gbackend.hpp
This commit is contained in:
committed by
GitHub
parent
f19d0ae41d
commit
94e36d8c8d
@@ -17,7 +17,6 @@
|
||||
#include <opencv2/gapi/gcommon.hpp>
|
||||
#include <opencv2/gapi/gkernel.hpp>
|
||||
#include <opencv2/gapi/garg.hpp>
|
||||
#include <opencv2/gapi/own/convert.hpp> //to_ocv
|
||||
#include <opencv2/gapi/util/compiler_hints.hpp> //suppress_unused_warning
|
||||
#include <opencv2/gapi/util/util.hpp>
|
||||
|
||||
@@ -96,8 +95,8 @@ public:
|
||||
const T& inArg(int input) { return m_args.at(input).get<T>(); }
|
||||
|
||||
// Syntax sugar
|
||||
const cv::gapi::own::Mat& inMat(int input);
|
||||
cv::gapi::own::Mat& outMatR(int output); // FIXME: Avoid cv::gapi::own::Mat m = ctx.outMatR()
|
||||
const cv::Mat& inMat(int input);
|
||||
cv::Mat& outMatR(int output); // FIXME: Avoid cv::Mat m = ctx.outMatR()
|
||||
|
||||
const cv::Scalar& inVal(int input);
|
||||
cv::Scalar& outValR(int output); // FIXME: Avoid cv::Scalar s = ctx.outValR()
|
||||
@@ -147,7 +146,7 @@ namespace detail
|
||||
template<class T> struct get_in;
|
||||
template<> struct get_in<cv::GMat>
|
||||
{
|
||||
static cv::Mat get(GCPUContext &ctx, int idx) { return to_ocv(ctx.inMat(idx)); }
|
||||
static cv::Mat get(GCPUContext &ctx, int idx) { return ctx.inMat(idx); }
|
||||
};
|
||||
template<> struct get_in<cv::GMatP>
|
||||
{
|
||||
@@ -196,7 +195,7 @@ template<class T> struct get_in
|
||||
};
|
||||
|
||||
struct tracked_cv_mat{
|
||||
tracked_cv_mat(cv::gapi::own::Mat& m) : r{to_ocv(m)}, original_data{m.data} {}
|
||||
tracked_cv_mat(cv::Mat& m) : r{m}, original_data{m.data} {}
|
||||
cv::Mat r;
|
||||
uchar* original_data;
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
#include <cstdint> // uint8_t
|
||||
|
||||
#include <opencv2/gapi/opencv_includes.hpp>
|
||||
#include <opencv2/gapi/own/mat.hpp>
|
||||
#include <opencv2/gapi/gmat.hpp>
|
||||
|
||||
#include <opencv2/gapi/util/optional.hpp>
|
||||
#include <opencv2/gapi/own/mat.hpp>
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
@@ -114,7 +112,7 @@ public:
|
||||
int wlpi,
|
||||
BorderOpt border);
|
||||
// Constructor for in/out buffers (for tests)
|
||||
Buffer(const cv::gapi::own::Mat &data, bool is_input);
|
||||
Buffer(const cv::Mat &data, bool is_input);
|
||||
~Buffer();
|
||||
Buffer& operator=(Buffer&&);
|
||||
|
||||
|
||||
@@ -89,11 +89,10 @@ using GArgs = std::vector<GArg>;
|
||||
// FIXME: Move to a separate file!
|
||||
using GRunArg = util::variant<
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
cv::Mat,
|
||||
cv::UMat,
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
cv::gapi::wip::IStreamSource::Ptr,
|
||||
cv::gapi::own::Mat,
|
||||
cv::Mat,
|
||||
cv::Scalar,
|
||||
cv::detail::VectorRef,
|
||||
cv::detail::OpaqueRef
|
||||
@@ -122,10 +121,9 @@ struct Data: public GRunArg
|
||||
|
||||
using GRunArgP = util::variant<
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
cv::Mat*,
|
||||
cv::UMat*,
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
cv::gapi::own::Mat*,
|
||||
cv::Mat*,
|
||||
cv::Scalar*,
|
||||
cv::detail::VectorRef,
|
||||
cv::detail::OpaqueRef
|
||||
|
||||
@@ -250,8 +250,8 @@ public:
|
||||
void apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {}); // Arg-to-arg overload
|
||||
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
void apply(const std::vector<cv::gapi::own::Mat>& ins, // Compatibility overload
|
||||
const std::vector<cv::gapi::own::Mat>& outs,
|
||||
void apply(const std::vector<cv::Mat>& ins, // Compatibility overload
|
||||
const std::vector<cv::Mat>& outs,
|
||||
GCompileArgs &&args = {});
|
||||
|
||||
// 2. Syntax sugar and compatibility overloads
|
||||
|
||||
@@ -71,10 +71,6 @@ public:
|
||||
using GMat::GMat;
|
||||
};
|
||||
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
}}//gapi::own
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@@ -121,7 +117,7 @@ struct GAPI_EXPORTS GMatDesc
|
||||
// (it handles the case when
|
||||
// 1-channel mat can be reinterpreted as is (1-channel mat)
|
||||
// and as a 3-channel planar mat with height divided by 3)
|
||||
bool canDescribe(const cv::gapi::own::Mat& mat) const;
|
||||
bool canDescribe(const cv::Mat& mat) const;
|
||||
|
||||
// Meta combinator: return a new GMatDesc which differs in size by delta
|
||||
// (all other fields are taken unchanged from this GMatDesc)
|
||||
@@ -132,9 +128,6 @@ struct GAPI_EXPORTS GMatDesc
|
||||
desc.size += delta;
|
||||
return desc;
|
||||
}
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
bool canDescribe(const cv::Mat& mat) const;
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
// Meta combinator: return a new GMatDesc which differs in size by delta
|
||||
// (all other fields are taken unchanged from this GMatDesc)
|
||||
//
|
||||
@@ -213,15 +206,15 @@ struct GAPI_EXPORTS GMatDesc
|
||||
static inline GMatDesc empty_gmat_desc() { return GMatDesc{-1,-1,{-1,-1}}; }
|
||||
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
class Mat;
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat);
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::UMat &mat);
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat);
|
||||
/** @} */
|
||||
|
||||
// FIXME: WHY??? WHY it is under different namespace?
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
GAPI_EXPORTS GMatDesc descr_of(const Mat &mat);
|
||||
}}//gapi::own
|
||||
|
||||
|
||||
@@ -66,12 +66,10 @@ namespace detail
|
||||
|
||||
// Note: descr_of(std::vector<..>) returns a GArrayDesc, while
|
||||
// descrs_of(std::vector<..>) returns an array of Meta args!
|
||||
class Mat;
|
||||
class UMat;
|
||||
GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector<cv::Mat> &vec);
|
||||
GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector<cv::UMat> &vec);
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector<Mat> &vec);
|
||||
}} // namespace gapi::own
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <opencv2/gapi/gopaque.hpp>
|
||||
#include <opencv2/gapi/streaming/source.hpp>
|
||||
#include <opencv2/gapi/gcommon.hpp>
|
||||
#include <opencv2/gapi/own/convert.hpp>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -111,10 +110,9 @@ namespace detail
|
||||
// and GMat behavior is correct for GMatP)
|
||||
template<typename T> struct GTypeOf;
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
template<> struct GTypeOf<cv::Mat> { using type = cv::GMat; };
|
||||
template<> struct GTypeOf<cv::UMat> { using type = cv::GMat; };
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
template<> struct GTypeOf<cv::gapi::own::Mat> { using type = cv::GMat; };
|
||||
template<> struct GTypeOf<cv::Mat> { using type = cv::GMat; };
|
||||
template<> struct GTypeOf<cv::Scalar> { using type = cv::GScalar; };
|
||||
template<typename U> struct GTypeOf<std::vector<U> > { using type = cv::GArray<U>; };
|
||||
template<typename U> struct GTypeOf { using type = cv::GOpaque<U>;};
|
||||
|
||||
@@ -140,10 +140,14 @@ enum InterpolationFlags{
|
||||
INTER_MAX = 7,
|
||||
};
|
||||
// replacement of cv's structures:
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
}} // namespace gapi::own
|
||||
using Rect = gapi::own::Rect;
|
||||
using Size = gapi::own::Size;
|
||||
using Point = gapi::own::Point;
|
||||
using Scalar = gapi::own::Scalar;
|
||||
using Mat = gapi::own::Mat;
|
||||
} // namespace cv
|
||||
|
||||
static inline int cvFloor( double value )
|
||||
|
||||
Reference in New Issue
Block a user