Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
076ee65c
Commit
076ee65c
authored
Apr 30, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14448 from rgarnov:gapi_gmatp
parents
f5801ee7
834d438d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
50 additions
and
10 deletions
+50
-10
gcpukernel.hpp
modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp
+11
-0
gcall.hpp
modules/gapi/include/opencv2/gapi/gcall.hpp
+1
-0
gkernel.hpp
modules/gapi/include/opencv2/gapi/gkernel.hpp
+5
-0
gmat.hpp
modules/gapi/include/opencv2/gapi/gmat.hpp
+6
-0
gproto.hpp
modules/gapi/include/opencv2/gapi/gproto.hpp
+1
-0
gtype_traits.hpp
modules/gapi/include/opencv2/gapi/gtype_traits.hpp
+10
-0
gcall.cpp
modules/gapi/src/api/gcall.cpp
+5
-0
gproto.cpp
modules/gapi/src/api/gproto.cpp
+5
-0
gcompiler.cpp
modules/gapi/src/compiler/gcompiler.cpp
+1
-0
gapi_planar_test.cpp
modules/gapi/test/gapi_planar_test.cpp
+4
-10
gapi_int_garg_test.cpp
modules/gapi/test/internal/gapi_int_garg_test.cpp
+1
-0
No files found.
modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp
View file @
076ee65c
...
@@ -124,6 +124,10 @@ template<> struct get_in<cv::GMat>
...
@@ -124,6 +124,10 @@ 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
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
>
template
<>
struct
get_in
<
cv
::
GScalar
>
{
{
static
cv
::
Scalar
get
(
GCPUContext
&
ctx
,
int
idx
)
{
return
to_ocv
(
ctx
.
inVal
(
idx
));
}
static
cv
::
Scalar
get
(
GCPUContext
&
ctx
,
int
idx
)
{
return
to_ocv
(
ctx
.
inVal
(
idx
));
}
...
@@ -188,6 +192,13 @@ template<> struct get_out<cv::GMat>
...
@@ -188,6 +192,13 @@ template<> struct get_out<cv::GMat>
return
{
r
};
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
>
template
<>
struct
get_out
<
cv
::
GScalar
>
{
{
static
scalar_wrapper
get
(
GCPUContext
&
ctx
,
int
idx
)
static
scalar_wrapper
get
(
GCPUContext
&
ctx
,
int
idx
)
...
...
modules/gapi/include/opencv2/gapi/gcall.hpp
View file @
076ee65c
...
@@ -38,6 +38,7 @@ public:
...
@@ -38,6 +38,7 @@ public:
// A generic yield method - obtain a link to operator's particular GMat output
// A generic yield method - obtain a link to operator's particular GMat output
GMat
yield
(
int
output
=
0
);
GMat
yield
(
int
output
=
0
);
GMatP
yieldP
(
int
output
=
0
);
GScalar
yieldScalar
(
int
output
=
0
);
GScalar
yieldScalar
(
int
output
=
0
);
template
<
class
T
>
GArray
<
T
>
yieldArray
(
int
output
=
0
)
template
<
class
T
>
GArray
<
T
>
yieldArray
(
int
output
=
0
)
...
...
modules/gapi/include/opencv2/gapi/gkernel.hpp
View file @
076ee65c
...
@@ -63,6 +63,10 @@ namespace detail
...
@@ -63,6 +63,10 @@ namespace detail
{
{
static
inline
cv
::
GMat
yield
(
cv
::
GCall
&
call
,
int
i
)
{
return
call
.
yield
(
i
);
}
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
>
template
<>
struct
Yield
<
cv
::
GScalar
>
{
{
static
inline
cv
::
GScalar
yield
(
cv
::
GCall
&
call
,
int
i
)
{
return
call
.
yieldScalar
(
i
);
}
static
inline
cv
::
GScalar
yield
(
cv
::
GCall
&
call
,
int
i
)
{
return
call
.
yieldScalar
(
i
);
}
...
@@ -82,6 +86,7 @@ namespace detail
...
@@ -82,6 +86,7 @@ namespace detail
// This mapping is used to transform types to call outMeta() callback.
// This mapping is used to transform types to call outMeta() callback.
template
<
typename
T
>
struct
MetaType
;
template
<
typename
T
>
struct
MetaType
;
template
<>
struct
MetaType
<
cv
::
GMat
>
{
using
type
=
GMatDesc
;
};
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
<>
struct
MetaType
<
cv
::
GScalar
>
{
using
type
=
GScalarDesc
;
};
template
<
typename
U
>
struct
MetaType
<
cv
::
GArray
<
U
>
>
{
using
type
=
GArrayDesc
;
};
template
<
typename
U
>
struct
MetaType
<
cv
::
GArray
<
U
>
>
{
using
type
=
GArrayDesc
;
};
template
<
typename
T
>
struct
MetaType
{
using
type
=
T
;
};
// opaque args passed as-is
template
<
typename
T
>
struct
MetaType
{
using
type
=
T
;
};
// opaque args passed as-is
...
...
modules/gapi/include/opencv2/gapi/gmat.hpp
View file @
076ee65c
...
@@ -46,6 +46,12 @@ private:
...
@@ -46,6 +46,12 @@ private:
std
::
shared_ptr
<
GOrigin
>
m_priv
;
std
::
shared_ptr
<
GOrigin
>
m_priv
;
};
};
class
GAPI_EXPORTS
GMatP
:
public
GMat
{
public
:
using
GMat
::
GMat
;
};
namespace
gapi
{
namespace
own
{
namespace
gapi
{
namespace
own
{
class
Mat
;
class
Mat
;
}}
//gapi::own
}}
//gapi::own
...
...
modules/gapi/include/opencv2/gapi/gproto.hpp
View file @
076ee65c
...
@@ -34,6 +34,7 @@ namespace cv {
...
@@ -34,6 +34,7 @@ namespace cv {
// directly.
// directly.
using
GProtoArg
=
util
::
variant
using
GProtoArg
=
util
::
variant
<
GMat
<
GMat
,
GMatP
,
GScalar
,
GScalar
,
detail
::
GArrayU
// instead of GArray<T>
,
detail
::
GArrayU
// instead of GArray<T>
>
;
>
;
...
...
modules/gapi/include/opencv2/gapi/gtype_traits.hpp
View file @
076ee65c
...
@@ -29,6 +29,7 @@ namespace detail
...
@@ -29,6 +29,7 @@ namespace detail
OPAQUE
,
// Unknown, generic, opaque-to-GAPI data type - STATIC
OPAQUE
,
// Unknown, generic, opaque-to-GAPI data type - STATIC
GOBJREF
,
// <internal> reference to object
GOBJREF
,
// <internal> reference to object
GMAT
,
// a cv::GMat
GMAT
,
// a cv::GMat
GMATP
,
// a cv::GMatP
GSCALAR
,
// a cv::GScalar
GSCALAR
,
// a cv::GScalar
GARRAY
,
// a cv::GArrayU (note - exactly GArrayU, not GArray<T>!)
GARRAY
,
// a cv::GArrayU (note - exactly GArrayU, not GArray<T>!)
};
};
...
@@ -47,6 +48,11 @@ namespace detail
...
@@ -47,6 +48,11 @@ namespace detail
static
constexpr
const
ArgKind
kind
=
ArgKind
::
GMAT
;
static
constexpr
const
ArgKind
kind
=
ArgKind
::
GMAT
;
static
constexpr
const
GShape
shape
=
GShape
::
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
>
template
<>
struct
GTypeTraits
<
cv
::
GScalar
>
{
{
static
constexpr
const
ArgKind
kind
=
ArgKind
::
GSCALAR
;
static
constexpr
const
ArgKind
kind
=
ArgKind
::
GSCALAR
;
...
@@ -76,6 +82,10 @@ namespace detail
...
@@ -76,6 +82,10 @@ namespace detail
// Resolve a Host type back to its associated G-Type.
// Resolve a Host type back to its associated G-Type.
// FIXME: Probably it can be avoided
// 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
;
template
<
typename
T
>
struct
GTypeOf
;
#if !defined(GAPI_STANDALONE)
#if !defined(GAPI_STANDALONE)
template
<>
struct
GTypeOf
<
cv
::
Mat
>
{
using
type
=
cv
::
GMat
;
};
template
<>
struct
GTypeOf
<
cv
::
Mat
>
{
using
type
=
cv
::
GMat
;
};
...
...
modules/gapi/src/api/gcall.cpp
View file @
076ee65c
...
@@ -49,6 +49,11 @@ cv::GMat cv::GCall::yield(int output)
...
@@ -49,6 +49,11 @@ cv::GMat cv::GCall::yield(int output)
return
cv
::
GMat
(
m_priv
->
m_node
,
output
);
return
cv
::
GMat
(
m_priv
->
m_node
,
output
);
}
}
cv
::
GMatP
cv
::
GCall
::
yieldP
(
int
output
)
{
return
cv
::
GMatP
(
m_priv
->
m_node
,
output
);
}
cv
::
GScalar
cv
::
GCall
::
yieldScalar
(
int
output
)
cv
::
GScalar
cv
::
GCall
::
yieldScalar
(
int
output
)
{
{
return
cv
::
GScalar
(
m_priv
->
m_node
,
output
);
return
cv
::
GScalar
(
m_priv
->
m_node
,
output
);
...
...
modules/gapi/src/api/gproto.cpp
View file @
076ee65c
...
@@ -25,6 +25,9 @@ const cv::GOrigin& cv::gimpl::proto::origin_of(const cv::GProtoArg &arg)
...
@@ -25,6 +25,9 @@ const cv::GOrigin& cv::gimpl::proto::origin_of(const cv::GProtoArg &arg)
case
cv
:
:
GProtoArg
::
index_of
<
cv
::
GMat
>
()
:
case
cv
:
:
GProtoArg
::
index_of
<
cv
::
GMat
>
()
:
return
util
::
get
<
cv
::
GMat
>
(
arg
).
priv
();
return
util
::
get
<
cv
::
GMat
>
(
arg
).
priv
();
case
cv
:
:
GProtoArg
::
index_of
<
cv
::
GMatP
>
()
:
return
util
::
get
<
cv
::
GMatP
>
(
arg
).
priv
();
case
cv
:
:
GProtoArg
::
index_of
<
cv
::
GScalar
>
()
:
case
cv
:
:
GProtoArg
::
index_of
<
cv
::
GScalar
>
()
:
return
util
::
get
<
cv
::
GScalar
>
(
arg
).
priv
();
return
util
::
get
<
cv
::
GScalar
>
(
arg
).
priv
();
...
@@ -53,6 +56,7 @@ bool cv::gimpl::proto::is_dynamic(const cv::GArg& arg)
...
@@ -53,6 +56,7 @@ bool cv::gimpl::proto::is_dynamic(const cv::GArg& arg)
switch
(
arg
.
kind
)
switch
(
arg
.
kind
)
{
{
case
detail
:
:
ArgKind
::
GMAT
:
case
detail
:
:
ArgKind
::
GMAT
:
case
detail
:
:
ArgKind
::
GMATP
:
case
detail
:
:
ArgKind
::
GSCALAR
:
case
detail
:
:
ArgKind
::
GSCALAR
:
case
detail
:
:
ArgKind
::
GARRAY
:
case
detail
:
:
ArgKind
::
GARRAY
:
return
true
;
return
true
;
...
@@ -78,6 +82,7 @@ cv::GProtoArg cv::gimpl::proto::rewrap(const cv::GArg &arg)
...
@@ -78,6 +82,7 @@ cv::GProtoArg cv::gimpl::proto::rewrap(const cv::GArg &arg)
switch
(
arg
.
kind
)
switch
(
arg
.
kind
)
{
{
case
detail
:
:
ArgKind
::
GMAT
:
return
GProtoArg
(
arg
.
get
<
cv
::
GMat
>
());
case
detail
:
:
ArgKind
::
GMAT
:
return
GProtoArg
(
arg
.
get
<
cv
::
GMat
>
());
case
detail
:
:
ArgKind
::
GMATP
:
return
GProtoArg
(
arg
.
get
<
cv
::
GMatP
>
());
case
detail
:
:
ArgKind
::
GSCALAR
:
return
GProtoArg
(
arg
.
get
<
cv
::
GScalar
>
());
case
detail
:
:
ArgKind
::
GSCALAR
:
return
GProtoArg
(
arg
.
get
<
cv
::
GScalar
>
());
case
detail
:
:
ArgKind
::
GARRAY
:
return
GProtoArg
(
arg
.
get
<
cv
::
detail
::
GArrayU
>
());
case
detail
:
:
ArgKind
::
GARRAY
:
return
GProtoArg
(
arg
.
get
<
cv
::
detail
::
GArrayU
>
());
default
:
util
::
throw_error
(
std
::
logic_error
(
"Unsupported GArg type"
));
default
:
util
::
throw_error
(
std
::
logic_error
(
"Unsupported GArg type"
));
...
...
modules/gapi/src/compiler/gcompiler.cpp
View file @
076ee65c
...
@@ -156,6 +156,7 @@ void cv::gimpl::GCompiler::validateInputMeta()
...
@@ -156,6 +156,7 @@ void cv::gimpl::GCompiler::validateInputMeta()
{
{
// FIXME: Auto-generate methods like this from traits:
// FIXME: Auto-generate methods like this from traits:
case
GProtoArg
:
:
index_of
<
cv
::
GMat
>
()
:
case
GProtoArg
:
:
index_of
<
cv
::
GMat
>
()
:
case
GProtoArg
:
:
index_of
<
cv
::
GMatP
>
()
:
return
util
::
holds_alternative
<
cv
::
GMatDesc
>
(
meta
);
return
util
::
holds_alternative
<
cv
::
GMatDesc
>
(
meta
);
case
GProtoArg
:
:
index_of
<
cv
::
GScalar
>
()
:
case
GProtoArg
:
:
index_of
<
cv
::
GScalar
>
()
:
...
...
modules/gapi/test/gapi_planar_test.cpp
View file @
076ee65c
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
namespace
opencv_test
namespace
opencv_test
{
{
G_TYPED_KERNEL
(
GResize3c3p
,
<
GMat
(
GMat
,
Size
,
int
)
>
,
"test.resize3c3p"
)
{
G_TYPED_KERNEL
(
GResize3c3p
,
<
GMat
P
(
GMat
,
Size
,
int
)
>
,
"test.resize3c3p"
)
{
static
GMatDesc
outMeta
(
GMatDesc
in
,
Size
sz
,
int
)
{
static
GMatDesc
outMeta
(
GMatDesc
in
,
Size
sz
,
int
)
{
GAPI_Assert
(
in
.
depth
==
CV_8U
);
GAPI_Assert
(
in
.
depth
==
CV_8U
);
GAPI_Assert
(
in
.
chan
==
3
);
GAPI_Assert
(
in
.
chan
==
3
);
...
@@ -20,7 +20,7 @@ G_TYPED_KERNEL(GResize3c3p, <GMat(GMat,Size,int)>, "test.resize3c3p") {
...
@@ -20,7 +20,7 @@ G_TYPED_KERNEL(GResize3c3p, <GMat(GMat,Size,int)>, "test.resize3c3p") {
}
}
};
};
G_TYPED_KERNEL
(
GResize3p3p
,
<
GMat
(
GMat
,
Size
,
int
)
>
,
"test.resize3p3p"
)
{
G_TYPED_KERNEL
(
GResize3p3p
,
<
GMat
P
(
GMatP
,
Size
,
int
)
>
,
"test.resize3p3p"
)
{
static
GMatDesc
outMeta
(
GMatDesc
in
,
Size
sz
,
int
)
{
static
GMatDesc
outMeta
(
GMatDesc
in
,
Size
sz
,
int
)
{
GAPI_Assert
(
in
.
depth
==
CV_8U
);
GAPI_Assert
(
in
.
depth
==
CV_8U
);
GAPI_Assert
(
in
.
chan
==
3
);
GAPI_Assert
(
in
.
chan
==
3
);
...
@@ -42,13 +42,7 @@ static GMatDesc NV12toRGBoutMeta(GMatDesc inY, GMatDesc inUV)
...
@@ -42,13 +42,7 @@ static GMatDesc NV12toRGBoutMeta(GMatDesc inY, GMatDesc inUV)
return
inY
.
withType
(
CV_8U
,
3
);
return
inY
.
withType
(
CV_8U
,
3
);
}
}
G_TYPED_KERNEL
(
GNV12toRGB
,
<
GMat
(
GMat
,
GMat
)
>
,
"test.nv12torgb"
)
{
G_TYPED_KERNEL
(
GNV12toRGBp
,
<
GMatP
(
GMat
,
GMat
)
>
,
"test.nv12torgbp"
)
{
static
GMatDesc
outMeta
(
GMatDesc
inY
,
GMatDesc
inUV
)
{
return
NV12toRGBoutMeta
(
inY
,
inUV
);
}
};
G_TYPED_KERNEL
(
GNV12toRGBp
,
<
GMat
(
GMat
,
GMat
)
>
,
"test.nv12torgbp"
)
{
static
GMatDesc
outMeta
(
GMatDesc
inY
,
GMatDesc
inUV
)
{
static
GMatDesc
outMeta
(
GMatDesc
inY
,
GMatDesc
inUV
)
{
return
NV12toRGBoutMeta
(
inY
,
inUV
).
asPlanar
();
return
NV12toRGBoutMeta
(
inY
,
inUV
).
asPlanar
();
}
}
...
@@ -152,7 +146,7 @@ TEST_P(PlanarTest, Resize3p3p)
...
@@ -152,7 +146,7 @@ TEST_P(PlanarTest, Resize3p3p)
cv
::
Mat
out_mat
=
cv
::
Mat
::
zeros
(
out_sz
.
height
*
3
,
out_sz
.
width
,
CV_8UC1
);
cv
::
Mat
out_mat
=
cv
::
Mat
::
zeros
(
out_sz
.
height
*
3
,
out_sz
.
width
,
CV_8UC1
);
cv
::
Mat
out_mat_ocv
=
cv
::
Mat
::
zeros
(
out_sz
.
height
*
3
,
out_sz
.
width
,
CV_8UC1
);
cv
::
Mat
out_mat_ocv
=
cv
::
Mat
::
zeros
(
out_sz
.
height
*
3
,
out_sz
.
width
,
CV_8UC1
);
cv
::
GMat
in
;
cv
::
GMat
P
in
;
auto
out
=
GResize3p3p
::
on
(
in
,
out_sz
,
interp
);
auto
out
=
GResize3p3p
::
on
(
in
,
out_sz
,
interp
);
cv
::
GComputation
c
(
cv
::
GIn
(
in
),
cv
::
GOut
(
out
));
cv
::
GComputation
c
(
cv
::
GIn
(
in
),
cv
::
GOut
(
out
));
...
...
modules/gapi/test/internal/gapi_int_garg_test.cpp
View file @
076ee65c
...
@@ -31,6 +31,7 @@ using GArg_Test_Types = ::testing::Types
...
@@ -31,6 +31,7 @@ using GArg_Test_Types = ::testing::Types
<
<
// G-API types
// G-API types
Expected
<
cv
::
GMat
,
cv
::
detail
::
ArgKind
::
GMAT
>
Expected
<
cv
::
GMat
,
cv
::
detail
::
ArgKind
::
GMAT
>
,
Expected
<
cv
::
GMatP
,
cv
::
detail
::
ArgKind
::
GMATP
>
,
Expected
<
cv
::
GScalar
,
cv
::
detail
::
ArgKind
::
GSCALAR
>
,
Expected
<
cv
::
GScalar
,
cv
::
detail
::
ArgKind
::
GSCALAR
>
,
Expected
<
cv
::
GArray
<
int
>
,
cv
::
detail
::
ArgKind
::
GARRAY
>
,
Expected
<
cv
::
GArray
<
int
>
,
cv
::
detail
::
ArgKind
::
GARRAY
>
,
Expected
<
cv
::
GArray
<
float
>
,
cv
::
detail
::
ArgKind
::
GARRAY
>
,
Expected
<
cv
::
GArray
<
float
>
,
cv
::
detail
::
ArgKind
::
GARRAY
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment