mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #17493 from TolyaTalamanov:at/python-bindings-gapi
* Implement G-API python bindings * Fix hdr_parser * Drop initlization with brackets using regexp * Handle bracket initilization another way * Add test for core operations * Declaration and definition of View constructor now in different files * Refactor tests * Remove combine decorator from tests * Fix comment to review * Fix test * Fix comments to review * Remove GCompilerArgs implementation from python Co-authored-by: Pinaev <danil.pinaev@intel.com>
This commit is contained in:
committed by
GitHub
parent
afe9993376
commit
c708f506a4
@@ -528,7 +528,7 @@ Supported matrix data types are @ref CV_8UC1, @ref CV_8UC3, @ref CV_16UC1, @ref
|
||||
@param ddepth optional depth of the output matrix.
|
||||
@sa sub, addWeighted
|
||||
*/
|
||||
GAPI_EXPORTS GMat add(const GMat& src1, const GMat& src2, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat add(const GMat& src1, const GMat& src2, int ddepth = -1);
|
||||
|
||||
/** @brief Calculates the per-element sum of matrix and given scalar.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace gapi {
|
||||
namespace core {
|
||||
namespace cpu {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
|
||||
|
||||
} // namespace cpu
|
||||
} // namespace core
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace cv { namespace gapi { namespace core { namespace fluid {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
|
||||
|
||||
}}}}
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
View() = default;
|
||||
|
||||
const inline uint8_t* InLineB(int index) const // -(w-1)/2...0...+(w-1)/2 for Filters
|
||||
{
|
||||
return m_cache->linePtr(index);
|
||||
@@ -80,6 +78,7 @@ public:
|
||||
Priv& priv(); // internal use only
|
||||
const Priv& priv() const; // internal use only
|
||||
|
||||
View();
|
||||
View(std::unique_ptr<Priv>&& p);
|
||||
View(View&& v);
|
||||
View& operator=(View&& v);
|
||||
|
||||
@@ -93,9 +93,12 @@ namespace detail {
|
||||
* passed in (a variadic template parameter pack) into a vector of
|
||||
* cv::GCompileArg objects.
|
||||
*/
|
||||
struct GAPI_EXPORTS GCompileArg
|
||||
struct GAPI_EXPORTS_W_SIMPLE GCompileArg
|
||||
{
|
||||
public:
|
||||
// NB: Required for pythnon bindings
|
||||
GCompileArg() = default;
|
||||
|
||||
std::string tag;
|
||||
|
||||
// FIXME: use decay in GArg/other trait-based wrapper before leg is shot!
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace I {
|
||||
*
|
||||
* @sa GCompiled
|
||||
*/
|
||||
class GAPI_EXPORTS GComputation
|
||||
class GAPI_EXPORTS_W GComputation
|
||||
{
|
||||
public:
|
||||
class Priv;
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
* @param in2 second input GMat of the defined binary computation
|
||||
* @param out output GMat of the defined binary computation
|
||||
*/
|
||||
GComputation(GMat in1, GMat in2, GMat out); // Binary overload
|
||||
GAPI_WRAP GComputation(GMat in1, GMat in2, GMat out); // Binary overload
|
||||
|
||||
/**
|
||||
* @brief Defines a binary (two inputs -- one output) computation
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
* @param args compilation arguments for underlying compilation
|
||||
* process.
|
||||
*/
|
||||
void apply(cv::Mat in, cv::Mat &out, GCompileArgs &&args = {}); // Unary overload
|
||||
void apply(cv::Mat in, cv::Mat &out, GCompileArgs &&args = {}); // Unary overload
|
||||
|
||||
/**
|
||||
* @brief Execute an unary computation (with compilation on the fly)
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
* @param args compilation arguments for underlying compilation
|
||||
* process.
|
||||
*/
|
||||
void apply(cv::Mat in, cv::Scalar &out, GCompileArgs &&args = {}); // Unary overload (scalar)
|
||||
void apply(cv::Mat in, cv::Scalar &out, GCompileArgs &&args = {}); // Unary overload (scalar)
|
||||
|
||||
/**
|
||||
* @brief Execute a binary computation (with compilation on the fly)
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
* @param args compilation arguments for underlying compilation
|
||||
* process.
|
||||
*/
|
||||
void apply(cv::Mat in1, cv::Mat in2, cv::Mat &out, GCompileArgs &&args = {}); // Binary overload
|
||||
GAPI_WRAP void apply(cv::Mat in1, cv::Mat in2, CV_OUT cv::Mat &out, GCompileArgs &&args = {}); // Binary overload
|
||||
|
||||
/**
|
||||
* @brief Execute an binary computation (with compilation on the fly)
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace gapi {
|
||||
* Finally, two kernel packages can be combined into a new one
|
||||
* with function cv::gapi::combine().
|
||||
*/
|
||||
class GAPI_EXPORTS GKernelPackage
|
||||
class GAPI_EXPORTS_W_SIMPLE GKernelPackage
|
||||
{
|
||||
|
||||
/// @private
|
||||
@@ -712,6 +712,7 @@ namespace detail
|
||||
static const char* tag() { return "gapi.use_only"; }
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_GKERNEL_HPP
|
||||
|
||||
@@ -46,10 +46,10 @@ struct GOrigin;
|
||||
* `cv::GArray<T>` | std::vector<T>
|
||||
* `cv::GOpaque<T>` | T
|
||||
*/
|
||||
class GAPI_EXPORTS GMat
|
||||
class GAPI_EXPORTS_W_SIMPLE GMat
|
||||
{
|
||||
public:
|
||||
GMat(); // Empty constructor
|
||||
GAPI_WRAP GMat(); // Empty constructor
|
||||
GMat(const GNode &n, std::size_t out); // Operation result constructor
|
||||
|
||||
GOrigin& priv(); // Internal use only
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace gapi {
|
||||
namespace core {
|
||||
namespace ocl {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
|
||||
|
||||
} // namespace ocl
|
||||
} // namespace core
|
||||
|
||||
@@ -11,8 +11,15 @@
|
||||
# if defined(__OPENCV_BUILD)
|
||||
# include <opencv2/core/base.hpp>
|
||||
# define GAPI_EXPORTS CV_EXPORTS
|
||||
/* special informative macros for wrapper generators */
|
||||
# define GAPI_WRAP CV_WRAP
|
||||
# define GAPI_EXPORTS_W_SIMPLE CV_EXPORTS_W_SIMPLE
|
||||
# define GAPI_EXPORTS_W CV_EXPORTS_W
|
||||
# else
|
||||
# define GAPI_WRAP
|
||||
# define GAPI_EXPORTS
|
||||
# define GAPI_EXPORTS_W_SIMPLE
|
||||
# define GAPI_EXPORTS_W
|
||||
|
||||
#if 0 // Note: the following version currently is not needed for non-OpenCV build
|
||||
# if defined _WIN32
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace cv { namespace gapi { namespace core { namespace plaidml {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
|
||||
|
||||
}}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user