https://github.com/opencv-pg/opencv-pg
Interactive Qt5 Application to explore opencv functions in realtime with an interactive image processing pipeline
https://github.com/opencv-pg/opencv-pg
opencv opencv-python opencv-python3
Last synced: 3 days ago
JSON representation
Interactive Qt5 Application to explore opencv functions in realtime with an interactive image processing pipeline
- Host: GitHub
- URL: https://github.com/opencv-pg/opencv-pg
- Owner: opencv-pg
- License: gpl-3.0
- Created: 2020-11-10T05:07:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-19T06:46:59.000Z (almost 2 years ago)
- Last Synced: 2025-06-13T21:50:03.135Z (15 days ago)
- Topics: opencv, opencv-python, opencv-python3
- Language: Python
- Homepage:
- Size: 4.18 MB
- Stars: 19
- Watchers: 3
- Forks: 5
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# OpenCV Playground
The OpenCV Playground is a Qt6 application that brings together improved documentation alongside OpenCV functions with the ability to explore the effects of function parameters on an image in real time.It also comes with a custom `Pipeline Launcher` that allows you to build and interact with your own sequence of image transformations along with custom build functions.
Full documentation can be found on [Read the Docs](https://opencv-pg.readthedocs.io/en/latest/).
## Installation
Currently tested with python 3.8.10/3.10.0 and opencv-contrib-python-headless 4.8.0.76 on an M1 Mac.From PyPi:
```shell
pip install opencv-pg
```From Github Repo:
```shell
pip install git+https://github.com/opencv-pg/opencv-pg
```### Note for Linux Users
**NOTE:** I no longer have access to anything but a Mac (as of `1.0.2`), so I can't confirm if the below still stands. It did in `1.0.1`.On Ubuntu 16.04 (others currently untested), there may be missing links to xcb related shared objects.
tldr;
```shell
sudo apt-get install --reinstall libxcb-xinerama0
```
------**Digging Deeper**
If you see errors about xcb, you can perform the following to help troubleshoot. In your terminal, make the following export:
```shell
export QT_DEBUG_PLUGINS=1
```Run opencvpg again and validate the output. The final lines will likely mention details about files not found. Likely `libxcb-xinerama.so.0`.
Run the following:
```shell
cd your_venv/lib/pythonX.X/site-packages/PySide2/Qt/plugins/platforms/
ldd libqxcb.so | grep "not found"
```This will print any missing links. In our case, `libxcb-xinerama.so.0` showed up a couple times. Reinstalling the package as follows resolved the issue:
```shell
sudo apt-get install --reinstall libxcb-xinerama0
```Once it’s working, you may want to disable that `QT_DEBUG_PLUGINS` env variable so it doesn’t throw extra garbage in your output.
## Usage
### Playground
To launch the OpenCV Playground with:
* The built-in image:```shell
opencvpg
```* An image of your choice:
```shell
opencvpg --image
```* Without the documentation window:
```shell
opencvpg --no-docs
```### Custom Pipeline
The following is an example of building a custom Pipeline.```python
from opencv_pg import Pipeline, Window, launch_pipeline
from opencv_pg import support_transforms as supt
from opencv_pg import transforms as tfif __name__ == '__main__':
my_image = '/path/to/image.png'# Creates two windows
pipeline = Pipeline([
Window([
supt.LoadImage(my_image),
supt.CvtColor(),
tf.InRange(),
supt.BitwiseAnd(),
]),
Window([
tf.Canny(),
]),
])launch_pipeline(pipeline)
```Then run the file.
## Development
### Installation
To install in development mode:```shell
git clone https://github.com/opencv-pg/opencv-pg
pip install -e opencv-pg/[dev]
```### Running Tests
```shell
cd tests
pytest
```### Generating Docs
* Go into the top level `docs` directory
* run `sphinx-apidoc -f -o source/ ../src/opencv_pg`
* run `make html`Output will be in the `docs/build/html/` directory.