mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #19804 from TolyaTalamanov:at/python-custom-op
[G-API] Introduce custom python operator API * Introduce custom python operator API * Add wip namespace
This commit is contained in:
committed by
GitHub
parent
5ffe32439d
commit
3f14cb073b
@@ -35,14 +35,14 @@ template<typename T> class GArray;
|
||||
* \addtogroup gapi_meta_args
|
||||
* @{
|
||||
*/
|
||||
struct GArrayDesc
|
||||
struct GAPI_EXPORTS_W_SIMPLE GArrayDesc
|
||||
{
|
||||
// FIXME: Body
|
||||
// FIXME: Also implement proper operator== then
|
||||
bool operator== (const GArrayDesc&) const { return true; }
|
||||
};
|
||||
template<typename U> GArrayDesc descr_of(const std::vector<U> &) { return {};}
|
||||
static inline GArrayDesc empty_array_desc() {return {}; }
|
||||
GAPI_EXPORTS_W inline GArrayDesc empty_array_desc() {return {}; }
|
||||
/** @} */
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const cv::GArrayDesc &desc);
|
||||
|
||||
@@ -73,25 +73,25 @@ class RMat;
|
||||
* \addtogroup gapi_meta_args
|
||||
* @{
|
||||
*/
|
||||
struct GAPI_EXPORTS GMatDesc
|
||||
struct GAPI_EXPORTS_W_SIMPLE GMatDesc
|
||||
{
|
||||
// FIXME: Default initializers in C++14
|
||||
int depth;
|
||||
int chan;
|
||||
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
|
||||
GAPI_PROP int depth;
|
||||
GAPI_PROP int chan;
|
||||
GAPI_PROP cv::Size size; // NB.: no multi-dimensional cases covered yet
|
||||
GAPI_PROP bool planar;
|
||||
GAPI_PROP std::vector<int> dims; // FIXME: Maybe it's real questionable to have it here
|
||||
|
||||
GMatDesc(int d, int c, cv::Size s, bool p = false)
|
||||
GAPI_WRAP 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)
|
||||
GAPI_WRAP GMatDesc(int d, const std::vector<int> &dd)
|
||||
: depth(d), chan(-1), size{-1,-1}, planar(false), dims(dd) {}
|
||||
|
||||
GMatDesc(int d, std::vector<int> &&dd)
|
||||
GAPI_WRAP GMatDesc(int d, std::vector<int> &&dd)
|
||||
: depth(d), chan(-1), size{-1,-1}, planar(false), dims(std::move(dd)) {}
|
||||
|
||||
GMatDesc() : GMatDesc(-1, -1, {-1,-1}) {}
|
||||
GAPI_WRAP GMatDesc() : GMatDesc(-1, -1, {-1,-1}) {}
|
||||
|
||||
inline bool operator== (const GMatDesc &rhs) const
|
||||
{
|
||||
@@ -155,7 +155,7 @@ struct GAPI_EXPORTS GMatDesc
|
||||
// Meta combinator: return a new GMatDesc with specified data depth
|
||||
// and number of channels.
|
||||
// (all other fields are taken unchanged from this GMatDesc)
|
||||
GMatDesc withType(int ddepth, int dchan) const
|
||||
GAPI_WRAP GMatDesc withType(int ddepth, int dchan) const
|
||||
{
|
||||
GAPI_Assert(CV_MAT_CN(ddepth) == 1 || ddepth == -1);
|
||||
GMatDesc desc = withDepth(ddepth);
|
||||
|
||||
@@ -33,14 +33,14 @@ template<typename T> class GOpaque;
|
||||
* \addtogroup gapi_meta_args
|
||||
* @{
|
||||
*/
|
||||
struct GOpaqueDesc
|
||||
struct GAPI_EXPORTS_W_SIMPLE GOpaqueDesc
|
||||
{
|
||||
// FIXME: Body
|
||||
// FIXME: Also implement proper operator== then
|
||||
bool operator== (const GOpaqueDesc&) const { return true; }
|
||||
};
|
||||
template<typename U> GOpaqueDesc descr_of(const U &) { return {};}
|
||||
static inline GOpaqueDesc empty_gopaque_desc() {return {}; }
|
||||
GAPI_EXPORTS_W inline GOpaqueDesc empty_gopaque_desc() {return {}; }
|
||||
/** @} */
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const cv::GOpaqueDesc &desc);
|
||||
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
* \addtogroup gapi_meta_args
|
||||
* @{
|
||||
*/
|
||||
struct GScalarDesc
|
||||
struct GAPI_EXPORTS_W_SIMPLE GScalarDesc
|
||||
{
|
||||
// NB.: right now it is empty
|
||||
|
||||
@@ -64,9 +64,9 @@ struct GScalarDesc
|
||||
}
|
||||
};
|
||||
|
||||
static inline GScalarDesc empty_scalar_desc() { return GScalarDesc(); }
|
||||
GAPI_EXPORTS_W inline GScalarDesc empty_scalar_desc() { return GScalarDesc(); }
|
||||
|
||||
GAPI_EXPORTS GScalarDesc descr_of(const cv::Scalar &scalar);
|
||||
GAPI_EXPORTS GScalarDesc descr_of(const cv::Scalar &scalar);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const cv::GScalarDesc &desc);
|
||||
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
# include <opencv2/core/base.hpp>
|
||||
# define GAPI_EXPORTS CV_EXPORTS
|
||||
/* special informative macros for wrapper generators */
|
||||
# define GAPI_PROP CV_PROP
|
||||
# define GAPI_WRAP CV_WRAP
|
||||
# define GAPI_EXPORTS_W_SIMPLE CV_EXPORTS_W_SIMPLE
|
||||
# define GAPI_EXPORTS_W CV_EXPORTS_W
|
||||
# else
|
||||
# define GAPI_PROP
|
||||
# define GAPI_WRAP
|
||||
# define GAPI_EXPORTS
|
||||
# define GAPI_EXPORTS_W_SIMPLE
|
||||
|
||||
Reference in New Issue
Block a user