ColorMatch, how to do... where to find the correct algoorithm...???

Hey folks,

i’m searching on a colormatch algorithm, to create similar colors based on a root color…
I found several web pages wich are dooing this job, example :
http://www.hlrnet.com/colormatch/de.php
but i want to undersrtand how this works or at least have a working function like:

color = colormatch((r,g,b,a), colors=5)

wich should return 5 colors matching to the input color…

I only have a musical background, if a tone has double frequency then another, it is a octave higher, means the most consonant intervall is found.
Based on the musical theory and sensitivy of ears, one can define consonant and dissonant structures.
How can i put this into RGB?

I’m not positive what you are asking, here. You might want to google “color space”. To compare colors in a given color space one typically plots a point in space representative of that color so that its distance to other colors can be defined. For example, you might choose to pick the RGB color space and use those three components as the coordinates of a point in a 3-space. Then you could, for example, use Pythagorean’s theorem to calculate the distance between two colors. The color space you choose and the way you plot a given color in an N-space is literally “in the eye of the beholder” because human perception of color and intensities is non-linear and even varies from person to person somewhat. For example, you might pre-process each component of RGB before plotting a point to make low intensities denser (raise the value of each component to a power a little greater than 1, for example). Of course, there’s also the issue of color depth–how many colors can be recorded in a given file and displayed on a given monitor.

I wouldn’t try to create a musical analogy to the concept of colors because there’s not much in common there–at least not in this context.

mathtuitl has some good color functions for different way to represent colors
with RGB VHS ect…

but don’t think it gives has far has giving a range for each hue!

you have to do that by yourself i guess in a script!
but should not be that difficult to do i guess using some random values in certain range of RGB!

happy 2.5

that sounds like, there is no comparable system in colors as there is in music…
For example: a red background(255,0,0) and a green text on it with(0,255,0)
is a very bad choice, because it simply overloads your eyes, they can never get the right contrast.

or a yellow text on a white background would look bad, because the difference is to close …

I googled and find, that probably a 3d space for each color would be nice, so distances can get the
differences between the colors.

But the problem is, i simply dont know, what facrors or distances ar good or bad…
I believe there must be some rules, and only not free interpreted values.

Do you mean something like this http://meyerweb.com/eric/tools/color-blend/ ???

A nice and decent approach, but what is more intriguing to find a nearby name of an (r,g,b) color!

i think you need to define a sort of distance based of an area of the RGB picture showing colors
may be with a close curve then you might be able to determine some meaningfull value!

but don’t remember there was some sort of distance for compatible colors!
for this you need to compare primaries colors with complementary colors
but not certain how it could be done with a script

but check this one out

and here is pyton script but don’t think it ca be use and need numpy

http://code.google.com/p/python-colormath/

i’d like to find a script that can define the area for red or blue or yellow ect function of RGB?
don’t know if it is possible!

happy 2.5

colour has wave lengths and frequencies as well. Since computer generation-codes of colour are simply interpretations of those frequencies; I would think you could translate the RGB into specific frequencies, manipulate them, then translate them back to what ever computer code venue you like.
those frequencies, and our perceptions of them, do follow sets of mathematically describable patterns. Like sound frequencies they should be able to be analyzed as ‘consonant’ or ‘dissconsonant’.

I’d contribute with 2 links… Link 1 Link 2

Now waiting for your symphony, sevi! :wink:

Regards,

Hi,

I am currently trying to install “color math” on OS X 10.6 for Blender 2.62 (which uses Python 3.2, and trying to install ‘colormath’ failed so far with a quick attempt via MacPorts…)

Anyway, so I stumbled over this thread and thought I post my first answer here in this forum :slight_smile:

So I understand the OP is looking for an “algorithm” (or “method”) to provide “pleasant colours”, given a sample colour. Much like humans are able to tell whether two given musical notes are “in harmony or not” (off course also depending on their cultural background I guess) they are also able to tell whether two colours are “pleasant” - to a certain degree at least (“taste matters” ;)).

There are indeed some colour pairs which most people find “disturbing”, especially if you have letters on some background. The letters become hard to read (or they fully take your attention as well, so it might be a deliberate choice!).

For instance red and green, blue and orange and yellow and violet are typically regarded as being “complementary”. Because they lie “opposite” on some given colour “wheel”.

And the later off course depends… on the given colour space, and also whether we are talking about “additive” (such as the light rays of a computer screen) or “subtractive” (such as in real paint colour) colour.

But how do we get “pleasant colours”? I don’t know the answer right away, I think one would also have to dive into psychology here, or read any book about art. I don’t think there’s an algorithm here, it’s more like “certain colour pairs are generally accepted as being pleasant”.

That said, there are off course different “colour spaces” which help you with various tasks! When you deal with computer images the most known one is probably “RGB” (I leave specifics such as “sRGB” etc. away, for the sake of simplicity ;)), that is, every colour is “additively mixed” with Red, Green and Blue.

You can also think about this system as a “colour cube”, with 3 axis Red, Green and Blue.

But RGB is not very good for tasks such as “give me colours which have visually the same distance to a given colour” (“perceptual uniformity”) or “give me the colours which have the same brightness” (but it closely matches how a computer monitor mixes colours).

Or in other words: if you imagine a certain point O (a colour r, g, b) in the colour cube and you move a certain distance ‘d’ in one direction to the new point P1 = (r + d1, g + d2, b + d3), and then you move from the origin by the same distance d to another point P2, the subjective “colour difference” between O and P1 and O and P2 might be entirely different.

That’s why other “colour spaces” such as Lab* have been “invented”. Lab* for instance deals specifically with colour distances, such that when you move in that space (which is also a 3D form, but way more complicated than a simple cube), especially in the plane defined by a* and b*, then the “difference” is visually the same.

Simply put: a* and b* define the colour, and L* the brightness thereof.

Or if you simply want to get a colour with the same “brightness” (but don’t really care about “colour distances”), then you can use HSV (Hue, Saturation, Value), where “Value” would define the “brightness” of a given colour tone. [http://en.wikipedia.org/wiki/HSL_and_HSV]

Summary: depending on what you want (“give me a colour with the same distance as another colour pair” or “Give me a colour which Hue is 60 degrees away”) there are “colour spaces” which are a perfect fit for a given task.

And that’s where “colour conversions libraries” such as the mentioned “color math” in Python enter.

Some colour conversions such as RGB <-> HSV can be done “directly” with easy linear transformations, and they are “lossless”, that is converting a colour from one colour space into another one and back again results in the same colour.

Other conversions such as RGB <-> Lab* or RGB <-> CMYK (the later being used in printing) are more expensive to compute, as they require non-linear transformations, and they use an intermediate step via XYZ colour space. They are also not necessarily “lossless”, as not every colour in one colour space can be represented in another, so it is “clipped” to the nearest colour (think of it as “You can’t print every possible colour on your screen with your printer” or “You can’t display every colour on your screen that you possibly see in real life”).

If you are more interested in the math behind it, and about “chromatic adaption transform” (“reference white point” adaption), then are very good site is: http://www.brucelindbloom.com/

So short answer: Finding pleasant colours is mostly “a matter of taste” :smiley: (but there are colour spaces which can help you).

Cheers, Oliver

p.s. Anyone has a step-by-step solution yet how to make “color math” available for Blender 2.6x on Mac OS X? :wink:

Its functional, but not an addon yet because there is more to do, but here’s the link…

pasteall:
http://www.pasteall.org/29573/python

tutorial vid

I’m not sure what algorithm would be right to use, or what colormatch.de uses specifically, but here is my attempt.

What it does is modulate the hue, saturation, and value over a range of steps to create palette. Adjust various parameters, delete unwanted colors, assign specific colors to selected meshes or lights, or cyclically assign entire color sequence to selected objects, optionally making materials single-user.

http://www.rkmusic.info/avatar3.jpgbut don’t think it gives has far has giving a range for each hue!

http://www.rkmusic.info/avatar3.jpgBut the problem is, i simply dont know, what facrors or distances ar good or bad…
I believe there must be some rules, and only not free interpreted values.