Skip to main content

A pure python library that implements abstraction of data.

Project description

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,

  1. --edge_threshold <value> Selects the threshold of edge detection.(Defaults to 5)
  2. --abs_threshold <value> Selects the threshold of output abstraction. (Defaults to 10)
  3. --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,

  1. --edge_threshold <value> Selects the threshold of edge detection. (Defaults to 10).
  2. --paint_threshold <value> Selects the threshold of painting. (Defaults to 5).
  3. --block_threshold <value> Selects the threshold of block size. (Defaults to 20).

    For example,
    Running python3 pyrebel_main_paint.py --input images/elephant.jpg --edge_threshold 10 --block_threshold 50 --paint_threshold 1

    Below is the sample input image,


    Below is the output image,

5. Pattern recognition demo

This is a demo of pattern recognition achieved using data abstraction.

  1. Learning
    Usage: python3 pyrebel_main_learn_multiple.py --learn /path/to/image/directory/
    For example running python3 pyrebel_main_learn_multiple.py --learn images/train-hand/ learns all the images in the directory and links the filename with the signatures.

  2. Recognition
    Usage: python3 pyrebel_main_learn_multiple.py --recognize <filename>
    For example running python3 pyrebel_main_learn_multiple.py --recognize images/recognize.png displays the symbols recognized in the file 'images/recognize.png'.

Optional arguments,

  1. --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

Docs here

Read more here

Let the data shine!

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

pyrebel-1.2.7.tar.gz (57.1 kB view details)

Uploaded Source

File details

Details for the file pyrebel-1.2.7.tar.gz.

File metadata

  • Download URL: pyrebel-1.2.7.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyrebel-1.2.7.tar.gz
Algorithm Hash digest
SHA256 d49a70631a6d16030eb6e866505a8e66e7887e7d6c44f0f83b4b94feca32d23b
MD5 991ae5ca8b05379ec7aa56c65ae2ac87
BLAKE2b-256 f6f3f0a14b0c49155e0c547fd862ad7b96e09c38b8b7239d2908a397d0bf18ab

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