colour correction for iphone

colour correction for iphone

Of course, one of the reasons (but by far not the only one) that the iphone has been so successful is the quality of the camera that is built in. It was certainly one of the features that made me switch from Nokia about 3 years ago after more than 15 years of loyalty to the swedish brand. So I was interested to read recently that the next iphone may feature advanced colour correction methods and promises to be even better than its predecessors. You can read about the story here.

Colour correction is necessary because different cameras use different RGB primaries and because the activation of the RGB sensors when taking an image depend upon the quantity and quality of the ambient illumination. So, for example, imagine the light was very very red, then the R channel of the camera would be more strongly activated than if the light was whiter. However, our visual systems are able to compensate for this so that most of the time we don’t notice objects changing colour when we move from one room to another or from inside to outside. Colour correction is inspired by human colour constancy and attempt to correct the images so that the objects in the scene would retain their daylight appearance. However, colour correction is difficult; that is, it is very difficult to get it right all of the time. One frustration I have is taking a photo of my band (I play drums in a covers band) under very colourful lighting. Often the images are very disappointing and lack the intensity of the original scene. That is because, human colour constancy is only partial and under extreme lighting things really do change colour markedly – such as under our intense LED stage lighting. In these cases I think sometimes the automatic colour correction is actually too much and I have found that I have to modify the images I capture on my mac to try to recreate what I think the original scene looked like. So auto colour correction – the state of the art – is certainly not perfect. Let’s hope this story about an advance made by Apple is true.

race for colour

Over the summer I was asked to take part in a BBC documentary about the recent discovery of the first colour movie film that was fond at the National Media Museum (Bradford). I met the presenter Antonia Quirke (who was very nice) and we filmed for half a day. In the end only a few minutes of our footage made the final cut. Still it was nice to be on TV and BBC1 at that!! For further details see here.

Race for colour

The films were made by a young British photographer and inventor called Edward Turner, a pioneer who can now lay claim to being the father of moving colour film, well before the pioneers of Technicolor.

The footage will be shown to the public from 13 September at the museum in Bradford. And a BBC documentary, The Race for Colour, will be broadcast on 17 September in the Yorkshire and south-east regions on BBC1. I will feature in the film for a minute or two. Exciting.

For further details see the story in the Guardian.

colour management for beginners

Colour displays are now affordable and enjoyed by consumers at work, at home, on mobile displays and in cinemas. Consumers often take it for granted that there is good colour fidelity as images are transferred between different devices. So, for example, a red object in an image appears to be approximately the same red when the image is displayed on different computer displays, when it is printed, and when it is viewed on a mobile phone.

This colour fidelity is not easy to achieve. Different devices use very different technology to display colour images. For example, a computer display will mix together light from three primaries (red, green and blue) to generate a range (gamut) of colours. On the other hand, a printer uses completely different technology and typically uses mixtures of cyan, magenta, yellow and black inks to create the gamut of colours. Even computer monitors use a variety of different technologies (from CRT displays, which are becoming obsolete, to LCD, LED, and plasma technologies) each of which may use quite different red, green and blue primaries. Colour management is required to compensate for differences between the technologies (colour primaries, colour mixing, colour gamuts) between different image-display devices. This necessitates that the companies that produce image-display devices must cooperate so that the devices are able to talk to each other; this is achieved through the International Color Consortium (ICC) . The ICC is an industry consortium that was established in 1993 by eight industry vendors (including Microsoft and Apple). Today approximately 70 companies are members of the ICC whose goals are to “create, promote and encourage evolution of an open, vendor-neutral, cross-platform colour management system architecture and components”. The ICC system is implemented in terms of device profiles and colour management system. The device profile is a computer file that is associated with each device (printer, camera, monitor, etc.) that essentially contains information to allow colour to be managed. In the case of a computer monitor, for example, the device profile would include information about the monitor’s primaries that would allow the colour image to be adjusted to compensate for the properties of the monitor so that the colours are displayed correctly. The colour management system is software that manages how these device profiles interact with each other and is normally part of the operating system of the computer.

Thus, when users capture, view, or print images they are using colour management all the time even though they may be unaware of it. Though this level of colour management is built into software and device drivers and is broadly invisible to the user it does enable colour consistency for images when they are captured, viewed and printed throughout the world. However, this level of default colour management is far from perfect. It does not, for example, generally account for changes in settings for a device (for example, a user may change the contrast, brightness, or colour temperature of a display) so that colour fidelity is, in practice, only approximate. This level of colour fidelity is probably sufficient to satisfy about 90% or more of consumers for whom colour is not a critical issue. However, for professionals working in industries where colour is a major concern (e.g. design, retailing) a higher level of colour management is often required. For these users, it is possible to obtain systems (typically low-cost colour-measurement devices and associated software) that allow a user-defined profile to be generated for a particular device with particular settings. This user-defined profile then over-rides the default profile and should enable a better level of colour fidelity to be achieved. Nevertheless, colour fidelity is always likely to be an imperfect issue. It is difficult for colour-management systems to perfectly compensate for the fact that, for example, different devices may generate quite different colour gamuts (typically, the bright red on a computer screen cannot be achieved by a CMYK consumer-level printer).

For ICC see http://www.color.org

RYB primaries

There are two phrases I keep seeing written down all over the internet that cause my blood pressure to increase.

The first is that the colour primaries are red, yellow and blue (RYB). And the second is that the primaries are colours that cannot be made by mixing other colours. Neither of these statements are true, of course.

The first statement makes no distinction between additive colour mixing (of lights) and subtractive colour mixing (of paints and inks) but subtractive colour mixing is normally implied. However, RYB is a relatively poor choice for three colour primaries. The range of colours that can be produced is actually quite small. For most painters and artists it doesn’t matter because very few work in just three primaries – if they did so they would probably be frustrated by the small gamut of colours achievable. Many artists (painters) will use 10 or more basic colours to mix their palette. However, there is a group of people who care passionately about the gamut of colours that can be obtained by mixing three colour primaries – that is the people who work for companies such as HP and Canon. These companies make CMYK printers for the consumer market and their jobs depend upon consumers liking their printers. They understand that the largest gamut (in subtractive mixing) can be obtained if the primaries are cyan, magenta and yellow (CMY). The teaching of RYB as the (subtractive) primaries should be stopped. It’s already gone on for far too long.

One reason I don’t like the teaching of RYB as being the subtractive primaries, in addition to the fact that it is wrong, is that it confuses people who are trying to learn colour theory. This is because red, yellow and blue seem to be quite pure colours and this encourages people to hold the second belief I don’t like which is that the primaries are pure colours that cannot be mixed from other colours. If people understood that the primaries were CMY it would be less tempting to hold this belief about the purity of the primaries. Of course, if you make a palette of colours of three primaries then it is true that no mixture of two or more colours from that palette can match any of the primaries. However, there are other colours (that are outside the gamut of the primary system) that could be mixed together to match the primaries. This false notion of purity confuses the real issue – that is, that the subtractive primaries are cyan, magenta and yellow because the additive primaries are red, green and blue. Look at this picture below:

The additive primaries are red, green and blue and the secondaries are cyan, magenta and yellow. Correspondingly, the subtractive primaries are cyan, magenta and yellow and the subtractive secondaries are red, green and blue. Simple.

I wrote about this before so for a slightly different perspective see my earlier post.

Perhaps I am so agitated about it today because I am just watching England getting trounced by Ireland at rugby when the Grand Slam was so tantalisingly close. Or maybe I will feel just the same tomorrow.

How many colours are there?

I sometimes begin a series of student lectures on colour with the question – how many colours are there? At least one student always answers: three! In fact, this week in my lecture when I asked this question the first three or four answers were all three.

I can see where the idea of three comes from since the number three is ubiquitous in colour. We have three different classes of cones in the retina of our eyeballs – each with maximum sensitivity at a different wavelength. As a direct consequence of this trichromacy we use colour monitors with three primaries (RGB), colour printers with three primaries (CMY – ok, sometimes black as well but there’s a good reason for that), and there is a misconception that there are three primary colours from whose mixtures it is possible to make every other colour – see http://colourware.wordpress.com/2009/07/08/what-is-a-colour-primary/

I think that the number of colours that we can see is about 10 million; maybe less, but certainly millions. However, there are arguments that the true number may be much greater than this. See, for example, Mark Fairchild’s article – http://www.cis.rit.edu/fairchild/WhyIsColor/files/ExamplePage.pdf.

However, even the people thinking about colour mixing and three primaries must surely be aware that they have seen more than three colours. Indeed, were probably wearing more than three colours! So why do they respond with three? Well, it could be that they misunderstand the question and think I am asking about primaries (perhaps because they think the real question I am asking is too hard and nobody in their right mind would ask it). Or it could be that they equate the word colour with physical colorants. One of the most interesting – but also frustrating – things in field is that even the name of the field – colour - means different things to different people. Is colour something physical? Is it something you experience? Or is it simply whether something is red, yellow or blue etc; in other words, another term for what I would call hue?

This probably explains why we find the following text on this webpage – http://english.kompas.com/read/xml/2009/10/29/06125368/The.Shrimps.That.Can.See.in.Twelve.Colors:

A juvenile Mantis shrimp. These shrimps have the most complex vision systems known to science. Special light-sensitive cells allow them to distinguish between different types of polarized light, and they can see 12 colors (compared to three for humans) ranging into the near-ultra violet to infra-red parts of the electromagnetic spectrum.

It literally says that shrimps see 12 colours whereas, elsewhere on the page, it says that humans see 3 colours.  Despite this irritating lack of precision in the writing the article is quite interesting and describes the surprisingly complex nature of shrimp colour vision.

chromaticity diagram and RGB gamut

You may well have seen a typical diagram showing the chromaticity diagram and the gamut of an RGB monitor. The gamut is a triangle, of course, with the vertices formed by the chromaticities of the RGB primaries. See, for example, http://colourware.wordpress.com/2009/10/04/subtractive-mixing-why-not-rgb/.

However, that triangle is a little misleading. One problem is that we are only looking at the maximum chromaticities available – this does not imply that all of these chromaticities are available at every luminance level. Take the very vertices of the triangle – these occur for the RGB values [255 0 0], [0 255 0] and [0 0 255]. The luminance of the pure red [255 0 0]  might be 27 cd/m2, of the pure green [0 255 0] 56 cd/m2, and of the pure blue [0 0 255]  might be 6 cd/m2. (These are luminance values for a typical RGB monitor – your monitor will vary a little from this and depending upon your settings.) This means that the chromaticities of the points of the triangular gamut are only available at these respective luminance levels.

For the monitor just described the maximum luminance would be obtained when RGB = [255 255 255] and the luminance of this white would be 89 cd/m2. So for very high luminances the gamut is tiny since to achieve these high luminance values you need to have all three RGB guns firing and hence by definition the colour is going to be very desaturated.

For the typical monitor described above I have calculated the gamut of colours available at three luminance levels: 10 cd/m2, 40 cd/m2 and 70 cd/m2. I have plotted these below and coloured bright red the chromaticities that cannot be obtained at that luminance. So, for example, at 10 cd/m2 you can obtain most chromaticities but not the pure blue. The reason for this is the pure blue [0 0 255] would be only 6  cd/m2 - to get 10 cd/m2 you need to add a little red or green and this desaturates the blue.

At 40 cd/m2 you can obtain a much smaller gamut and at 70 cd/m2 the gamut obtainable is very limited. To get such high luminances on this typical RGB monitor you would need high R and G values and that gives you yellows and yellowish whites.

The point of all this is that gamuts are three dimensional and looking at the gamuts in a 2-D chromaticity diagram can be very misleading.

chrom10

 

 

 

 

 

chrom40

 

 

 

 

 

chrom70

subtractive mixing – why not RGB?

In a previous post I spoke about the difference between additive and subtractive mixing and why the additive primaries are red, green and blue or RGB for short – http://colourware.wordpress.com/2009/07/13/additive-colour-mixing/

The chromaticity diagram – see http://colourware.wordpress.com/2009/09/28/colourchat-audiovisual-guide-to-the-chromaticity-diagram/ - has a very useful property. If you plot the chromaticities of two lights, then the straight line that joins the two points on the chromaticity diagram show you the additive mixtures that can be obtained by mixing together the two lights. If we take three lights, then the additive mixtures that can be obtained are defined by the triangle that is formed if the chromaticities are the vertices of the triangle. Ok – that’s a bit of a mouthful so let’s have a practical example. The triangle in the diagram below shows the gamut that can be achieved when we have three additive primaries that are positioned at the corners of the triangle.

rgb_gamut

 From this diagram it should become obvious why the additive primaries are RGB. Say, we chose, two reds and a cyan as the three additive primaries – well, the triangle would be tiny. In other words, the gamut would not be very big. The biggest triangle in the chromaticity is one whose vertices are formed by a red, a green and a blue. WhichRGB will give the biggest triangle? I don’t know – it’s been something that has been puzzling me for the last few days and I’ll come back to this in a later post. But certainly any RGB triangle is pretty large as long as the red, green and blue primaries chosen are reasonably saturated.

So what happens if we choose RGB as the subtractive primaries? Subtractive colour mixing describes how inks and paints mix together to form colours. The first thing to point out is that subtractive colour mixing is not additive and linear – you remember I said that when you mix two lights together the colour mixtures all fall on the straight line that joins the  two points in the chromaticity diagram that represent the two lights? Well, this is only true for additive colour mixing. So to work out the gamut for subtractive systems is not an easy thing to do. However, if you do select the three subtractive primaries as RGB you’ll get a gamut that looks something like this:

rgb_subgamut

Notice that the gamut is concave. Mixing red and green lights produces a nice yellow. You can test this by going into your colour-picker in software such as Photoshop or Powerpoint and setting the RGB values to be 255:255:0. You’ll get a nice yellow. But mixing red and green paints – it will give you a similar hue to yellow but you’ll get something quite desaurated; most likely you’ll get a brown. So using RGB as the subtractive primaries would not be a very good thing at all.

It turns out that additive and subtractive colour mixing are very related. The best subtractive primaries are the ones that control the amount of red, green and blue light reflected. A yellow dye applied to textiles, for example, mainly absorbs short wavelengths in the blue section of the spectrum, allowing the other wavelengths to be reflected by the textile. The “other wavelengths” that are reflected give yellow. But the important point is that the yellow dye absorbs blue. Similarly, a magenta dye absorbs green and a cyan dye absorbs red. This leads to the idea of the optimal subtractive primaries being those that are cyan, magenta and yellow or CMY. This leads to a gamut somewhat like this:

cmy_gamut

The biggest gamut for subtractive mixing is obtained by using CMY as the primaries. But weren’t you taught at school that the subtractive primaries are red, blue and yellow? Almost certainly you were – and this is because it is accepted dogma at most art colleges and in many art and design textbooks. But it is quite easy to show that the optimal primaries – those giving the largest gamut – are CMY not RBY. If you were building a colour-reproduction system using only three colours such as a printer you would come to the conclusion - as companies such as HP, Xerox, and Epson have done – that you get the largest colour range with CMY. So why has it become commonplace for artists to refer to red, yellow and blue as the primaries? Could it be a colour naming and language issue – that they really mean cyan when they say blue and it’s just a naming error. Possible, but not likely in my opinion.  I think it is more likely that most artists are not overly concerned that RYB gives a smaller gamut than CMY because they rarely restrict themselves to three primaries. An artist would typically use 6 or more primaries. For example, they might use two blues (one that is reddish and one that is greenish), two reds (one that is yellowish and one that is bluish) and two yellows (one that is greenish and one that is reddish) in order to easily be able to mix a wide range of colours. The (mis-)identification of RYB as the subtractive primaries has much to do with colour wheels. I like to keep each of these blog posts reasonably concise – if I start writing about the problems of colour wheels now I will be writing for another 2 hours. And it’s nearly midnight now so colour wheels will need to wait for another day!

What is a colour space?

In my job I probably use the phrase “colour space” every day and have done for the last 20 years. So imagine my surprise when I was talking with a colleague recently and after a few minutes he said “Can I stop you for a second there Steve – when you say colour space, what exactly do you mean?”.

A colour space is like a map. A map of New York, for example, shows the location of various landmarks with reference to the xy coordinates (the position in horizontal x and vertical y units on the map). A colour space or colour map does the same thing with colours. Perhaps the simplest colour space is the spectrum, see below:
 myspectrum

As we look from right to left on the spectrum the wavelengths changes from around 700nm on the far left to about 400nm on the far right. So this map shows colour with reference to wavelength. Although it is a commonly used colour space it is limited because it only really describes how hue changes with wavelength. Hue is only one of three ways in which colour can change or vary.

The most well-known really useful colour space then is the CIE chromaticity diagram – see below.

chromdiagram

The CIE chromaticity diagram shows colours arranged on a 2-D plane. We can easily refer to any colour by how far from the left it is (the x coordinate) and how far from the bottom it is (the y coordinate). This space only shows two of the dimensions of colour; the hues are arranged in a somewhat circular way and the colourfulness increases as we move outwards from the white point (a position near to the centre of the diagram). However, we can also consider the third component of colour (brightness) if we imagine a dimension coming out of the page towards you (http://colourware.wordpress.com/2009/07/18/cie-system-of-colorimetry/). The CIE defines several different colour spaces; the CIELAB colour space, for example, is another 3-D space that defines a colour by its L*, a* and b* values.

It is useful to think of an image-display device as also having a colour space. Consider the display on which you are probably reading this blog. The display shows colour by changing the amount of the red, green and blue light emitted at each point on the screen. The diagram below is a representation of what the RGB colour space of your display device may look like.

 

rgb

In the RGB cube, black is in the bottom left. As the RGB values increase colours are created and white results from each of the RGB primaries at full strength. So the RGB colour space defines the relationship between RGB values and colour. However, here’s the really interesting thing: The colour space for different display devices is very different. Even if we take a single device – such as the one that you are reading this blog on – then as we change settings (the brightness, the contrast, the gamma, the colour temperature, etc.) then the colour space changes. That is, the relationship between RGB and colour changes as you change those settings. This is a huge problem. Imagine if there were many maps of New York and each showed the position of, say, the Empire State Building to be in a different position. How confusing would that be? Well, that’s the problem with colour-display technology. If we didn’t do anything about this problem then every time we looked at a colour image on a different display device the colours could change markedly. This is why we need colour management. Colour management can make compensations to the RGB values that are sent to each display device so that the colours always appear the same (well, nearly the same). To make this compensation the colour management software (which is embedded in your Windows or Apple operating system) needs to know about the colour space of each device connected to the computer. Each device needs to have a profile that describes the relationship of its own colour space with respect to some standard colour space. 

How good is colour management? Well, that depends upon many factors. Most printers, cameras, scanners, and screens (LCD, CRT, etc.) come with a driver that includes a crude colour profile. This ensures that there is a basic level of colour management and for a great majority of users this is more than adequate. However, if you want better performance then you need to think about making some measurements that will allow a more accurate colour profile to be built. In a recent blog I described a new device that you can buy to enable you to do this – http://colourware.wordpress.com/2009/07/29/colormunki-colour-management/. There are many such devices on the market. I highly recommend Andrew Rodney’s book Color Management for Photographers which is both clear and accurate (though the edition I have works on Adobe’s CS2 package whereas the latest package is CS4).

514PWPFTKXL__BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU02_

However, no matter how hard you try, colour management is never likely to be perfect. This is because different devices have different colour gamuts; a printer is likely to be able to display some colours that your display physically cannot and vice versa.

colour picker pen design

color_picking03-thumb-550x422-22308

The idea is that you can use this pen to point at any object in the world, the pen then ‘extracts’ the colour, and then is able to write in that colour using a mixture of RGB inks that it contains.

Unfortunately, it’s just a concept, designed by Jinsu Park.

color_picking02color_picking01-THUMB

As far as I know there are no practical implementations of this interesting idea. One could make a strong argument that the pen should use CMY (or even red, yellow and blue) primaries since RGB primaries would result in a tiny colour gamut and wouldn’t allow the pen to reproduce any real colours at all. See http://colourware.wordpress.com/2009/07/08/what-is-a-colour-primary/