G-API Expose all imgproc operations to python #22735
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)Problems
Some of
imgproc
operations are still not exposed because of complexity of wrapping their return types to python.GArray<GArray<Point>> findContours(...)
- 2 overloadsstd::tuple<GArray<GArray<Point>>,GArray<Vec4i>> findContoursH(...)
- 2 overloadsGOpaque<Vec4f> fitLine2D(...)
- 4 overloadsGOpaque<Vec6f> fitLine3D(...)
- 4 overloadsGMatP NV12toRGBp(...)
GMatP NV12toBGRp(...)
GMatP resizeP(...)
Issue: #22736