CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
G-API Expose all core operations to python #22494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
G-API Expose all core operations to python #22494
Conversation
@@ -654,8 +654,8 @@ center. | |||
@param borderValue border value in case of constant border type | |||
@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur | |||
*/ | |||
GAPI_EXPORTS GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1), | |||
int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0)); | |||
GAPI_EXPORTS_W GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exception from core
operations, just want it to be exposed asap :)
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels, | |||
/** @overload | |||
@note Function textual ID is "org.opencv.core.kmeans3D" | |||
*/ | |||
GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>> | |||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense to add test for this one because it touches a lot of existing functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kmeans or what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, add test for kmeans
because it returns Point3f
which wasn't supported before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@dmatveev Could you have a look, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do something with all that our type enumerations in all these different headers... Worth a TODO
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels, | |||
/** @overload | |||
@note Function textual ID is "org.opencv.core.kmeans3D" | |||
*/ | |||
GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>> | |||
GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kmeans or what?
@@ -51,6 +51,7 @@ namespace detail | |||
CV_STRING, // std::string user G-API data | |||
CV_POINT, // cv::Point user G-API data | |||
CV_POINT2F, // cv::Point2f user G-API data | |||
CV_POINT3F, // cv::Point3f user G-API data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the below type? See GOpaqueTraits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't exposed it for purpose, because there weren't such cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is an inconsistency now, isnt it?
And now its only you who knows the reason for it (ok, and me)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@TolyaTalamanov Friendly reminder. |
e567339
to
2b601de
Compare
2b601de
to
f8eca04
Compare
@@ -51,6 +51,7 @@ namespace detail | |||
CV_STRING, // std::string user G-API data | |||
CV_POINT, // cv::Point user G-API data | |||
CV_POINT2F, // cv::Point2f user G-API data | |||
CV_POINT3F, // cv::Point3f user G-API data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -194,6 +194,33 @@ def test_kmeans_2d(self): | |||
self.assertEqual(K, len(centers)) | |||
|
|||
|
|||
def test_kmeans_3d(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually tests only functionality without accuracy checking with ocv
@dmatveev Could you have a look, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@asmorkalov Can it be merged? |
@alalek @asmorkalov Could you merge it, please? |
…e-to-python G-API Expose all core operations to python * Expose all G-API core operations to python * Fix typo in python gapi types test
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Motivation
Python bindings are available since a long time, but only a few operations (
operation::on(...)
wrappers) were exposed.There was a great plan to implement feature in python parser that could automatically detect
G-API
operation (viaGAPI_TYPED_KERNEL
macro or so) and expose it into python, but this functionality is more about giving an opportunity to user to implement pythonkernels
for already existing in G-API operations.This PR is going to expose just
operation::on
wrappers to python in order to give user everything that is available from c++, because now, for developers who don't build from source and change the code only available a small amount of functionality.Since a lot of developers use
opencv
frompip
let's expose it once and forever.Great example of G-API usage: https://github.com/xiong-jie-y/g_api_examples
TODO list:
core
imgproc
video
stereo
G-Type
's & some compiler args)