pyrebel
A pure python library that implements abstraction of data.
Installation
From PyPI
python3 -m pip install --upgrade pyrebel
From source
git clone https://github.com/ps-nithin/pyrebel
cd pyrebel
python3 -m pip install .
Running demo programs
Demo programs are located in 'demo/' directory.
cd demo/
1. Image abstraction demo
Usage:
python3 pyrebel_main.py --input <filename.png>
Optional arguments
--abs_threshold <value> Selects the threshold of abstraction. (Defaults to -1, which sets per blob threshold based on the size of the blob.)
For example,
python3 pyrebel_main.py --input images/abc.png --abs_threshold 10
The output is written to 'output.png'
To write layers to file use the following,
python3 pyrebel_main_layers.py --input images/abc.png
This will save the files as layer-3.png, layer-4.png etc.
2. Edge detection demo
This is a demo of edge detection achieved using data abstraction.
Usage:
python3 pyrebel_main_edge.py --input <filename>
For example,
python3 pyrebel_main_edge.py --input images/wildlife.jpg
The output is written to 'output.png'.
Below is a sample input image,
Below is the output image,
See how edge detection works here
3. 2D sketch demo
This is a demo of 2D sketch formation using data abstraction.
Usage:
python3 pyrebel_main_vision.py --input <filename>
Optional arguments for tweaking the result,
--edge_threshold <value>Selects the threshold of edge detection.(Defaults to 5)--abs_threshold <value>Selects the threshold of output abstraction. (Defaults to 10)--bound_threshold <value>Selects the threshold of boundary size. (Defaults to 100)
For example,
python3 pyrebel_main_vision.py --input images/lotus.jpg
Below is a sample input image,
Below is the output image,
4. Abstract painting
This is a demo of abstract painting using data abstraction. The output of edge detection is painted to obtain the desired output.
Usage:
python3 pyrebel_main_paint.py --input <filename>
Optional arguments for tweaking the result,
--edge_threshold <value>Selects the threshold of edge detection. (Defaults to 10).--paint_threshold <value>Selects the threshold of painting. (Defaults to 5).--block_threshold <value>Selects the threshold of block size. (Defaults to 20).--scale_factor <value>Selects the scale of the output image. (Defaults to 1.0).
For example,
Runningpython3 pyrebel_main_paint.py --input images/elephant.jpg --edge_threshold 10 --block_threshold 50 --paint_threshold 2 --scale_factor 0.5
Below is the sample input image,
Below is the output image,
5. Abstract focusing
This is a demo of abstract focusing done using data abstraction. It tries to mimic eye movements / saccades / glance.
Usage:python3 pyrebel_main_edge_join_pan.py --input images/lotus.jpg
You can use keyboard shortcuts to drive focus and movements. Arrow keys for movements, plus / minus keys for focus and t / shift+t for edge threshold.
Optional arguments,
--camera 1Selects camera as input source. (Inputcsi_pipeline/usb_pipelinetoGst.parse_launch()as required).--output_resolution <value>Selects the output resolution. (Defaults to 600).
The output is written to 'output_joined.png'.
6. Pattern recognition demo
This is a demo of pattern recognition achieved using data abstraction.
- Learning
Usage:python3 pyrebel_main_learn_multiple.py --learn /path/to/image/directory/
For example runningpython3 pyrebel_main_learn_multiple.py --learn images/train-hand/learns all the images in the directory and links the filename with the signatures. - Recognition
Usage:python3 pyrebel_main_learn_multiple.py --recognize <filename>
For example runningpython3 pyrebel_main_learn_multiple.py --recognize images/recognize.pngdisplays the symbols recognized in the file 'images/recognize.png'.
Optional arguments,
--abs_threshold <value>Selects the threshold of abstraction. (Defaults to -1, which sets per blob threshold based on the size of the blob.)
The output is written to 'output_text.png'. To reset the knowledge base just delete file 'know_base.pkl' in the current working directory.
See how the program learns and recognizes patterns here
6.1 Pattern recognition with focusing
This is a demo of pattern recognition combined with focusing.
Usage:python3 pyrebel_main_learn_multiple_edge_pan.py --camera 1
You can use keyboard shortcuts to drive focus, movements and activate learning mode. Arrow keys for movements, plus / minus keys for focus, t / shift+t for edge threshold and l key for activating learning mode. On activating learning mode you can see the learned patterns in 'inside.png'.
Optional arguments,
--input <filename>Selects file as input source.--output_resolution <value>Selects the output resolution. (Defaults to 600).
(Note: Make sure that the dimensions of the input image (camera or file) is greater than --output_resolution).
The output is written to 'output_text.png'.
7. Abstract motion
This is a demo of obtaining abstract motion data [[angle1,distance1],[angle2,distance2],...] from boundaries.
Usage:python3 pyrebel_main_motion.py --input images/shapes/rectangle.png
Docs here
Read more here
Let the data shine!
Metadata
Release files for pyrebel 1.2.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrebel-1.2.12.tar.gz | 60.3 kB | Without provenance | Details for pyrebel-1.2.12.tar.gz |
Release files / pyrebel-1.2.12.tar.gz
| Download URL | pyrebel-1.2.12.tar.gz |
|---|---|
| Size | 60.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b03ca5f19d4d0fd4bd9a4bb4fbcdfd0b4c5f63d4b25beb19d400b64213aa4428
|
|
BLAKE2b-256 checksum How to use checksums |
f3d2f818012b0e2e040dac9e8de12e9a6adde564172b2d89f3e81bfa0e216b8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for pyrebel 1.2.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.