Ask Your Question

L*u*v* and L*a*b* Color Space are Non-Euclidean in 8U

asked 2014-04-30 02:10:52 -0500

Adi gravatar image

updated 2014-04-30 02:14:06 -0500

berak gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-07-16 17:26:24 -0500

Greg Walsh gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-04-30 02:10:52 -0500

Seen: 1,315 times

Last updated: Jul 16 '14