Maximally Distinct Color Generator
- the number of colors, specified as a positive number.
- a function handle that converts from sRGB to some kind of uniform colorspace (e.g. CIELab, OKLab, DIN99, DIN99o, OSA-UCS, CAM02-LCD, CAM02-UCS, CAM16-LCD, CAM16-UCS, etc.).
- Limit the lightness range.
- Limit the chroma range.
- Provide a colormap of colors to be excluded (e.g. background colors, existing plot colors).
- Provide a colormap of colors to be included (e.g. company colorscheme).
- Specify the class (double/single) used for the RGB calculations.
- Specify the bit/color depth to control the number of samples of each color channel.
- Sort the colormap (e.g. by hue, chroma, lightness, farthest colors, etc.).
- Existing "distinct color" generators use inadequate colorspaces and/or algorithms, leading to suboptimal color distinctiveness.
- The realization that 64 bit PCs with >8 GB of RAM can operate on the entire 16 million colors of 24 bit TrueColor, allowing for neat and simple vectorized MATLAB code.
- An algorithm to find the best color combination requires finding the global optimum, a task which grows exponentially with the number of requested colors and with the color gamut size. In MAXDISTCOLOR I use repeated application of a simple greedy algorithm to find the maximally-distinct colors: the repeated greedy algorithm is not particularly fast and is not a general solution for finding a global optimum, but luckily it gives good results for the regularly sampled RGB cube. Note that this algorithm contains no random numbers: it is entirely deterministic and repeatable.
- Defining a true uniform colorspace: the venerable CIELab (used by most existing tools I could find) is not really very uniform, particularly around the blues/greens. For MAXDISTCOLOR I recommend CAM02-LCD or CAM02-UCS or CAM16-LCD or CAM16-UCS or OKLab or OSA-UCS, all of which provide a more accurate measure of the color distance.
Zitieren als
Stephen23 (2024). Maximally Distinct Color Generator (https://www.mathworks.com/matlabcentral/fileexchange/70215-maximally-distinct-color-generator), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- Image Processing and Computer Vision > Image Processing Toolbox > Image Segmentation and Analysis > Image Segmentation > L*a*b* Color Space >
Tags
Quellenangaben
Inspiriert von: Generate maximally perceptually-distinct colors, colorSpectrum: Create N Distinct Plot Colors, Tol colors, Convert between RGB and Color Names, CubeHelix Colormap Generator: Beautiful and Versatile!, ColorBrewer: Attractive and Distinctive Colormaps, Custom Colors for Plots, Intuitive RGB color values from XKCD, Beautiful and distinguishable line colors + colormap, Color name identification: fuzzycolor
Inspiriert: Gantt chart for scheduling problems
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
2.5.0 | - VIEW: remove alphashape, improve pointcloud.
|
||
2.4.4 | * Improve FEX & HTML descriptions |
||
2.4.3 | * Improve options parsing.
|
||
2.4.2 | * Colorspace detection moved to within the main function.
|
||
2.4.1 | * Minor edits to help and documentation. |
||
2.4.0 | * Add OKLab colorspace conversion function.
|
||
2.3.1 | * Add <sort> option 'chroma'.
|
||
2.3.0 | * Text arguments can be string scalar or char vector.
|
||
2.2.0 | * Third output is a structure of greedy algorithm status information. |
||
2.1.3 | Update image |
||
2.1.2 | Update example image. |
||
2.1.1 | * Spelling corrections. |
||
2.1.0 | * Add OSA-UCS function.
|
||
2.0.6 | * Improve FEX examples. |
||
2.0.5 | * Add error codes. |
||
2.0.4 | * Update screenshot |
||
2.0.3 | * Add DIN99 conversion function.
|
||
2.0.2 | Fix time display. |
||
2.0.1 | Add correct screenshot. |
||
2.0.0 | * Use new CIECAM02 version for documentation.
|
||
1.2.0 | Add interactive viewer function |
||
1.1.0 | Change default to [6,7,6] bits. |
||
1.0.2 | Add FEX image |
||
1.0.1 | Add links to HTML. |
||
1.0.0 |