mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #19322 from TolyaTalamanov:at/python-callbacks
[G-API] Introduce cv.gin/cv.descr_of for python * Implement cv.gin/cv.descr_of * Fix macos build * Fix gcomputation tests * Add test * Add using to a void exceeded length for windows build * Add using to a void exceeded length for windows build * Fix comments to review * Fix comments to review * Update from latest master * Avoid graph compilation to obtain in/out info * Fix indentation * Fix comments to review * Avoid using default in switches * Post output meta for giebackend
This commit is contained in:
committed by
GitHub
parent
7bcb51eded
commit
eb82ba36a3
@@ -1909,14 +1909,14 @@ kmeans(const GMat& data, const int K, const GMat& bestLabels,
|
||||
- Function textual ID is "org.opencv.core.kmeansNDNoInit"
|
||||
- #KMEANS_USE_INITIAL_LABELS flag must not be set while using this overload.
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GOpaque<double>,GMat,GMat>
|
||||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GMat,GMat>
|
||||
kmeans(const GMat& data, const int K, const TermCriteria& criteria, const int attempts,
|
||||
const KmeansFlags flags);
|
||||
|
||||
/** @overload
|
||||
@note Function textual ID is "org.opencv.core.kmeans2D"
|
||||
*/
|
||||
GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point2f>>
|
||||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point2f>>
|
||||
kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels,
|
||||
const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
|
||||
|
||||
@@ -1935,7 +1935,7 @@ namespace streaming {
|
||||
@param src Input tensor
|
||||
@return Size (tensor dimensions).
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Size> size(const GMat& src);
|
||||
GAPI_EXPORTS_W GOpaque<Size> size(const GMat& src);
|
||||
|
||||
/** @overload
|
||||
Gets dimensions from rectangle.
|
||||
|
||||
@@ -249,6 +249,30 @@ template<typename... Ts> inline GRunArgsP gout(Ts&... args)
|
||||
return GRunArgsP{ GRunArgP(detail::wrap_host_helper<Ts>::wrap_out(args))... };
|
||||
}
|
||||
|
||||
struct GTypeInfo;
|
||||
using GTypesInfo = std::vector<GTypeInfo>;
|
||||
|
||||
// FIXME: Needed for python bridge, must be moved to more appropriate header
|
||||
namespace detail {
|
||||
struct ExtractArgsCallback
|
||||
{
|
||||
cv::GRunArgs operator()(const cv::GTypesInfo& info) const { return c(info); }
|
||||
using CallBackT = std::function<cv::GRunArgs(const cv::GTypesInfo& info)>;
|
||||
CallBackT c;
|
||||
};
|
||||
|
||||
struct ExtractMetaCallback
|
||||
{
|
||||
cv::GMetaArgs operator()(const cv::GTypesInfo& info) const { return c(info); }
|
||||
using CallBackT = std::function<cv::GMetaArgs(const cv::GTypesInfo& info)>;
|
||||
CallBackT c;
|
||||
};
|
||||
|
||||
void constructGraphOutputs(const cv::GTypesInfo &out_info,
|
||||
cv::GRunArgs &args,
|
||||
cv::GRunArgsP &outs);
|
||||
} // namespace detail
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_GARG_HPP
|
||||
|
||||
@@ -368,8 +368,6 @@ private:
|
||||
detail::GArrayU m_ref;
|
||||
};
|
||||
|
||||
using GArrayP2f = GArray<cv::Point2f>;
|
||||
|
||||
/** @} */
|
||||
|
||||
} // namespace cv
|
||||
|
||||
@@ -258,7 +258,8 @@ public:
|
||||
void apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {}); // Arg-to-arg overload
|
||||
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
GAPI_WRAP GRunArgs apply(GRunArgs &&ins, GCompileArgs &&args = {});
|
||||
GAPI_WRAP GRunArgs apply(const cv::detail::ExtractArgsCallback &callback,
|
||||
GCompileArgs &&args = {});
|
||||
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
void apply(const std::vector<cv::Mat>& ins, // Compatibility overload
|
||||
@@ -436,7 +437,11 @@ public:
|
||||
*
|
||||
* @sa @ref gapi_compile_args
|
||||
*/
|
||||
GAPI_WRAP GStreamingCompiled compileStreaming(GMetaArgs &&in_metas, GCompileArgs &&args = {});
|
||||
GStreamingCompiled compileStreaming(GMetaArgs &&in_metas, GCompileArgs &&args = {});
|
||||
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
GAPI_WRAP GStreamingCompiled compileStreaming(const cv::detail::ExtractMetaCallback &callback,
|
||||
GCompileArgs &&args = {});
|
||||
|
||||
/**
|
||||
* @brief Compile the computation for streaming mode.
|
||||
|
||||
@@ -30,6 +30,7 @@ struct GTypeInfo
|
||||
{
|
||||
GShape shape;
|
||||
cv::detail::OpaqueKind kind;
|
||||
detail::HostCtor ctor;
|
||||
};
|
||||
|
||||
using GShapes = std::vector<GShape>;
|
||||
|
||||
@@ -135,7 +135,7 @@ GRunArg value_of(const GOrigin &origin);
|
||||
// Transform run-time computation arguments into a collection of metadata
|
||||
// extracted from that arguments
|
||||
GMetaArg GAPI_EXPORTS descr_of(const GRunArg &arg );
|
||||
GMetaArgs GAPI_EXPORTS_W descr_of(const GRunArgs &args);
|
||||
GMetaArgs GAPI_EXPORTS descr_of(const GRunArgs &args);
|
||||
|
||||
// Transform run-time operation result argument into metadata extracted from that argument
|
||||
// Used to compare the metadata, which generated at compile time with the metadata result operation in run time
|
||||
|
||||
@@ -180,7 +180,10 @@ public:
|
||||
* @param ins vector of inputs to process.
|
||||
* @sa gin
|
||||
*/
|
||||
GAPI_WRAP void setSource(GRunArgs &&ins);
|
||||
void setSource(GRunArgs &&ins);
|
||||
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
GAPI_WRAP void setSource(const cv::detail::ExtractArgsCallback& callback);
|
||||
|
||||
/**
|
||||
* @brief Specify an input video stream for a single-input
|
||||
@@ -251,6 +254,7 @@ public:
|
||||
bool pull(cv::GRunArgsP &&outs);
|
||||
|
||||
// NB: Used from python
|
||||
/// @private -- Exclude this function from OpenCV documentation
|
||||
GAPI_WRAP std::tuple<bool, cv::GRunArgs> pull();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1158,7 +1158,7 @@ if there are 2 channels, or have 2 columns if there is a single channel. Mat sho
|
||||
@param src Input gray-scale image @ref CV_8UC1; or input set of @ref CV_32S or @ref CV_32F
|
||||
2D points stored in Mat.
|
||||
*/
|
||||
GAPI_EXPORTS GOpaque<Rect> boundingRect(const GMat& src);
|
||||
GAPI_EXPORTS_W GOpaque<Rect> boundingRect(const GMat& src);
|
||||
|
||||
/** @overload
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ the larger side of the rectangle.
|
||||
@param filterOutOfBounds If provided true, out-of-frame boxes are filtered.
|
||||
@return a vector of detected bounding boxes.
|
||||
*/
|
||||
GAPI_EXPORTS GArray<Rect> parseSSD(const GMat& in,
|
||||
const GOpaque<Size>& inSz,
|
||||
const float confidenceThreshold = 0.5f,
|
||||
const bool alignmentToSquare = false,
|
||||
const bool filterOutOfBounds = false);
|
||||
GAPI_EXPORTS_W GArray<Rect> parseSSD(const GMat& in,
|
||||
const GOpaque<Size>& inSz,
|
||||
const float confidenceThreshold = 0.5f,
|
||||
const bool alignmentToSquare = false,
|
||||
const bool filterOutOfBounds = false);
|
||||
|
||||
/** @brief Parses output of Yolo network.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user