MantisBT - Open CASCADE
View Issue Details
0031454Open CASCADE[OCCT] OCCT:Visualizationpublic2020-03-20 23:302020-03-28 13:46
[OCCT] 7.5.0* 
0031454: Visualization - perceptually uniform color scale
Current implementation of AIS_ColorSCale can generate color scale using variation of hue parameter in HSL color space. This looks nice but the resulting colors have very different lightness as perceived by the user: blue is much darker than e.g. yellow. This results in very uneven distribution of colors across the model which is shown using the colors from the color scale.

Another problem is that while some colors on the color scale are rather distinct, some are quite close and can hardly be distinguished (especially in green part, see attached image).

It is desirable to have a possibility to generate color scales more uniform in terms of lightness (preferably the same for all colors) and differences between neighbor colors (preferably the same), as percieved by the human user.

This should be achievable using CIE Lch color space and CIE Delta E metric, to produce colors with the same lightness and equal distances between the colors.
test bugs vis bug31454
No tags attached.
png uniform_color_scale.png (3,653) 2020-03-25 10:31
png bug31454.png (11,787) 2020-03-25 20:39
Issue History
2020-03-20 23:30abvNew Issue
2020-03-20 23:30abvAssigned To => kgv
2020-03-20 23:33gitNote Added: 0091098
2020-03-24 23:36gitNote Added: 0091225
2020-03-25 00:50gitNote Added: 0091227
2020-03-25 07:41gitNote Added: 0091230
2020-03-25 10:31abvFile Added: uniform_color_scale.png
2020-03-25 10:50abvNote Added: 0091232
2020-03-25 10:50abvStatusnew => resolved
2020-03-25 10:50abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22721#r22721
2020-03-25 13:44kgvNote Added: 0091239
2020-03-25 13:44kgvAssigned Tokgv => abv
2020-03-25 13:44kgvStatusresolved => assigned
2020-03-25 20:37gitNote Added: 0091250
2020-03-25 20:39abvNote Added: 0091251
2020-03-25 20:39abvAssigned Toabv => kgv
2020-03-25 20:39abvStatusassigned => resolved
2020-03-25 20:39abvFile Added: bug31454.png
2020-03-25 20:43kgvNote Added: 0091252
2020-03-25 20:43kgvAssigned Tokgv => bugmaster
2020-03-25 20:43kgvStatusresolved => reviewed
2020-03-27 14:54bugmasterNote Added: 0091300
2020-03-27 14:54bugmasterStatusreviewed => tested
2020-03-27 14:56bugmasterTest case number => bugs/vis/bug22632,bugs/vis/bug31454,v3d/colors/begin,v3d/colors/de2000,v3d/colors/de2000_sharma,v3d/colors/rgb2lab,v3d/colors/rgb2lch,v3d/colors/stability
2020-03-28 13:36bugmasterChangeset attached => occt master 14b741b0
2020-03-28 13:36bugmasterStatustested => verified
2020-03-28 13:36bugmasterResolutionopen => fixed
2020-03-28 13:46gitNote Added: 0091321

2020-03-20 23:33   
Branch CR31454 has been created by abv.

SHA-1: a609901501d279d88250db29223a1b01dcd37bcf

Detailed log of new commits:

Author: abv
Date: Thu Mar 19 10:03:40 2020 +0300

    Support of CIE Lab and Lch color spaces in Quantity_Color
    Enumeration Quantity_TypeOfColor is extended by new values representing CIE Lab and Lch color spaces (with D65 2 deg illuminant).
    Conversion of RGB color to and from these color spaces is implemented in Quantity_Color class (using existing interface).
    DRAW command vconvertcolor is added to perform relevant conversions.
2020-03-24 23:36   
Branch CR31454 has been updated forcibly by abv.

SHA-1: f4fd5dad14debb330e5c36061c8a6bcdca303d3f
2020-03-25 00:50   
Branch CR31454 has been updated forcibly by abv.

SHA-1: 0fdcf1d2ca45dce7a0e1621be95fdce9358d807e
2020-03-25 07:41   
Branch CR31454 has been updated forcibly by abv.

SHA-1: ec38b6bce05e1161553210616892bd42cce52ec1
2020-03-25 10:50   
Please review branch CR31454. Tests are OK, see Jenkins job CR31454-abv (there are some irrelevant failures - one fail looks like instability, and C# wrapper fails reportedly due to disk space).

Support of CIE Lab and Lch color spaces is introduced in Quantity_Color:
- Enumeration Quantity_TypeOfColor is extended by new values representing CIE Lab and Lch color spaces (with D65 2 deg illuminant).
- Conversion of RGB color to and from these color spaces is implemented in Quantity_Color class (within existing API).
- Color difference calculation using CIE Delta E 200 formula is implemented in method DeltaE2000().

New methods MakeUniformColors() and SetUniformColors() are added in class AIS_ColorScale, generating and setting color scale based on colors of the same lightness in CIE Lch color model.

DRAW commands vcolorconvert and vcolordiff are added to perform conversions and compute difference, respectively.
A new option -uniform is added in DRAW command vcolorscale, to set uniform color scale.

Added test grid v3d colors (color conversions and difference), test bugs vis bug31454 (uniform color scale)

The image uniform_color_scale.png shows standard color scale (generated in HSL space) and new uniform one. Note that it was expected that neighbour colors in the uniform color scale should be perceived as equally distant; this is not the case (at least for my eyes and with the monitors I have). This can be investigated further, though I do not see now what else can be impeoved.
2020-03-25 13:44   
Please correct misprints in comments.
2020-03-25 20:37   
Branch CR31454 has been updated forcibly by abv.

SHA-1: fb665b544ede5f805cd7367a18415a996121b68e
2020-03-25 20:39   
Documentation comments and names of arguments are corrected; test is improved to show several uniform color scales with different lightness and 10 intervals. Please review
2020-03-25 20:43   
Please raise patch in OCCT branch CR31454.
2020-03-27 14:54   
Combination -
OCCT branch : WEEK-13
master SHA - 64943a5187fa485536cd2dd1dd4d51b13d189b89
Products branch : WEEK-13 SHA - f10b867b449ebfa55e0a3c8cb276ae511f9cf7f2
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

No regressions/differences

CPU differences:
Total CPU difference: 16868.620000000134 / 16846.320000000138 [+0.13%]
Total CPU difference: 11317.180000000084 / 11306.210000000074 [+0.10%]
Total CPU difference: 18288.046875 / 18268.796875 [+0.11%]
Total CPU difference: 13120.859375 / 13110.609375 [+0.08%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
2020-03-28 13:46   
Branch CR31454 has been deleted by inv.

SHA-1: fb665b544ede5f805cd7367a18415a996121b68e