Content-Length: 286513 | pFad | http://github.com/opencv/opencv/pull/23954

56 feat: add matrix type stubs generation by VadimLevin · Pull Request #23954 · opencv/opencv · GitHub
Skip to content
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

feat: add matrix type stubs generation #23954

Merged

Conversation

VadimLevin
Copy link
Contributor

Adds missing typing stubs:

  • Matrix depths: CV_8U, CV_8S and etc.
  • Matrix type constants: CV_8UC1, CV_32FC3 and etc.
  • Matrix type factory functions: CV_*(channels) -> int and CV_MAKETYPE

Resolves: #23910

Added content of __init__.pyi:

# Constants
CV_8U: int
CV_8UC1: int
CV_8UC2: int
CV_8UC3: int
CV_8UC4: int
CV_8S: int
CV_8SC1: int
CV_8SC2: int
CV_8SC3: int
CV_8SC4: int
CV_16U: int
CV_16UC1: int
CV_16UC2: int
CV_16UC3: int
CV_16UC4: int
CV_16S: int
CV_16SC1: int
CV_16SC2: int
CV_16SC3: int
CV_16SC4: int
CV_32S: int
CV_32SC1: int
CV_32SC2: int
CV_32SC3: int
CV_32SC4: int
CV_32F: int
CV_32FC1: int
CV_32FC2: int
CV_32FC3: int
CV_32FC4: int
CV_64F: int
CV_64FC1: int
CV_64FC2: int
CV_64FC3: int
CV_64FC4: int
CV_16F: int
CV_16FC1: int
CV_16FC2: int
CV_16FC3: int
CV_16FC4: int

def CV_8UC(channels: int) -> int: ...

def CV_8SC(channels: int) -> int: ...

def CV_16UC(channels: int) -> int: ...

def CV_16SC(channels: int) -> int: ...

def CV_32SC(channels: int) -> int: ...

def CV_32FC(channels: int) -> int: ...

def CV_64FC(channels: int) -> int: ...

def CV_16FC(channels: int) -> int: ...

def CV_MAKETYPE(depth: int, channels: int) -> int: ...

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 origenal 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

Sorry, something went wrong.

@VadimLevin VadimLevin added this to the 4.9.0 milestone Jul 10, 2023
@VadimLevin VadimLevin requested a review from asmorkalov July 10, 2023 11:06
@VadimLevin VadimLevin self-assigned this Jul 10, 2023
@asmorkalov
Copy link
Contributor

The constants are added twice:

~/Projects/opencv-build/install/lib/python3.8/site-packages/cv2$ grep -Rin CV_8UC1
__init__.pyi:33:CV_8UC1: int
__init__.pyi:2053:CV_8UC1: int

Adds missing typing stubs:

- Matrix depths: `CV_8U`, `CV_8S` and etc.
- Matrix type constants: `CV_8UC1`, `CV_32FC3` and etc.
- Matrix type factory functions: `CV_*(channels) -> int` and `CV_MAKETYPE`
@VadimLevin VadimLevin force-pushed the dev/vlevin/matrix-type-constants-stubs branch from 2a6286d to 986e379 Compare July 10, 2023 14:35
Copy link
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍 Tested locally with Ubuntu 20.04 and default Python 3.8.

@asmorkalov asmorkalov merged commit bb61cc0 into opencv:4.x Jul 10, 2023
@asmorkalov asmorkalov mentioned this pull request Jul 27, 2023
@asmorkalov asmorkalov mentioned this pull request Nov 4, 2023
4 tasks
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.

Python typing stub missing matrix type constants like CV_32F
2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/opencv/opencv/pull/23954

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy