# L*u*v* and L*a*b* Color Space are Non-Euclidean in 8U From the docs for Luv:

In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and scaled to fit 0 to 1 range. [...]
This outputs 0 <= L <= 100, -134 <= u <= 220, -140 <= v <= 122 .
The values are then converted to the destination data type:
8-bit images: L := 255/100 L, u := 255/354 (u + 134), v := 255/256 (v + 140)

A similar re-scaling happens for Lab.

Both Lab and Luv are perceptually Euclidean.
From Wikipedia:

.. [The] relative perceptual differences between any two colors in Lab can be approximated by treating each color as a point in a three-dimensional space (with three components: L, a, b) and taking the Euclidean distance between them.

This Euclidean perceptual property is the main reason for using Lab and Luv.
The problem with the 8-bit re-scaling is that the Euclidean property is not preserved (in 8U).

Has anyone noticed this before?

edit retag close merge delete

Sort by » oldest newest most voted

Yes. However in Lab, the scaling for a and b are the same, differing only by an offset, which is removed if you take the difference using only "a" and "b". So if you wanted to check to see if the color was similar looking, and not worry about the "L" component, then you could just form a norm on the "a" and the "b" parts.

Myself I just use the floating point version, which is left alone.

more

Official site

GitHub

Wiki

Documentation