Skip to main content

OpenCV stubs

Unofficial python stubs for the opencv-python package.

Official OpenCV stubs now exist (in OpenCV>=4.8, cf this issue and this PR), so this repo was archived from 2023/03/27 to 2024/04/13.
However I found the official stubs unhelpful when it came to type hinting, so I'm un-archiving the repo.

This package includes all the functions, classes and constants (please open an issue if you find a missing one).
For some functions, OpenCV may handle more types than defined in this package. If you would like a type/function to be added or modified, please open an issue or a PR. There may also be a few errors as some types have been added programmatically. Please open an issue/PR if you see one.

The stubs include the docstrings as they are otherwise not available in IDEs (as far as I know).

Installation

The package is available on pypi here, you can install it with:

pip install opencv-stubs

The dependency on opencv is optional, and can be accessed with:

  • pip install opencv-stubs[opencv]
  • pip install opencv-stubs[opencv-contrib]
  • pip install opencv-stubs[opencv-headless]

Acknowledgements

A stub file with opencv functions can be found on the Microsoft stubs repo. This package reused those functions (with some added typing).

TODO:

  • Do something about cv2.gapi.cv, cv2.utils.cv2 and cv2.mat_wrapper.cv (do not duplicate everything if possible).
  • Handle cases like cv2.misc.version.cv2.misc.version.cv2.misc.get_ocv_version().
  • Only include the opencv-contrib specific stubs when using opencv-stubs[opencv-contrib].

Metadata

Release files for opencv-stubs 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencv-stubs 0.1.3
File Size Uploaded
opencv_stubs-0.1.3.tar.gz 376.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opencv-stubs 0.1.3
File Interpreter ABI Platform
opencv_stubs-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 741.4 kB

Release files / opencv_stubs-0.1.3.tar.gz

Download URL opencv_stubs-0.1.3.tar.gz
Size 376.2 kB
Tags Source
SHA-256 checksum
How to use checksums
25b74af6bd7903340587e0fdc7d49ced0d159b56bbc598e5a58d5f3a01549e1c
BLAKE2b-256 checksum
How to use checksums
0bf48cdf24683aae51ad94e443b2b8482a117d7ecf8d6663be8877ec490a73e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.4

Release files / opencv_stubs-0.1.3-py3-none-any.whl

Download URL opencv_stubs-0.1.3-py3-none-any.whl
Size 365.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37074b00ede8ec9e2e2b0e77d02277841421606520327087580309e968e45bfc
BLAKE2b-256 checksum
How to use checksums
628b6041723a40fedc5092bf39a91f0daa0410ebaa09763f07385a01871309bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page