Skip to main content

RLSA

C implementation of RLSA for use in python.

Usage

Requirements

  • python version >= 3.8

Install

Install with:

pip install rlsa

Usage

The main function is rlsa.
It takes as input a black and white image (as a uint8 numpy array), and the hvs, vsv and ahvs values. The function returns a new black and white image, leaving the original one intact.

You can also import the rlsa_horizontal and rlsa_vertical functions to apply only one of the RLSA components.

Usage example

A full example would be:

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, hsv//10)

With a similar setup, the other functions can be used like so:

out_img = rlsa_horizontal(binary_img, hsv)
out_img = rlsa_vertical(binary_img, vsv)

Results

Input image After RLSA
Input Output
Horizontal only Vertical only
Horizontal Vertical

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

Metadata

Release files for rlsa 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rlsa 0.0.2
File Size Uploaded
rlsa-0.0.2.tar.gz 5.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rlsa 0.0.2
File Interpreter ABI Platform
rlsa-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.24+ x86-64 Details
rlsa-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64, Linux glibc 2.24+ x86-64 Details
rlsa-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64, Linux glibc 2.24+ x86-64 Details

Total release size: 84.6 kB

Release files / rlsa-0.0.2.tar.gz

Download URL rlsa-0.0.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
408f622326cdc5014382bbbb12b4436a4526550840c1e9aa46dbae1e5c61d139
BLAKE2b-256 checksum
How to use checksums
d247dde21065ae05d934fcf4be5e75add2153fba33aaae573512ab1eec4e514f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.10.2

Release files / rlsa-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl

Download URL rlsa-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Size 25.0 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
173179694dce381f1d4354d46331c45a3171e3e9b0ef55a22b411f3eeb4465eb
BLAKE2b-256 checksum
How to use checksums
8bc6128dfc6315a7b6e3f8d57a33609f70b89c372029c5ad437735c6a2bcc865
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.10.2

Release files / rlsa-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl

Download URL rlsa-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Size 27.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
11fe68b32563e36af47db92fe4ec80335f342ea3a3ae4f494cc2dfa0d166d525
BLAKE2b-256 checksum
How to use checksums
21177536daf74aacbfc1943e7dfbdae2b66c65b39fd2148618ce58ac1aa51720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.10.2

Release files / rlsa-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl

Download URL rlsa-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Size 27.6 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
cf7e7511de7c528cf6bf87499d7ca523c2cef20b8497d0e6e9538040dd9df254
BLAKE2b-256 checksum
How to use checksums
4ebffbe9d30a6f06b57f3b77339813c9b5dc67a8c8fe8f0bec031a5257d60783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

4 release files

0.0.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page