mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Implement python backend
This commit is contained in:
@@ -645,7 +645,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 addC(const GMat& src1, const GScalar& c, int ddepth = -1);
|
||||
GAPI_EXPORTS_W GMat addC(const GMat& src1, const GScalar& c, int ddepth = -1);
|
||||
//! @overload
|
||||
GAPI_EXPORTS GMat addC(const GScalar& c, const GMat& src1, int ddepth = -1);
|
||||
|
||||
@@ -1945,7 +1945,7 @@ Gets dimensions from rectangle.
|
||||
@param r Input rectangle.
|
||||
@return Size (rectangle dimensions).
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Size> size(const GOpaque<Rect>& r);
|
||||
GAPI_EXPORTS_W GOpaque<Size> size(const GOpaque<Rect>& r);
|
||||
|
||||
/** @brief Gets dimensions from MediaFrame.
|
||||
|
||||
|
||||
@@ -1168,7 +1168,7 @@ Calculates the up-right bounding rectangle of a point set.
|
||||
|
||||
@param src Input 2D point set, stored in std::vector<cv::Point2i>.
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Rect> boundingRect(const GArray<Point2i>& src);
|
||||
GAPI_EXPORTS_W GOpaque<Rect> boundingRect(const GArray<Point2i>& src);
|
||||
|
||||
/** @overload
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2021 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_PYTHON_API_HPP
|
||||
#define OPENCV_GAPI_PYTHON_API_HPP
|
||||
|
||||
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
||||
#include <opencv2/gapi/own/exports.hpp> // GAPI_EXPORTS
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
namespace python {
|
||||
|
||||
GAPI_EXPORTS cv::gapi::GBackend backend();
|
||||
|
||||
struct GPythonContext
|
||||
{
|
||||
const cv::GArgs &ins;
|
||||
const cv::GMetaArgs &in_metas;
|
||||
const cv::GTypesInfo &out_info;
|
||||
};
|
||||
|
||||
using Impl = std::function<cv::GRunArgs(const GPythonContext&)>;
|
||||
|
||||
class GAPI_EXPORTS GPythonKernel
|
||||
{
|
||||
public:
|
||||
GPythonKernel() = default;
|
||||
GPythonKernel(Impl run);
|
||||
|
||||
cv::GRunArgs operator()(const GPythonContext& ctx);
|
||||
private:
|
||||
Impl m_run;
|
||||
};
|
||||
|
||||
class GAPI_EXPORTS GPythonFunctor : public cv::gapi::GFunctor
|
||||
{
|
||||
public:
|
||||
using Meta = cv::GKernel::M;
|
||||
|
||||
GPythonFunctor(const char* id, const Meta &meta, const Impl& impl);
|
||||
|
||||
GKernelImpl impl() const override;
|
||||
gapi::GBackend backend() const override;
|
||||
|
||||
private:
|
||||
GKernelImpl impl_;
|
||||
};
|
||||
|
||||
} // namespace python
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_PYTHON_API_HPP
|
||||
Reference in New Issue
Block a user