Run Length Smoothing Algorithm
Project description
RLSA
C implementation of RLSA for use in python.
Usage
Requirements
- python version >= 3.8
Install
Install with:
pip install rlsa
Usage
The only function currently exported is rlsa
.
It takes as input a black and white image (as a uint8 numpy array), and the hvs and vsv values (for now the ahsv is fixed as hsv // 10
).
The function returns a new black and white image, leaving the original one intact.
Usage example
import cv2
from rlsa import rlsa
img = cv2.imread("assets/rlsa_test_image.jpg", cv2.IMREAD_GRAYSCALE)
_, binary_img = cv2.threshold(img, 190, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
hsv = vsv = 25
out_img = rlsa(binary_img, hsv, vsv)
Results
TODO
Included scripts
A few scripts are included in the tests folder. One is a python implementation of rlsa, serving as reference. The other two compare the result and speed of the implementations.
To run the those scripts, you need to install opencv.
Test
python -m tests.test assets/rlsa_test_image.jpg
Benchmark
python -m tests.benchmark assets/rlsa_test_image.jpg
--> C version is around 400 times faster than the naive python one.
Misc
Note: the numpy tutorial/doc here is (it seems) outdated (be carefull when using it).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for rlsa-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 299265a6c332cbb3a882ea4d3e20f77be898214ce1a8bd5ceaa587472e4dbc75 |
|
MD5 | 3127418e3fd06f1882df1a18b82581c0 |
|
BLAKE2b-256 | ce7371d729875cbe463d4e9ac5cccec32316d21b47f13c72995c3be11ed0a615 |
Hashes for rlsa-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f47dce67822bcfa5b85a70635980520aea13a7e6c6c172412d65357fc282c2 |
|
MD5 | 0deeb2bff8728ec53619f75206ae7268 |
|
BLAKE2b-256 | 43f33630c4ab2613c19be5e6cdca98c4ce803e9c3a46105e04faceb6facf2107 |
Hashes for rlsa-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 458a1254d2289f3c2586b6d8d0c2d4ed3359ed379164c5f8e0a2c66093d4de61 |
|
MD5 | b2ee29d1c25afc6936ad6ccae6f7d4ad |
|
BLAKE2b-256 | ad25d031668af6a4518bf9155b3a2cc373ae4c0fabf050e2041f4b5b5c638752 |