1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-01 10:26:12 +03:00
occt/tests/v3d/colors/rgb2lab
abv 14b741b0ef 0031454: Visualization - perceptually uniform color scale
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)
2020-03-26 19:53:27 +03:00

38 lines
1.1 KiB
Plaintext

# Check conversion of RGB colors to CIE Lab color space
# Samples are obtained (with Ref. White D65, Gamma = 1 for linear RGB) using
# http://brucelindbloom.com/index.html?ColorCalculator.html
set rgb_to_lab_samples {
{ # black, white, 50% gray }
{ {0 0 0} {0 0 0} }
{ {1 1 1} {100 0 0} }
{ {0.5 0.5 0.5} {76.0693 0 0} }
{ # pure colors }
{ {1 0 0} {53.2408 80.0925 67.2032} }
{ {0 1 0} {87.7347 -86.1827 83.1793} }
{ {0 0 1} {32.2970 79.1875 -107.8602} }
{ {0 1 1} {91.1132 -48.0875 -14.1312} }
{ {1 1 0} {97.1393 -21.5537 94.4780} }
{ {1 0 1} {60.3242 98.2343 -60.8249} }
{ # shades of pure red }
{ {0.1 0 0} {16.1387 37.1756 25.0600} }
{ {0.3 0 0} {30.3521 53.6166 44.0349} }
{ {0.5 0 0} {38.9565 63.5695 53.3392} }
{ {0.7 0 0} {45.4792 71.1144 59.6700} }
{ {0.9 0 0} {50.8512 77.3285 64.8840} }
{ # random colors }
{ {0.3 0.5 0.9} {75.2228 0.7560 -31.8425} }
}
foreach sample $rgb_to_lab_samples {
set rgb [lindex $sample 0]
if { $rgb == "#" } continue
set ref [lindex $sample 1]
set lab [vcolorconvert to lab {*}$rgb]
check3reals "RGB ($rgb) to Lab" {*}$lab {*}$ref 1e-4
}