Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

TolyaTalamanov
Copy link
Contributor

@TolyaTalamanov TolyaTalamanov commented Nov 1, 2022

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

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 (via GAPI_TYPED_KERNEL macro or so) and expose it into python, but this functionality is more about giving an opportunity to user to implement python kernels 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 from pip let's expose it once and forever.

Great example of G-API usage: https://github.com/xiong-jie-y/g_api_examples
TODO list:

  • Expose core
  • Expose imgproc
  • Expose video
  • Expose stereo
  • Other stuff (e.g constant initialization for 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 overloads
  • std::tuple<GArray<GArray<Point>>,GArray<Vec4i>> findContoursH(...) - 2 overloads
  • GOpaque<Vec4f> fitLine2D(...) - 4 overloads
  • GOpaque<Vec6f> fitLine3D(...) - 4 overloads
  • GMatP NV12toRGBp(...)
  • GMatP NV12toBGRp(...)
  • GMatP resizeP(...)

Issue: #22736

@TolyaTalamanov TolyaTalamanov force-pushed the at/expose-all-imgproc-to-python branch from bd5e9d5 to c3bcc4d Compare November 8, 2022 12:13
@TolyaTalamanov
Copy link
Contributor Author

@dmatveev Could you have a look, please?

@dmatveev dmatveev self-assigned this Nov 18, 2022
@dmatveev dmatveev added this to the 4.7.0 milestone Nov 18, 2022
Copy link
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alalek alalek merged commit 64aad34 into opencv:4.x Nov 18, 2022
@alalek alalek mentioned this pull request Jan 8, 2023
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
…proc-to-python

G-API Expose all imgproc operations to python

* Expose imgproc operations

* Fix alignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants