Pythonic cv2
Project description
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 🙂
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cv3-1.3.2.tar.gz.
File metadata
- Download URL: cv3-1.3.2.tar.gz
- Upload date:
- Size: 45.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d04d5279880a76fd50fa16c563ea5b7ee0f235761669be84c099bcf40e9fd8
|
|
| MD5 |
9c6eebd6b0de2dcdf464f9e374b8a841
|
|
| BLAKE2b-256 |
09fab6d43fd02e7fb920b62ffe01f3663816f355d0d4bdb76a2af618aa89aa90
|
File details
Details for the file cv3-1.3.2-py3-none-any.whl.
File metadata
- Download URL: cv3-1.3.2-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23e15cf684bf06b3f459121f113ff212f0b49ddf1103c1bf18735c98c73b4ee1
|
|
| MD5 |
0010f234f4ffe2b59d064663fedd1fad
|
|
| BLAKE2b-256 |
bdbf31da966b517c29e15301fc9af95614c275f7ad10a2fc16fc246e66e38624
|