Skip to main content

Allows fast prototyping in Python for OpenCV

Project description

https://github.com/idlesign/opencv-proto

release lic ci coverage

Work in progress. Stay tuned.

Description

Allows fast prototyping in Python for OpenCV

Offers primitives and simplified interfaces to streamline prototypes construction in Python.

Facilitates:

  • Windows construction and management

  • Trackbar construction

  • Configuration save/load (including trackbar values)

  • Key binding (e.g. for trackbar control, configuration save/load)

  • Video capturing and modification

  • Work with images

  • Work with text

  • Frames transformation

Samples

Color Palette

Let’s replace 37 lines of source code from Trackbar as the Color Palette tutorial with ocvproto-based implementation:

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.

from ocvproto.toolbox import WindowManager, Camera

with WindowManager() as wm:

    blur = wm.window.add_trackbar_group(['x', 'y'], 'Blur', default=1)
    wm.app.set_config('ocvproto.json')

    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.frame)

Read the documentation.

Requirements

  • Python 3.6+

  • opencv-python (or variants)

Documentation

https://opencv-proto.readthedocs.org/

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

opencv-proto-0.2.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencv_proto-0.2.0-py2.py3-none-any.whl (16.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file opencv-proto-0.2.0.tar.gz.

File metadata

  • Download URL: opencv-proto-0.2.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for opencv-proto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9480b7b265cf832492cfb64d108243e1c65a5136c2517efc89d419c0f53453bf
MD5 acdf5877682abc9cf682296a4c932357
BLAKE2b-256 26a34345a4a23be4d46ab91f8c1b7ad5c46cae6773aaf7b5a0733992918393a0

See more details on using hashes here.

File details

Details for the file opencv_proto-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for opencv_proto-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4883b7f415e9ca821bab0a920d4f27f7d26403a20aa487df2504cc891eff951a
MD5 03c265f51c241fd16e731a3103009acd
BLAKE2b-256 b75ee5c95b35d958525421e5ef733303a8189748f8b92b4483d06c0703b4df6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page