Python typing stub generation #20370
Add stub generation to `gen2.py`, addressing #14590.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
- [x] The PR is proposed to proper branch
- [x] There is reference to 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
* feat: OpenCV extension with pure Python modules
* feat: cv2 is now a Python package instead of extension module
Python package cv2 now can handle both Python and C extension modules
properly without additional "subfolders" like "_extra_py_code".
* feat: can call native function from its reimplementation in Python
G-API: New python operations API
* Reimplement test using decorators
* Custom python operation API
* Remove wip status
* python: support Python code in bindings (through loader only)
* cleanup, skip tests for Python 2.x (not supported)
* python 2.x can't skip unittest modules
* Clean up
* Clean up
* Fix segfault python3.9
Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Currently, the LOADER_DIR is set as os.path.dirname(os.path.abspath(__file__)). This does not point to the true library path if the cv2 folder is symlinked into the Python package directory such that importing cv2 under Python fails. The proposed change only resolves symbolic links correctly by calling os.path.realpath(__file__) first and does not change anything if __file__ contains no symbolic link.
changed OpenCV license from BSD to Apache 2 license
* as discussed and announced earlier, changed OpenCV license from BSD to Apache 2. Many files still contain old-style copyrights though
* changed wording a bit; preserve the original OpenCV BSD license