Allows fast prototyping in Python for OpenCV
BSD-3-CLAUSE License
https://github.com/idlesign/opencv-proto
|release| |lic| |ci| |coverage|
.. |release| image:: https://img.shields.io/pypi/v/opencv-proto.svg :target: https://pypi.python.org/pypi/opencv-proto
.. |lic| image:: https://img.shields.io/pypi/l/opencv-proto.svg :target: https://pypi.python.org/pypi/opencv-proto
.. |ci| image:: https://img.shields.io/travis/idlesign/opencv-proto/master.svg :target: https://travis-ci.org/idlesign/opencv-proto
.. |coverage| image:: https://img.shields.io/coveralls/idlesign/opencv-proto/master.svg :target: https://coveralls.io/r/idlesign/opencv-proto
Work in progress. Stay tuned.
Allows fast prototyping in Python for OpenCV
Offers primitives and simplified interfaces to streamline prototypes construction in Python.
Facilitates:
Color Palette
Let's replace 37 lines of source code from `Trackbar as the Color Palette <https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_trackbar/py_trackbar.html>`_
tutorial with ``ocvproto``-based implementation:
.. code-block:: python
from ocvproto.toolbox import WindowManager, Canvas
with WindowManager() as wm:
rgb = wm.window.add_trackbar_group(['R', 'G', 'B'], max=255)
for _ in wm.app.loop():
wm.set_frame(Canvas(512, 300, color=rgb))
Camera capture
Now let's capture video camera stream into ocvproto.avi
file, being able to adjust blur.
Let's also setup config filepath (ocvproto.json
) - this allows us to store current trackbar values
(s
key) and load them (r
key). It is useful to restore settings between sessions.
We bind z
key to take camera shots.
.. code-block:: python
from ocvproto.toolbox import WindowManager, Camera
with WindowManager() as wm:
wm.app.set_config('ocvproto.json')
blur = wm.window.add_trackbar_group(['x', 'y'], 'Blur', default=1)
with Camera() as cam:
wm.app.bind_key('z', cam.dump_image)
for _ in wm.app.loop():
cam.read()
cam.blur(blur)
cam.dump()
wm.set_frame(cam)
Read the documentation.
opencv-python
(or variants)Quick install with third-parties: $ pip install opencv-proto[all]