Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-10-11 14:12:05


Andy Little wrote:
> One could start from the most comprehensive model , which is probably that closest
> to the physical phenomenon of electromagnetic radiation
The physical/neurological phenomenon of perceived colour is very
complicated. It involves a range of electromagnetic radiation and the
way the retina cells are stimulated by it, and it is not really useful
in computer graphics. For example, the colour orange may be perceived
either by stimulation by the orange frequency (wavelengths from 590 to
620 nanometers), or it may be stimulation by two or more distinct
frequencies ranging from the green to the red area. In real life, it
will usually be a continuous spectrum, distributed in such a way that
the red receivers are stimulated more than the green receivers.
In fact, the exact way by which the human eye perceives colour is not
yet definitely known.
> and why there are various representations.
That could certainly be interesting, but it might also be too much
theory for the library. I think the presence or absence of such
background documentation should not affect the decision whether to
accept or reject GIL.
> For instance the primary colours are red, yellow and blue.
No, they're not. It's what people learn when they grow up, but it's
really wrong.
The primary colours of the additive model are red, green and blue. With
three light sources in these colours, you can mix nearly every other
colour a human can perceive. Because the human eye responds to these
three colours the strongest, they most closely resemble the real model.
Mixing these three colours results in white, while the absence of them
is black.
The primary colours of the subtractive model are magenta, cyan and
yellow. Absence of these is white, presence of all three is white. They
are used in printing, because the base of printing is a white ground,
and because printed colour dots don't emit light, unlike CRT/LCD pixels.
> Floating point RGB colours often have a range of intensities per color between 0 and 1, yet if
> I look at the sun I can burn my eyes. IOW what do those numbers actually
> represent in terms of the physical phenomenon of light.
>
Ah, that's an interesting question. In terms of the physical phenomenon,
the answer is, "not much". The answer is found in engineering: 0 means
nothing, while 1 means the brightest light the output device is capable
of emitting (under its current brightness configuration).
> IOW surely the goal is to try to model the physical phenomenon in the best
> possible way given a set of constraints imposed by hardware and software.
>
What do you mean now, the goal of the library or the goal of computer
engineering?
In terms of computer engineering, well, they actually achieved the
physical model ;)
In terms of the library, I disagree. The library should model not the
physical concept of colour, because that is tricky to define, hard to
understand, and complicated to work with. A library doing that might be
nice for exact scientific simulation, but useless in every other
discipline concerned with colour.
Rather, the library should most closely model colour as it is used in
computing, i.e. be capable of representing the various colour models in
use (RGB, CMYK, HSV, ...) and providing access to all these, while
allowing transparent use in cases where I don't care about them,
allowing conversion between the various models, etc.

It should be noted that GIL, at the moment, provides no proper concept
of colour at all! It only provides the concept of a colour space, which
is very close but not the same. The colour space defines the way in
which pixels express their colour.
But GIL does not have the concept of a colour independent of a pixel. In
other words, it provides no way to express, for example, that the user
has now chosen red as the colour of his drawing tool. Sure, you can make
this very easily: either just misuse a single pixel for it (physical
representation of the two is the same) or create a small class
effectively copying it.
Still, it might be called a mistake in the concept foundation of the
library that the independent concept of Colour is missing.

Sebastian Redl


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk