cv3: Pythonic OpenCV
cv3 is a Pythonic wrapper for OpenCV that simplifies computer vision tasks by providing more intuitive interfaces and eliminating common boilerplate code.
Principles
- Solve more important tasks than writing extra code
- You are programming in Python, not C++
- OpenCV is not scary
Why cv3?
OpenCV is a powerful computer vision library, but its API can be verbose and unintuitive, especially for Python developers. cv3 addresses these issues by:
- Providing sensible defaults for common parameters
- Accepting more flexible input types (e.g., float coordinates, pathlib.Path objects)
- Eliminating repetitive code patterns
- Adding Pythonic features like context managers and iterators
- Handling common error cases with better error messages
Key Benefits
- Simplified API: Common operations require fewer parameters
- Type Flexibility: Accepts various input types where OpenCV is strict
- Error Handling: Better error messages and automatic handling of common issues
- Pythonic Design: Context managers, iterators, and other Python idioms
- RGB by Default: Works with RGB color format by default (configurable)
Installation
You can install cv3 using either of the following methods:
- From PyPI (recommended):
pip install cv3
- From GitHub (latest development version):
pip install git+https://github.com/gorodion/cv3.git
Quick Start
import cv3
# Read an image (automatically handles RGB conversion)
img = cv3.imread('image.jpg')
# Draw a rectangle without specifying color or thickness
cv3.rectangle(img, 100, 50, 150, 100)
# Save the image (automatically creates directories if needed)
cv3.imwrite('output/image_result.jpg', img, mkdir=True)
# Display in a window with context manager
with cv3.Window('Result') as window:
window.imshow(img)
window.wait_key(0)
This is just a small example of what cv3 can do. Check out the documentation for a comprehensive overview of all the improvements and additions that cv3 provides over raw OpenCV.
You can also get acquainted with the features in demo.ipynb
Requirements
- Python 3.6+
- opencv-python (or variants)
Documentation
Run tests
pytest -v
I hope this is helpful, please contribute 🙂
Metadata
Release files for cv3 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cv3-1.3.2.tar.gz | 45.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cv3-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.4 kB
Release files / cv3-1.3.2.tar.gz
| Download URL | cv3-1.3.2.tar.gz |
|---|---|
| Size | 45.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8d04d5279880a76fd50fa16c563ea5b7ee0f235761669be84c099bcf40e9fd8
|
|
BLAKE2b-256 checksum How to use checksums |
09fab6d43fd02e7fb920b62ffe01f3663816f355d0d4bdb76a2af618aa89aa90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / cv3-1.3.2-py3-none-any.whl
| Download URL | cv3-1.3.2-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23e15cf684bf06b3f459121f113ff212f0b49ddf1103c1bf18735c98c73b4ee1
|
|
BLAKE2b-256 checksum How to use checksums |
bdbf31da966b517c29e15301fc9af95614c275f7ad10a2fc16fc246e66e38624
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|