0

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?

CIE 1931 colour space - image from wikipedia

  • I fail to see a problem here: What else would you expect the intermediate color between red and blue to be? – Wrzlprmft Jan 29 '15 at 10:05
  • One thing is what you see, another is what you can tell a software. What I am looking for is a way of computing the intermediate points "between" any two colours. – André Moreira Jan 29 '15 at 10:19
  • Ah, ok, I thought you were complaining that a linear transition would not be a good solution. – Wrzlprmft Jan 29 '15 at 10:24
  • 3
    Maybe it's just me, but I fail to see how this is a design question. Seems more of a math question to me. – Scott Jan 29 '15 at 17:11
  • I'm voting to close this question as off-topic because it is a math question, not a design one. – Vincent Jan 29 '15 at 17:35
3

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

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


At the end, a simple ((X2-X1)/2)+X1 will give you the middle value in X axis. The same for the y axis.

1

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−txA + t·xB
  • y(t) = (1−tyA + 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.

  • won't this only work if the transitions in colour space are linear? – André Moreira Jan 29 '15 at 11:16
  • How do you define a linear colour space? At the end of the day, it probably all depends on what you consider the best mix between two colours, which is probably something you could excessively debate about. Anyway, I understood your question such that you want colours from the line you depicted. – Wrzlprmft Jan 29 '15 at 11:34
  • 1
    I think this aproach is correct, just remember that in any colour model you have 3 coordinates, not 2. – Rafael Jan 29 '15 at 15:49
  • @Rafael: Well, the colour space the OP was asking about isn’t as it misses saturation. You might notice the lack of anything blackish in the diagram. – Wrzlprmft Jan 29 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.