3 ms·
Can you give an example of three colours where the triangle inequality is false? Would be interesting to look at.
by OscarCunningham 4y ago
Can you give an example of three colours where the triangle inequality is false? Would be interesting to look at.
- adrian_b 4y agoOne paper where some such experiments are discussed and which includes some color diagrams is: https://psyarxiv.com/vtzrq/download?format=pdf https://psyarxiv.com/vtzrq/download?format=pdf The violations of the triangle inequality are caused, as others have also mentioned, both by the nonlinearity of the dependence between the perceived intensity of a color and its corresponding radiant flux and by the interactions between the 3 color channels. Therefore, while the 3 RGB or XYZ values are enough for being able to recognize if any pair of colors are the same or different, to be able to recognize whether in a set of 3 colors the 3rd is closer to the 1st or to the 2nd, one needs to apply some non-linear function of 3 arguments, providing 3 output numbers, in order to map the RGB/XYZ space to a space where a simple distance formula, e.g. the Euclidean distance or the Manhattan distance, can be used. Alternatively the non-linear 3 to 3 transform can be combined with the distance formula in the transformed space into a non-linear complicated distance formula that can be used directly in some applications, on RGB/XYZ colors, but separating the space mapping transform can be useful in some other applications, e.g. in color interpolation (though color interpolation can also be done based on only a distance formula, by solving an equation for each intermediate point, which might be not slower than mapping the extreme points, interpolating in the uniform space and then reverse mapping the interpolated points).
- OscarCunningham 4y ago> one needs to apply some non-linear function of 3 arguments, providing 3 output numbers, in order to map the RGB/XYZ space to a space where a simple distance formula, e.g. the Euclidean distance or the Manhattan distance, can be used. If there were such a function then the triangle inequality would hold on the original space.
- adrian_b 4y agoWhen any of the 3 output variables depends non-linearly of all 3 input variables that is not true. Even on something as simple as a sphere, you can have a spherical triangle where one side is longer than the sum of the 2 other sides (e.g. when one side is on the equator and the 2 other sides go to one pole and the arc on the equator is greater than a half circle). And you can map a (partial) sphere to a (partial) plane (mapping e.g. an equator segment and some meridian segments to straight lines, in order to map some plane triangles to some spherical triangles) and then use the distance in the plane as a difference function for pairs of points on the sphere.
- OscarCunningham 4y agoSuppose we have a 'difference function' D on the space of colours, a simple metric d on the target space, and some nonlinear function f from the space of colours to the target space such that D(x,y) = d(f(x),f(y)) for all x and y. Then the triangle inequality for D would be D(x,y) + D(y,z) ≥ D(x,z). By the equation above this is equivalent to d(f(x),f(y)) + d(f(y),f(z)) ≥ d(f(x),f(z)), which is true by the triangle inequality in the target space at the points f(x), f(y) and f(z). If the target space uses a simple metric like the Euclidean or Manhattan distance then the triangle inequality is always going to hold in the target space and hence in colour space. Note that the above argument does not need linearity of f. The sphere example doesn't hold up because if two points are further apart than half way around a great circle then the distance between them is actually the length of the path going the other way.
- adrian_b 4y agoI think that you are right, and my answer had been too hasty. What can be obtained experimentally is only the difference function D(x,y). If it cannot be decomposed into a distance function and a space transformation function, i.e. as D(x,y) = d(f(x),f(y)), then that means that the quest for an uniform color space, which has seen a very large number of attempts during a century (the quoted Schroedinger paper is from 1920), will never produce a completely satisfactory result and that the best results for color interpolation or for color matching within tolerances can be obtained only by using a linear RGB or XYZ space together with a complicated non-linear color difference function.