diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 05:28:38 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 05:28:38 +0000 |
commit | a52755528499d45dc9b6f0048e73e45e54ae2ec4 (patch) | |
tree | cdeb942be3eca7c163a2c88e01f71ec20e80531b | |
parent | e36489396557012b2c16f5a9a3f1d859bb781167 (diff) |
automatic import of python-cmapy
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-cmapy.spec | 285 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 287 insertions, 0 deletions
@@ -0,0 +1 @@ +/cmapy-0.6.6.tar.gz diff --git a/python-cmapy.spec b/python-cmapy.spec new file mode 100644 index 0000000..5a427b9 --- /dev/null +++ b/python-cmapy.spec @@ -0,0 +1,285 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cmapy +Version: 0.6.6 +Release: 1 +Summary: Use Matplotlib colormaps with OpenCV in Python. +License: MIT +URL: https://gitlab.com/cvejarano-oss/cmapy/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/25/47/f1d2c686253bea1454cc7db687a09ae912fbe4648a86ef7fcd9765f7639f/cmapy-0.6.6.tar.gz +BuildArch: noarch + + +%description +# cmapy + +Use Matplotlib colormaps with OpenCV in Python. + +Matplotlib provides a lot of [nice colormaps](https://matplotlib.org/tutorials/colors/colormaps.html). Cmapy exposes these colormaps as lists of colors that can be used with OpenCV to colorize images or for other drawing tasks in Python. + +| Original image |  |  |  | +| -- | -- | -- | -- | +|viridis|||| + +See all of the available colormaps as of Matplotlib 2.2.3 in this [all colormaps example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/docs/colorize_all_examples.md). + +## Requirements + +* Python 2.7 or 3. +* Matplotlib. +* OpenCV >= 3.3.0 (to use cv2.applyColorMap()). + +## Installation + +Python 2.7, with pip: + +```bash +pip install cmapy +``` + +Python 3.x, with pip: + +```bash +pip3 install cmapy +``` + +Or, in a Conda environment: + +```bash +conda install -c conda-forge cmapy +``` + +## How to use + +### Colorize images + +Colorize means to apply a colormap to an image. This is done by getting the colormap +with cmapy.cmap() and then applying cv2.applyColorMap(), like this: + +```python +img_colorized = cv2.applyColorMap(img, cmapy.cmap('viridis')) +``` + +Alternatively, you can use cmapy.colorize() directly: + +```python +img_colorized = cmapy.colorize(img, 'viridis') +``` + +See the full [colorize example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/colorize.py). + +### Draw with colors + +Use the cmapy.color() function and an index between 0 and 255 to get a color +from a colormap. Cmapy.color() returns a list of BGR (or RGB) values that can be +used with OpenCV drawing functions. + +```python +# Get color in BGR order (default) by index. +bgr_color = cmapy.color('viridis', 127) + +# Get color in RGB order with a float value. +rgb_color = cmapy.color('viridis', 0.5, rgb_order=True) +``` + +See a complete [drawing with colors example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/draw_with_colors.py). + +%package -n python3-cmapy +Summary: Use Matplotlib colormaps with OpenCV in Python. +Provides: python-cmapy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cmapy +# cmapy + +Use Matplotlib colormaps with OpenCV in Python. + +Matplotlib provides a lot of [nice colormaps](https://matplotlib.org/tutorials/colors/colormaps.html). Cmapy exposes these colormaps as lists of colors that can be used with OpenCV to colorize images or for other drawing tasks in Python. + +| Original image |  |  |  | +| -- | -- | -- | -- | +|viridis|||| + +See all of the available colormaps as of Matplotlib 2.2.3 in this [all colormaps example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/docs/colorize_all_examples.md). + +## Requirements + +* Python 2.7 or 3. +* Matplotlib. +* OpenCV >= 3.3.0 (to use cv2.applyColorMap()). + +## Installation + +Python 2.7, with pip: + +```bash +pip install cmapy +``` + +Python 3.x, with pip: + +```bash +pip3 install cmapy +``` + +Or, in a Conda environment: + +```bash +conda install -c conda-forge cmapy +``` + +## How to use + +### Colorize images + +Colorize means to apply a colormap to an image. This is done by getting the colormap +with cmapy.cmap() and then applying cv2.applyColorMap(), like this: + +```python +img_colorized = cv2.applyColorMap(img, cmapy.cmap('viridis')) +``` + +Alternatively, you can use cmapy.colorize() directly: + +```python +img_colorized = cmapy.colorize(img, 'viridis') +``` + +See the full [colorize example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/colorize.py). + +### Draw with colors + +Use the cmapy.color() function and an index between 0 and 255 to get a color +from a colormap. Cmapy.color() returns a list of BGR (or RGB) values that can be +used with OpenCV drawing functions. + +```python +# Get color in BGR order (default) by index. +bgr_color = cmapy.color('viridis', 127) + +# Get color in RGB order with a float value. +rgb_color = cmapy.color('viridis', 0.5, rgb_order=True) +``` + +See a complete [drawing with colors example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/draw_with_colors.py). + +%package help +Summary: Development documents and examples for cmapy +Provides: python3-cmapy-doc +%description help +# cmapy + +Use Matplotlib colormaps with OpenCV in Python. + +Matplotlib provides a lot of [nice colormaps](https://matplotlib.org/tutorials/colors/colormaps.html). Cmapy exposes these colormaps as lists of colors that can be used with OpenCV to colorize images or for other drawing tasks in Python. + +| Original image |  |  |  | +| -- | -- | -- | -- | +|viridis|||| + +See all of the available colormaps as of Matplotlib 2.2.3 in this [all colormaps example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/docs/colorize_all_examples.md). + +## Requirements + +* Python 2.7 or 3. +* Matplotlib. +* OpenCV >= 3.3.0 (to use cv2.applyColorMap()). + +## Installation + +Python 2.7, with pip: + +```bash +pip install cmapy +``` + +Python 3.x, with pip: + +```bash +pip3 install cmapy +``` + +Or, in a Conda environment: + +```bash +conda install -c conda-forge cmapy +``` + +## How to use + +### Colorize images + +Colorize means to apply a colormap to an image. This is done by getting the colormap +with cmapy.cmap() and then applying cv2.applyColorMap(), like this: + +```python +img_colorized = cv2.applyColorMap(img, cmapy.cmap('viridis')) +``` + +Alternatively, you can use cmapy.colorize() directly: + +```python +img_colorized = cmapy.colorize(img, 'viridis') +``` + +See the full [colorize example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/colorize.py). + +### Draw with colors + +Use the cmapy.color() function and an index between 0 and 255 to get a color +from a colormap. Cmapy.color() returns a list of BGR (or RGB) values that can be +used with OpenCV drawing functions. + +```python +# Get color in BGR order (default) by index. +bgr_color = cmapy.color('viridis', 127) + +# Get color in RGB order with a float value. +rgb_color = cmapy.color('viridis', 0.5, rgb_order=True) +``` + +See a complete [drawing with colors example](https://gitlab.com/cvejarano-oss/cmapy/blob/master/examples/draw_with_colors.py). + +%prep +%autosetup -n cmapy-0.6.6 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-cmapy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.6-1 +- Package Spec generated @@ -0,0 +1 @@ +c3a4125046b77aac870e675ae0975cd5 cmapy-0.6.6.tar.gz |