Ask Your Question

Revision history [back]

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?

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?

click to hide/show revision 3
retagged

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

berak gravatar image

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?