Merge pull request #19982 from TolyaTalamanov:at/new-python-operation-api

G-API: New python operations API

* Reimplement test using decorators

* Custom python operation API

* Remove wip status

* python: support Python code in bindings (through loader only)

* cleanup, skip tests for Python 2.x (not supported)

* python 2.x can't skip unittest modules

* Clean up

* Clean up

* Fix segfault python3.9

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
Anatoliy Talamanov
2021-05-20 21:59:53 +03:00
committed by GitHub
parent 0f11b1fc0d
commit c4df8989e9
11 changed files with 1122 additions and 505 deletions
+1 -1
View File
@@ -1490,7 +1490,7 @@ enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv:
@sa warpAffine, warpPerspective, remap, resizeP
*/
GAPI_EXPORTS GMat resize(const GMat& src, const Size& dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR);
GAPI_EXPORTS_W GMat resize(const GMat& src, const Size& dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR);
/** @brief Resizes a planar image.
+7 -7
View File
@@ -120,7 +120,7 @@ struct GAPI_EXPORTS_W_SIMPLE 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::Size delta) const
GAPI_WRAP GMatDesc withSizeDelta(cv::Size delta) const
{
GMatDesc desc(*this);
desc.size += delta;
@@ -130,12 +130,12 @@ struct GAPI_EXPORTS_W_SIMPLE GMatDesc
// (all other fields are taken unchanged from this GMatDesc)
//
// This is an overload.
GMatDesc withSizeDelta(int dx, int dy) const
GAPI_WRAP GMatDesc withSizeDelta(int dx, int dy) const
{
return withSizeDelta(cv::Size{dx,dy});
}
GMatDesc withSize(cv::Size sz) const
GAPI_WRAP GMatDesc withSize(cv::Size sz) const
{
GMatDesc desc(*this);
desc.size = sz;
@@ -144,7 +144,7 @@ struct GAPI_EXPORTS_W_SIMPLE GMatDesc
// Meta combinator: return a new GMatDesc with specified data depth.
// (all other fields are taken unchanged from this GMatDesc)
GMatDesc withDepth(int ddepth) const
GAPI_WRAP GMatDesc withDepth(int ddepth) const
{
GAPI_Assert(CV_MAT_CN(ddepth) == 1 || ddepth == -1);
GMatDesc desc(*this);
@@ -166,7 +166,7 @@ struct GAPI_EXPORTS_W_SIMPLE GMatDesc
// Meta combinator: return a new GMatDesc with planar flag set
// (no size changes are performed, only channel interpretation is changed
// (interleaved -> planar)
GMatDesc asPlanar() const
GAPI_WRAP GMatDesc asPlanar() const
{
GAPI_Assert(planar == false);
GMatDesc desc(*this);
@@ -177,7 +177,7 @@ struct GAPI_EXPORTS_W_SIMPLE GMatDesc
// Meta combinator: return a new GMatDesc
// reinterpreting 1-channel input as planar image
// (size height is divided by plane number)
GMatDesc asPlanar(int planes) const
GAPI_WRAP GMatDesc asPlanar(int planes) const
{
GAPI_Assert(planar == false);
GAPI_Assert(chan == 1);
@@ -192,7 +192,7 @@ struct GAPI_EXPORTS_W_SIMPLE GMatDesc
// Meta combinator: return a new GMatDesc with planar flag set to false
// (no size changes are performed, only channel interpretation is changed
// (planar -> interleaved)
GMatDesc asInterleaved() const
GAPI_WRAP GMatDesc asInterleaved() const
{
GAPI_Assert(planar == true);
GMatDesc desc(*this);
@@ -1341,7 +1341,7 @@ Output image is 8-bit unsigned 3-channel image @ref CV_8UC3.
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3.
@sa RGB2BGR
*/
GAPI_EXPORTS GMat BGR2RGB(const GMat& src);
GAPI_EXPORTS_W GMat BGR2RGB(const GMat& src);
/** @brief Converts an image from RGB color space to gray-scaled.