1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Added GMatP type

This commit is contained in:
Ruslan Garnov
2019-04-29 19:21:14 +03:00
parent faca45a7ea
commit 834d438d6e
11 changed files with 50 additions and 10 deletions
@@ -124,6 +124,10 @@ template<> struct get_in<cv::GMat>
{
static cv::Mat get(GCPUContext &ctx, int idx) { return to_ocv(ctx.inMat(idx)); }
};
template<> struct get_in<cv::GMatP>
{
static cv::Mat get(GCPUContext &ctx, int idx) { return get_in<cv::GMat>::get(ctx, idx); }
};
template<> struct get_in<cv::GScalar>
{
static cv::Scalar get(GCPUContext &ctx, int idx) { return to_ocv(ctx.inVal(idx)); }
@@ -188,6 +192,13 @@ template<> struct get_out<cv::GMat>
return {r};
}
};
template<> struct get_out<cv::GMatP>
{
static tracked_cv_mat get(GCPUContext &ctx, int idx)
{
return get_out<cv::GMat>::get(ctx, idx);
}
};
template<> struct get_out<cv::GScalar>
{
static scalar_wrapper get(GCPUContext &ctx, int idx)
@@ -38,6 +38,7 @@ public:
// A generic yield method - obtain a link to operator's particular GMat output
GMat yield (int output = 0);
GMatP yieldP (int output = 0);
GScalar yieldScalar(int output = 0);
template<class T> GArray<T> yieldArray(int output = 0)
@@ -63,6 +63,10 @@ namespace detail
{
static inline cv::GMat yield(cv::GCall &call, int i) { return call.yield(i); }
};
template<> struct Yield<cv::GMatP>
{
static inline cv::GMatP yield(cv::GCall &call, int i) { return call.yieldP(i); }
};
template<> struct Yield<cv::GScalar>
{
static inline cv::GScalar yield(cv::GCall &call, int i) { return call.yieldScalar(i); }
@@ -82,6 +86,7 @@ namespace detail
// This mapping is used to transform types to call outMeta() callback.
template<typename T> struct MetaType;
template<> struct MetaType<cv::GMat> { using type = GMatDesc; };
template<> struct MetaType<cv::GMatP> { using type = GMatDesc; };
template<> struct MetaType<cv::GScalar> { using type = GScalarDesc; };
template<typename U> struct MetaType<cv::GArray<U> > { using type = GArrayDesc; };
template<typename T> struct MetaType { using type = T; }; // opaque args passed as-is
@@ -46,6 +46,12 @@ private:
std::shared_ptr<GOrigin> m_priv;
};
class GAPI_EXPORTS GMatP : public GMat
{
public:
using GMat::GMat;
};
namespace gapi { namespace own {
class Mat;
}}//gapi::own
@@ -34,6 +34,7 @@ namespace cv {
// directly.
using GProtoArg = util::variant
< GMat
, GMatP
, GScalar
, detail::GArrayU // instead of GArray<T>
>;
@@ -29,6 +29,7 @@ namespace detail
OPAQUE, // Unknown, generic, opaque-to-GAPI data type - STATIC
GOBJREF, // <internal> reference to object
GMAT, // a cv::GMat
GMATP, // a cv::GMatP
GSCALAR, // a cv::GScalar
GARRAY, // a cv::GArrayU (note - exactly GArrayU, not GArray<T>!)
};
@@ -47,6 +48,11 @@ namespace detail
static constexpr const ArgKind kind = ArgKind::GMAT;
static constexpr const GShape shape = GShape::GMAT;
};
template<> struct GTypeTraits<cv::GMatP>
{
static constexpr const ArgKind kind = ArgKind::GMATP;
static constexpr const GShape shape = GShape::GMAT;
};
template<> struct GTypeTraits<cv::GScalar>
{
static constexpr const ArgKind kind = ArgKind::GSCALAR;
@@ -76,6 +82,10 @@ namespace detail
// Resolve a Host type back to its associated G-Type.
// FIXME: Probably it can be avoided
// FIXME: GMatP is not present here.
// (Actually these traits is used only to check
// if associated G-type has custom wrap functions
// 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; };