: Finding intermediate colours between two xyY colour points I am working in an application where I need to know the intermediate points between two xy coordinates in CIE 1931 colour space. In
I am working in an application where I need to know the intermediate points between two xy coordinates in CIE 1931 colour space.
In the picture below we can see that a linear transition (straight line) between A and B will go through a series of other colours, and I am struggling to find a mathematical way of describing the transitions between A and B in order to get intermediate points.
Any ideas?
More posts by @Steve758
2 Comments
Sorted by latest first Latest Oldest Best
This anwer is just intended to give you some ideas.
The Cie lab, (actually any color space) is a 3d space.
I'm not sure on what is the "real" 3d space, becouse for practical reasons it can be converted into ortogonal coordinates, so you have 3 coordinates, not 2.
"Linear transitions" are relative to what road you take. To make transitions between colours you can take several aproaches.
Types of transitions otake.com.mx/Foros/ColoursTransitions-1.png
This will give you diferent "Middle colours". In an HSB for example, the model 2 will mantain the Bright and saturation on the same level just rotating the Hue value. In terms of Hue it is a linear transition. But if you use another aproach the B and S values will be splited into 2 paths, like model 3, and that will not be linear.
On example No. 3 however, you don't cross diferent hue values, just the Origin and Target hue values.
Of course "linear transition"s is the obvius choice if you are using a mathematical aproach.
You can use some "S" curves or probably a logartimic curves, but, On what basis you choose each one? Probably you want a perceptual model?
Types of transitions otake.com.mx/Foros/ColoursTransitions-2.png
At the end, a simple ((X2-X1)/2)+X1 will give you the middle value in X axis. The same for the y axis.
What you probably want is the weighted arithmetic mean between the two colour coordinates:
First of all, what do you have?
You have the x and y values for A; let’s call them xA and yA.
You have the x and y values for B; let’s call them xB and yB.
Now to describe an intermediate value, you need a parameter, which I will call t. This parameter shall range between 0 and 1 and it shall be such that (for example):
For t =0, you get colour A.
For t =1, you get colour B.
For t =½, you are exactly in the middle between A and B on your line. Or with other words: You get a mix of colours A and B that contains equal parts of both.
For t = ¼, you get a colour that is mostly A with a bit of B. More precisely, it’s three parts A, and one part B.
For t= ¾, you get a colour that’s three parts B and one part A.
To sum it up, t shall be such that it gives the relative amount of B in your mixed colour – you get the relative amount of A from this automatically: It’s 1−t. t is our weight for B in the weighted mean; 1−t is our weight for A. Now, how do you calculate x(t) and y(t) for a given t:
x(t) = (1−t)·xA + t·xB
y(t) = (1−t)·yA + t·yB
If you let t smoothly go from 0 to 1, your colour transitions smoothly from A to B along the line in your diagram.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.