Color Image with Few Colors from an image with Labeled Objects
Project description
Brief Description
fewColors allows to create a color image from an image with labeled objects so that adjacent objects have different colors while using the fewest colors possible.
Image with labeled objects (background=0, objects=1, 2…). |
Color image with the fewest colors possible. |
Installation
The fewColors project is published on the Python Package Index (PyPI) at: https://pypi.org/project/few-colors. It requires version 3.8, or newer, of the interpreter. It should be installable from Python distribution platforms or Integrated Development Environments (IDEs). Otherwise, it can be installed from a command-line console:
- For all users, after acquiring administrative rights:
First installation: pip install few-colors
Installation update: pip install --upgrade few-colors
- For the current user (no administrative rights required):
First installation: pip install --user few-colors
Installation update: pip install --user --upgrade few-colors
Documentation
After installation, the few-colors and few-colors-gui commands should be available from a command-line console.
The usage help for few-colors is obtained with few-colors --help (see output below). The accepted file formats for the input labeled image are the image formats read by imageio, and the NPY and NPZ Numpy formats. (See note below for the reason to use Numpy formats.) A labeled image or Numpy array must have the background labeled with zero, with the objects labeled consecutively from 1. The accepted image formats for the output color image are the image formats written by imageio.
Usage Help:
usage: few-colors [-h] file file Convert a labeled image or a labeled Numpy array into a minimally colored image positional arguments: file Input labeled image or Numpy array and Output minimally colored image (pass input first) optional arguments: -h, --help show this help message and exit
The command few-colors-gui can be launched with or without an argument as an initial image. If no argument is passed, a file browser opens to select an image. The color version is immediately displayed. It is then possible to change the image, change the object colors (individually or collectively; Press the ? button for help), and save the color image. There is no close button. The window can simply be closed using the appropriate window manager button or keyboard shortcut.
Thanks
The project is developed with PyCharm Community.
The development relies on several open-source packages (see install_requires in setup.py).
The code is formatted by Black, The Uncompromising Code Formatter.
The imports are ordered by isort… your imports, so you don’t have to.
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 Distributions
Built Distribution
File details
Details for the file few_colors-2021.2-py3-none-any.whl
.
File metadata
- Download URL: few_colors-2021.2-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b285956a0c81a49783911f5c3c496ef9380bf33cc1dd8842128ec299ce8b948f |
|
MD5 | f9431bdb7fd7444ee9bca2997cf599d3 |
|
BLAKE2b-256 | ba1b03d2d0b5e61c6475a9b72095e3a127eb66fdedc9ce91a1b69ae0f27f0e88 |