HSV conversion tools
Project description
HSV project
Why installing HSV :
This library offers fast conversion tools such as (HSV to RGB ) and (RGB to HSV)
ported into cython for better performances
Project description :
Conversions between color systems (cython library)
This module defines bidirectional conversions of color values between colors
expressed in the RGB (Red Green Blue) color space used in computer monitors and three
HLS (Hue Lightness Saturation).
Installation
pip install HSV
How to?
from HSV.hsv import rgb_to_hsv, hsv_to_rgb
if __name__ == '__main__':
ONE_255 = 1.0 / 255.0
r, g, b = 25, 60, 128
print("\nOriginal RGB values (R:%s, G:%s, B:%s)\n" % (r, g, b))
h, s, v = rgb_to_hsv(r * ONE_255, g * ONE_255, b * ONE_255)
print("HSV values (H:%s, S:%s, V:%s)" % (h * 360.0, s * 100.0, v * 100.0))
r, g, b = hsv_to_rgb(h, s, v)
print("Retrieved RGB values (R:%s, G:%s, B:%s)\n" % (r * 255.0, g * 255.0, b * 255.0))
Building cython code
If you need to compile the Cython code after changing the files hsv.pyx or hsv.pxd or
the external C code please proceed as follow:
1) open a terminal window
2) Go in the main project directory where (hsv.pyx & hsv.pxd files are located)
3) run : python setup_hsv.py build_ext --inplace
If you have to compile the code with a specific python version, make sure
to reference the right python version in (c:\python setup_hsv.py build_ext --inplace)
If the compilation fail, refers to the requirement section and make sure cython
and a C-compiler are correctly install on your system.
- A compiler such visual studio, MSVC, CGYWIN setup correctly on your system.
- a C compiler for windows (Visual Studio, MinGW etc) install on your system
and linked to your windows environment.
Note that some adjustment might be needed once a compiler is install on your system,
refer to external documentation or tutorial in order to setup this process.
e.g https://devblogs.microsoft.com/python/unable-to-find-vcvarsall-bat/
Credit
Yoann Berenguer
Dependencies :
cython >= 0.28
setuptools>=49.2.1
License :
MIT License
Copyright (c) 2019 Yoann Berenguer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Timing :
python
Test with 1000000 iterations
This library
rgb_to_hsv per call 2.22e-07 overall time 0.22196 for 1000000
hsv_to_rgb per call 1.156e-07 overall time 0.11563 for 1000000
Colorsys library
rgb_to_hsv per call 9.631e-07 overall time 0.96312 for 1000000
hsv_to_rgb per call 4.587e-07 overall time 0.45866 for 1000000
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
HSV-1.0.2.tar.gz
(59.0 kB
view details)
Built Distributions
File details
Details for the file HSV-1.0.2.tar.gz
.
File metadata
- Download URL: HSV-1.0.2.tar.gz
- Upload date:
- Size: 59.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e61157df6d9398b4ebdcebfaab5f19bdf887b09237e2c570ba45895db94e4ce |
|
MD5 | 67a731ca6813df5225d3a6584db7ccf0 |
|
BLAKE2b-256 | 038e5f3a590598a061eb7b6d440430e1117b45072c22c1ba8c7ba6a05a927cc4 |
File details
Details for the file HSV-1.0.2-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: HSV-1.0.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bcca34f36668156c562dcef9823f851755b5c6e6a48cd124516af226ff8191c |
|
MD5 | 305649c50a34d4c7e8854489fbf041ad |
|
BLAKE2b-256 | 588d2a6303ae4c14bd5af074ea20018f31c7a12ac6e5159a5de5d790ac87dd89 |
File details
Details for the file HSV-1.0.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: HSV-1.0.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 964b6a560a470a414a449439510defcecf788936cc056e191c79e851a184f9c1 |
|
MD5 | 8f3624abca2b0975e9f20dda409907d4 |
|
BLAKE2b-256 | c67e020f5dcaab13319bf16d7d7165d08ecf4b00e3c8612ecfe90ae4d70585a6 |
File details
Details for the file HSV-1.0.2-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: HSV-1.0.2-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 38.9 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25e9857ff6776a55839b4bfeb3b37ba5db331655f5643962cabf9b45ddc6b7a5 |
|
MD5 | f7c55b2dfe39c080c5d66857eea0fe65 |
|
BLAKE2b-256 | b9a625785e815e6996d6d7e1c2d9f5eb5132ec9759616fadac24f34878460c14 |
File details
Details for the file HSV-1.0.2-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: HSV-1.0.2-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 38.9 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 663379a326a0cad763b714cc26e4d302979d1d475ada95dea273bfdd240e8ee2 |
|
MD5 | 1e516971da0fc3efc92168bb20d30479 |
|
BLAKE2b-256 | 41b3e427a852baee12b41c59b12a7e7694e1c523457e4db0ed2f45f7f6f44306 |
File details
Details for the file HSV-1.0.2-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: HSV-1.0.2-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61b6f192504e930816c67284f76afe8eb67ada6af87b78a1397c81e66a0e6cbc |
|
MD5 | 2204e78f72f41aa9f5b80539097915fd |
|
BLAKE2b-256 | e8b2e165640badfd9e6157f9a0ea494c72d67e186038c45d9a5dba47107d1262 |