IMAGINE A light source, which can automatically match the color of ambient light.
So many times I've taken interior photos, with the room illuminated by tungsten lighting; however, some light comes through the windows, but that looks strongly blue and so harms the photo. For my best work, I adjust the color of the window lighting and the artificial lighting separately in Photoshop, but this is time-consuming and error-prone. Big-budget cinematographers will put colored gels over the windows to get the light colors to match, or they will put gels over their lights. But the use of gels has the unfortunate side-effect of decreasing the light intensity, requiring even brighter and hotter light sources, much to the dismay of the actors.
Rift Labs is developing a three-color lighting panel which has variable color temperature. Using low-power, three-color light-emitting diodes, their forthcoming light panels will automatically be able to match any lighting situation. Or, any color of light can be dialed-in, and the brightness of the lighting does not change.
So photographers and cinematographers can have a portable, battery-operated, low-cost lighting system which can quickly and conveniently produce the color of lighting needed. A good use of this would likely be for fill-in lighting, an augment to ambient lighting. Portable, battery-operated white-light LED panels have appeared in the last couple of years, causing much excitement, but Rift is taking this to the next level.
The organization is making these lighting units open-source, and provide the circuit diagrams and controller software free of charge; if their concept proves usable, we ought to see many similar designs produced at low cost in the near future.
I noticed that they are having trouble finding the correct method of producing a uniform illuminance under a change of color temperature. This is likely to be problematic for them, since the sensitivity of digital cameras to various color temperature conditions is variable across manufacturers and models of cameras. See here. They may need to adapt their system to include color calibration data specific to particular kinds of cameras. Likely this will merely require a custom color transfer matrix — nine numbers — that will provide closer mapping between what the camera sees and what the light source delivers. This color matrix could either be encoded as a camera model database in the device firmware, or the user could type in the numbers if they know them. A more clever method could be a built-in algorithm for color calibrating the camera: this little feature could be a strong selling point.
I also wonder about the color quality produced by this kind of unit. Since it uses only three colors — red, green, and blue — it may not operate equally well under all color gamuts used by digital cameras. Please recall that it is impossible to mix all possible colors from only three primary colors. However, if they concentrate on getting sRGB right, then this unit ought to operate well for 99% of uses. But there will still be metamerism problems: colors that look identical to the human eye will look different to the camera, and this kind of three-color lighting will make metamerism failure even more prominent. They may find they get better performance if they also include some other colors in their LED array to provide a more uniform spectrum.
This kind of lighting could be of great benefit for those who shoot RAW. Digital cameras have a fixed white balance: this raw data is processed to produce images correctly balanced according to the color of the light. However, lots of the RAW data is thrown away during this processing, which leads to increased digital noise, particularly in the red and blue channels. The Rift Labs product can be adjusted to produce a magenta light which will accurately produce an accurate RAW light balance: no data is thrown away, and the noise level is reduced to its practical minimum. This is likely only of interest to specialists, but it does show how useful this device can be.
UPDATE: Click here to read an article on color rendition under LED lamps. You may expect color shifts with using these kinds of products.
Thursday, July 7, 2011
Friday, July 1, 2011
Contrast, part 1: Black and White
A FRIEND ASKS, “What is contrast?”
Simply, contrast in photography is what differentiates one thing from another because of differences in tone. A contrasty image will have lots of black and white tones, while a low-contrast image will have lots of medium gray.
The English word ‘contrast’ comes from the Latin contrastare, meaning ‘stand against’, and so in a contrasty image, some elements will strongly stand against others, instead of blending together.
Here is a more-or-less visually uniform grayscale image that I'll be using as the basis for examples:

It goes from black on the left, to white on the right. I threw in a little bit of noise to illustrate my examples better. I used this contrived image instead of a real photograph in order to more accurately show what is going on. Please don't get too bored with this repetition.
Here is this grayscale's histogram in Photoshop:

The grayscale illustrate how many pixels are in each range of tone; with black pixels on the far left, and white pixels on the far right. The noise adds lots of jitter to this histogram, but please note that it is otherwise fairly uniform going across; on average, there is just as much black as there is white, and just as much middle gray as either of those.
Photographically, we can use the word contrast in various ways. Global contrast — which is what we are mainly concerned with here — tells us how the total range of tones are divided up in an image; how much strong black and strong white are found in an image? Since our example image is uniform, we can say this has neutral global contrast.
Here I use the Brightness/Contrast tool in Photoshop:

I made this image with this Photoshop setting:

Setting the slider to 100 contrast gives us simultaneously more dark and more light tones, at the expense of midtones. Take a look at the histogram: we have more pixels at the far left and right.
Setting the slider to -50 gives us low contrast:

Now notice how we have more midtones, at the expense of fewer dark and light pixels. The histogram shows the pixels more clumped together in the middle:

Here are all three together:

High contrast on top; low contrast on bottom.
Now I don't normally use the Brightness/Contrast tool, since I can get more control over the final results when I use the Curves tool.
Here I apply Curves to make the image appear to be basically the same as the Brightness/Contrast 100% setting:

Note that the histogram looks pretty much the same. But also notice that the curve is a bit complex:

Here is how we interpret the curves:

Now let us define a new term, ‘differential contrast’. Take a look at the curve above: notice how it is steeper at the midpoint, and less steep at the endpoints of black and white? If you were climbing a hill with that slope, you would likely have the most difficulty in the midsection, where the curve is steeper. What this means is that there is more differentiation in the midtones; visually they appear more distinct from each other. Also note that there is less differentiation between the various dark tones and the light tones.
Whenever we get more differential contrast in one range of tones, inevitably we will get less differential contrast in other range of tones. As a photographer with Photoshop, you have control over adjusting which range of tones get the greatest differential contrast. You ought to consider adding differential contrast to those most important tones in your image, by making sure that the steepest part of your curve extends over that range of tones. But this can only be done by sacrificing other ranges of tones.
From what we can see with the curve above, it is apparent that the standard Photoshop Contrast tool adds differential contrast to midtones, at the expense of both shadows and highlights.
If we adjust the curve so that the line is steepest at the endpoints, and less steep in the middle, then we will get a low contrast image; it will have greater differential contrast in the shadows and highlights at the expense of the midtones. The overall global contrast will be less because we will have less dark and less light, with a lot more middle gray.
From our little experiments here, we can see that the Photoshop Contrast tool is a bit like Curves, but only where the endpoints and middle are fixed. We don't have to keep our endpoints fixed in Curves. For example, I can get much lower contrast in Curves:

This image does not go from pure black to pure white, rather, its range is significantly reduced.

Note that the histogram does not go all the way to the edges; indeed we are using only half of the dynamic range available. In our curve, 100% white is transformed to only 75% white, and likewise for black. Our total global contrast has been reduced greatly. But unlike the curved curve shown above, the differential contrast between tones is the same across all tones, since our curve is straight here.
If we make the curve completely horizontal, we lose all contrast:


Our histogram is now simply a spike at middle gray. Our image has no contrast whatsoever.
If we make the curve vertical, we get maximal contrast:

Please note that I added some noise in the image to simulate texture.

Actually Photoshop does not let us make a true vertical line, but this is pretty close. On the histogram, we have spikes at pure black on the left and pure white on the right. We have lots of differential contrast at the middle gray, with none for darker and lighter tones.
Take a look at the data found in the Histogram boxes in the images above. Note that in all cases, the Mean value is close to 127.5, which is medium gray. We did not change the overall brightness of the image with our adjustments. The next value, ‘Std Dev’ (or Standard Deviation) is a measure of how much the pixel values deviate from the mean. A large standard deviation is high contrast, while a low standard deviation indicates low contrast.
One of the great powers of Curves is that we can increase or decrease differential contrast in whatever range of tones we desire. In our examples above, the middle point is always fixed, and so differential contrast is adjusted only for the midtones. With Curves, we can adjust the contrast in the highlights:

Note that here we have greater distinction in the brightest tones in the image (you can see lots of my added noise there), and we have essentially created a low-key image.

But this distinction in the highlights comes at the expense of losing lots of our shadow detail. The tall spike at the leftmost part of the histogram unfortunately does not give us a good impression of how much of the image is lost in black without significant texture: roughly 40% of the pixels are pure black.
We can also increase visual detail in the shadows at the expense of the highlights:

We now have a high-key image.

Here our curve and histogram are reverse of what we had before, and 40% of our highlight detail is lost as pure white.
OK, let's try these techniques with a real image. This is a low-contrast, dim, black and white image of a monument found in Sylvan Springs Park, in Saint Louis County, Missouri, USA.

Bleh. Looks poor, and here is its histogram:

Most of the image's pixels are on the dark side of the histogram. Unless this is an exercise in conceptual art, most photo editors at magazines would reject this image: most would probably like to see a broad histogram, with significant contrast and a full range of tones from black to white.
Merely using the Contrast tool in Photoshop does not help:


However, boosting the brightness here would help a lot.
Instead, I will adjust the image using curves. First I put in an initial curve, which will expand the range of the significant part of the image:

Straight line curves are equivalent to using the Levels tool in Photoshop.
Then I add a strong curve to the most significant part of the image, which I think are the tones around the carved lettering:

The steepest part of the curve, and therefore the greatest amount of differential contrast can now be found at the tones surrounding the text “1939”. I don't care to see texture in the darkest part of the grass or in the shadows between the rocks; I think that overexposing the patch to the left of “Sylvan” is also acceptable.

I added some sharpening, and the photo is basically complete.
Sharpening is a kind of local contrast enhancement, which is a powerful technique for improving images; but that is for another day.
Adding contrast — and using curves — in a color image is far more problematic, since we can easily change the hues of our colors. That is also a topic for later.
Simply, contrast in photography is what differentiates one thing from another because of differences in tone. A contrasty image will have lots of black and white tones, while a low-contrast image will have lots of medium gray.
The English word ‘contrast’ comes from the Latin contrastare, meaning ‘stand against’, and so in a contrasty image, some elements will strongly stand against others, instead of blending together.
Here is a more-or-less visually uniform grayscale image that I'll be using as the basis for examples:
It goes from black on the left, to white on the right. I threw in a little bit of noise to illustrate my examples better. I used this contrived image instead of a real photograph in order to more accurately show what is going on. Please don't get too bored with this repetition.
Here is this grayscale's histogram in Photoshop:
The grayscale illustrate how many pixels are in each range of tone; with black pixels on the far left, and white pixels on the far right. The noise adds lots of jitter to this histogram, but please note that it is otherwise fairly uniform going across; on average, there is just as much black as there is white, and just as much middle gray as either of those.
Photographically, we can use the word contrast in various ways. Global contrast — which is what we are mainly concerned with here — tells us how the total range of tones are divided up in an image; how much strong black and strong white are found in an image? Since our example image is uniform, we can say this has neutral global contrast.
Here I use the Brightness/Contrast tool in Photoshop:
I made this image with this Photoshop setting:
Setting the slider to 100 contrast gives us simultaneously more dark and more light tones, at the expense of midtones. Take a look at the histogram: we have more pixels at the far left and right.
Setting the slider to -50 gives us low contrast:
Now notice how we have more midtones, at the expense of fewer dark and light pixels. The histogram shows the pixels more clumped together in the middle:
Here are all three together:
High contrast on top; low contrast on bottom.
Now I don't normally use the Brightness/Contrast tool, since I can get more control over the final results when I use the Curves tool.
Here I apply Curves to make the image appear to be basically the same as the Brightness/Contrast 100% setting:
Note that the histogram looks pretty much the same. But also notice that the curve is a bit complex:
Here is how we interpret the curves:
- The bottom axis shows us the tones of our original image; while the vertical axis shows us which tones are changed by Curves.
- Note there is a diagonal line going from the lower left to upper right; any time the curve touches this line, that means that the corresponding tones are not changed. In our example here, pure white, black, and middle gray are not changed. Whatever is white, black, or middle gray in the original image will remain unchanged in the final image.
- Whenever the curve drops below the diagonal line, that means the tones are brightened. Whenever the curve raises above the line, those tones are darkened. In this example, the light tones between middle gray and white become brighter, while the dark tones between middle gray and black become darker. The image has greater global contrast, because we simultaneously get more darks and more brights.
- In this curve, 70% white in the original image becomes 80% white in the final image; likewise 30% white (= 70% black) becomes 20% white (or 80% black). 0%, 50%, and 100% remain unchanged.
Now let us define a new term, ‘differential contrast’. Take a look at the curve above: notice how it is steeper at the midpoint, and less steep at the endpoints of black and white? If you were climbing a hill with that slope, you would likely have the most difficulty in the midsection, where the curve is steeper. What this means is that there is more differentiation in the midtones; visually they appear more distinct from each other. Also note that there is less differentiation between the various dark tones and the light tones.
Whenever we get more differential contrast in one range of tones, inevitably we will get less differential contrast in other range of tones. As a photographer with Photoshop, you have control over adjusting which range of tones get the greatest differential contrast. You ought to consider adding differential contrast to those most important tones in your image, by making sure that the steepest part of your curve extends over that range of tones. But this can only be done by sacrificing other ranges of tones.
From what we can see with the curve above, it is apparent that the standard Photoshop Contrast tool adds differential contrast to midtones, at the expense of both shadows and highlights.
If we adjust the curve so that the line is steepest at the endpoints, and less steep in the middle, then we will get a low contrast image; it will have greater differential contrast in the shadows and highlights at the expense of the midtones. The overall global contrast will be less because we will have less dark and less light, with a lot more middle gray.
From our little experiments here, we can see that the Photoshop Contrast tool is a bit like Curves, but only where the endpoints and middle are fixed. We don't have to keep our endpoints fixed in Curves. For example, I can get much lower contrast in Curves:
This image does not go from pure black to pure white, rather, its range is significantly reduced.
Note that the histogram does not go all the way to the edges; indeed we are using only half of the dynamic range available. In our curve, 100% white is transformed to only 75% white, and likewise for black. Our total global contrast has been reduced greatly. But unlike the curved curve shown above, the differential contrast between tones is the same across all tones, since our curve is straight here.
If we make the curve completely horizontal, we lose all contrast:
Our histogram is now simply a spike at middle gray. Our image has no contrast whatsoever.
If we make the curve vertical, we get maximal contrast:
Please note that I added some noise in the image to simulate texture.
Actually Photoshop does not let us make a true vertical line, but this is pretty close. On the histogram, we have spikes at pure black on the left and pure white on the right. We have lots of differential contrast at the middle gray, with none for darker and lighter tones.
Take a look at the data found in the Histogram boxes in the images above. Note that in all cases, the Mean value is close to 127.5, which is medium gray. We did not change the overall brightness of the image with our adjustments. The next value, ‘Std Dev’ (or Standard Deviation) is a measure of how much the pixel values deviate from the mean. A large standard deviation is high contrast, while a low standard deviation indicates low contrast.
One of the great powers of Curves is that we can increase or decrease differential contrast in whatever range of tones we desire. In our examples above, the middle point is always fixed, and so differential contrast is adjusted only for the midtones. With Curves, we can adjust the contrast in the highlights:
Note that here we have greater distinction in the brightest tones in the image (you can see lots of my added noise there), and we have essentially created a low-key image.
But this distinction in the highlights comes at the expense of losing lots of our shadow detail. The tall spike at the leftmost part of the histogram unfortunately does not give us a good impression of how much of the image is lost in black without significant texture: roughly 40% of the pixels are pure black.
We can also increase visual detail in the shadows at the expense of the highlights:
We now have a high-key image.
Here our curve and histogram are reverse of what we had before, and 40% of our highlight detail is lost as pure white.
OK, let's try these techniques with a real image. This is a low-contrast, dim, black and white image of a monument found in Sylvan Springs Park, in Saint Louis County, Missouri, USA.
Bleh. Looks poor, and here is its histogram:
Most of the image's pixels are on the dark side of the histogram. Unless this is an exercise in conceptual art, most photo editors at magazines would reject this image: most would probably like to see a broad histogram, with significant contrast and a full range of tones from black to white.
Merely using the Contrast tool in Photoshop does not help:
However, boosting the brightness here would help a lot.
Instead, I will adjust the image using curves. First I put in an initial curve, which will expand the range of the significant part of the image:
Straight line curves are equivalent to using the Levels tool in Photoshop.
Then I add a strong curve to the most significant part of the image, which I think are the tones around the carved lettering:
The steepest part of the curve, and therefore the greatest amount of differential contrast can now be found at the tones surrounding the text “1939”. I don't care to see texture in the darkest part of the grass or in the shadows between the rocks; I think that overexposing the patch to the left of “Sylvan” is also acceptable.
I added some sharpening, and the photo is basically complete.
Sharpening is a kind of local contrast enhancement, which is a powerful technique for improving images; but that is for another day.
Adding contrast — and using curves — in a color image is far more problematic, since we can easily change the hues of our colors. That is also a topic for later.
Monday, June 20, 2011
Examples of Color Mixing
I PURCHASED ADOBE Photoshop CS3 a number of years ago for one and only one reason: color management.
I was the owner of a Minolta Dimage 7 camera, and was greatly disappointed in its photos. Naturally, I blamed the camera and had huge buyer's remorse. One of the many problems was that the camera took photos in a non-standard colorspace. According to the camera review linked above:
Then at Christmas 2006, I received a copy of Adobe Photoshop Elements. By that time I had already purchased a newer, somewhat inferior camera, but it produced great images right out of the box. But I tried using the Adobe Camera RAW software in Elements to process my old Dimage photos — and behold! — they looked great. The Adobe software knew all about the Dimage color space problem and correctly converted my images to the Web standard sRGB colorspace, and solved other problems too. By the next summer, I upgraded to Photoshop CS3 to gain access to the more advanced features in Adobe Camera RAW.
To the left is a typical JPEG image I got from the Dimage. On the right is an image I shot in RAW and processed with ACR.
So I was a new owner of Photoshop. But I didn't know how to use it much beyond the excellent RAW conversions. Many of the functions seemed to be useful for only producing odd special effects; although I didn't know it at the time, I was using a chain saw instead of a scalpel.
For example, I thought the Curves and the Channel Mixer functions were only used to produce special effects as seen here. Perhaps you can, but that is neither the intent of the tools nor is it their highest and best use. In the bottom image, I randomly adjusted the sliders in Channel Mixer.
Thanks to Dan Margulis' excellent book, Professional Photoshop, Fifth Edition, I learned a few tricks on the right use of some of the Photoshop tools. For example, Dan showed how to brighten green foliage using Channel Mixer:
Following are the adjustments:
Searching around the web, I see that most people use the channel mixer as a kind of mysterious saturation or desaturation tool. Above we see how it is used to brighten a color. It is often used as a black and white conversion tool: all you need to do is check the 'Monochrome' box and adjust the sliders until you get the contrast you desire in your conversion.
For a while I've been interested in the Purkinje effect, which describes the shift in colors we experience as light gets dimmer. I was prompted to do this in response the the poor quality of photos I took around dusk: how, I thought, could I reliably and repeatedly correct my photographs to look something like I remember seeing it? My earlier efforts at coming up with a Purkinje correction are here and here.
This correction is a two-step process. First I adjust the relative tonalities of the colors in the scene. When light gets darker, the eye becomes more sensitive to blue-green light, and simultaneously gets less sensitive to red colors. In particular, foliage has a strong red color component in daylight which makes them appear yellow-green; under dim lighting, foliage looks relatively darker. I also noticed that I had to adjust the white balance towards a sky blue color.
In the scene above, I distinctly recall the foliage being quite dark, while the fountain (seen in the lower right corner), the limestone edging on the sidewalk, and the columns appeared much brighter than the surrounding areas. In a Luminosity layer, I used the channel mixer to both boost the brightness of the blue channel and to darken the red channel:
I could not just use this channel mixer indiscriminately across the image; the yellow light in the window in the tower was also darkened unrealistically. In this image, I applied the channel mixer with masking so that it did not change the brightest tones in the image.
I got these numbers in the channel mixer by comparing charts of light response of the dark adapted eye versus the sRGB primary color response to light. Measuring the response values across the color spectrum and doing some statistics, I was able to determine which mixture of color components best simulated the eye's night-adapted response. Here we are getting very close to the intended use of the channel mixer.
The most precise use of the Channel Mixer is for converting between various RGB color spaces. Please consider how I started the article: my old Dimage camera had an odd color space, which if not handled properly, would produce disappointing images and poor color rendition.
Every digital camera has a native color space, and it isn't the Internet standard sRGB or Adobe RGB. Every brand of digital camera has a native color gamut that is whatever. The electronics within the camera do the conversion between the camera's native color space and sRGB; or, if you shoot in RAW, the software on your computer (like Adobe Camera RAW, Lightroom, or Apple Aperture) does it for you after the fact. Digital cameras are sensitive to the various colors in a manner which is quite unlike the human eye's response. Practically speaking, a digital camera is limited by cost, manufacturing technique, and long-term stability; while the human eye is precious beyond cost, has the most complicated manufacturing known, and repairs itself. Therefore it is unrealistic to expect that cameras will see color precisely as is seen by human eyes.
As it turns out, it is very difficult to get precise color capture capability on a digital device, and forget about trying to capture color precisely as the human eye sees it, especially with exceptionally pure colors. (Technically speaking, digital cameras do not meet the Luther-Ives Condition, which determines if a camera can capture colors accurately.) There are cameras that do have better color rendition than consumer or pro-level cameras but a) you can't afford them, b) you don't want to spend the time getting them to work right, c) these cameras only work in controlled laboratory conditions, and d) you won't be able to display your accurate colors on a computer monitor or print them on a printer. So we are looking for good enough colors.
So we take a digital camera that has a color space of whatever, and we use the computer to convert the images to a standard color space like sRGB. Here is an example photo taken with my Nikon D40. I shot this X-Rite ColorChecker Passport in daylight using RAW capture. I set the white balance using the neutral card in the bottom photo. Here I used Nikon View NX2 software to convert the RAW image to JPEG in the sRGB color space:
I held up the target in daylight coming through my office window, and compared it to this image on my screen. The colors look pretty accurate. But this is not the image as the camera captures it. There is some significant processing going on to produce this final image. Here is an approximation of how the camera really sees the target:
I used the free and excellent RAW Photo Processor for Mac OS X. I set the white balance to UniWB, set the gamma to 1.0, and saved the image as raw pixels without a color profile loaded. By looking at this image we can see that the camera is very sensitive to green light, less sensitive to blue, and not very sensitive to red light. All cameras have a fixed, native white balance which does not correspond to any common lighting condition. Because digital cameras capture more than 8 bits per channel — usually in the range of 10 to 14 bits per channel — these extra bits are used to prevent banding artifacts when the software does this kind of processing. For daylight, the camera must amplify the blue channel by about 50% and approximately doubles the signal in the red channel. Under incandescent lighting, the red and green channels are usually fine, but the blue channel must be boosted strongly, which typically causes lots of noise.
Let's do a white balance. I used RAW Photo Processor to apply the white balance which I captured when I took the photo:
Cameras don't see light like humans do. In a camera, twice the light intensity generates twice the RAW signal; with humans, doubling the intensity of light makes a scene look only somewhat brighter. Likewise, halving the intensity of light only makes a thing look slightly darker. And so digital images are designed to provide extra sensitivity to the darker tones at the expense of brighter tones; this will allow us to more efficiently use our image data by allocating more data to the important midtones. To correct for this, we have to brighten the midtones in the camera's image, while keeping the very darkest and brightest tones unchanged.
Here I applied a brightness (or gamma) correction in RAW Photo Processor. This is not the precisely same brightness curve as is found in the sRGB standard, so the tonality of this image doesn't quite match the Nikon-processed image. But it is good enough for our purposes.
The first thing I notice is that the colors are disappointing. They look a bit flat and unsaturated compared to the first image. But this is actually a good thing. It tells me that my camera's native color space — whatever it is — is broader than the sRGB color standard. This flatness tells me that the colors could be potentially much brighter, if only I use a large enough color space, one larger than sRGB. In the camera native color space, the bright red color on our X-Rite target is merely mediocre.
To do this conversion from the camera native color space to sRGB in Photoshop, we imitate the processing used by the camera manufacturers by using Channel Mixer.
Suppose you take a given standard color, and take a photograph of it, being careful to do a good white balance and exposure. Good standard colors ought to produce a particular sRGB color value if exposed correctly; for example, a pure red the same color as the sRGB primary red color ought to give you R=255, G=0, B=0. But since your digital camera uses a different color system, it gives you another value, such as R=200, G=58, B=27. Your digital camera likely has a primary red color that is brighter, more saturated, and more pure than what the sRGB standard can describe.
So what we do is to boost the camera's red value somewhat, and then subtract out any green or blue that happens to be contaminating the red. So for any given Camera RAW value, we can get the equivalent sRGB values.
I got test data from DxOMark, a company that measures performance data for digital cameras and lenses. Here is an excerpt from the dataset:
Go to http://www.dxomark.com/index.php/Camera-Sensor/All-tested-sensors/Nikon/D40, click on Color Response, and click CIE-D50. This gives you daylight color data. They also provide CIE-A data, which models incandescent lighting.
Please note the White balance scales: this shows how much we should boost the various RAW color channels to get good white balance under D50 daylight conditions. Please note that D50 is much bluer than midday sunlight at mid-lattitudes, but is a good enough approximation for our use here.
To convert the RAW data to sRGB, we put the DxOMark Color matrix data above into the Channel Mixer:
Please note that due to rounding errors, the numbers in each Output Channel do not total to 100%. Undoubtably this will shift our white balance slightly. Generally speaking, be sure that each channel mixer output channel totals to 100% to avoid a change in white balance. However, the final image looks pretty good:
The colors are fairly close to the Nikon-produced colors.
You can use the same sort of process to do your own camera calibrations under all kinds of lighting conditions. Please note that the DxOMark color matrix data assumes the use of something like the channel mixer to convert from the camera's native color space to sRGB. For example:
sRGB Red = (1.64 x Camera RAW Red) - (0.61 x Camera RAW Green) - (0.02 x Camera RAW Blue)
If you have a target with known sRGB (or other color space) values, you can convert an image to these colors by comparing the delivered colors with the known colors. I use Microsoft Excel to come up with estimates for the channel mixer values, using the Solver tool found in the Analysis ToolPak add-in. This is a rather complicated step, and requires some knowledge of statistics.
Please note that this mathematical transformation between color spaces is not exact, but is rather statistical in nature; the conversion matrix merely gives good color conversions on average. A severe channel mixer setting will also cause much more noise in your image.
I was the owner of a Minolta Dimage 7 camera, and was greatly disappointed in its photos. Naturally, I blamed the camera and had huge buyer's remorse. One of the many problems was that the camera took photos in a non-standard colorspace. According to the camera review linked above:
Looking over the D7's images I couldn't help but feel that certain colours seemed under-saturated (mostly greens and blues)...I admit that at the time I didn't know much about color spaces (and really I still don't). My Dimage images looked poor for various reasons, and the processing utility that came with the camera produced very dark, unacceptable images. Despite doing some research, I really didn't know how to correct for these problems, most notably the color space problem.
At this stage it was clear to me that the DiMAGE 7 was shooting in its own colour space...
This is not documented in the DiMAGE 7 manual. I feel it should be made very clear to users, there's certainly a chance that the average user will simply load images directly from the camera using a card reader and never use the Minolta Image Viewer. These users may well end up disappointed by the D7's colour.
The average user won't know what colour space they're in, indeed most users don't even calibrated their monitors. However, at a consumer level, most of you will be viewing this web page and all the digital photographs you ever deal with in the sRGB colour space.
Then at Christmas 2006, I received a copy of Adobe Photoshop Elements. By that time I had already purchased a newer, somewhat inferior camera, but it produced great images right out of the box. But I tried using the Adobe Camera RAW software in Elements to process my old Dimage photos — and behold! — they looked great. The Adobe software knew all about the Dimage color space problem and correctly converted my images to the Web standard sRGB colorspace, and solved other problems too. By the next summer, I upgraded to Photoshop CS3 to gain access to the more advanced features in Adobe Camera RAW.
To the left is a typical JPEG image I got from the Dimage. On the right is an image I shot in RAW and processed with ACR.
So I was a new owner of Photoshop. But I didn't know how to use it much beyond the excellent RAW conversions. Many of the functions seemed to be useful for only producing odd special effects; although I didn't know it at the time, I was using a chain saw instead of a scalpel.
For example, I thought the Curves and the Channel Mixer functions were only used to produce special effects as seen here. Perhaps you can, but that is neither the intent of the tools nor is it their highest and best use. In the bottom image, I randomly adjusted the sliders in Channel Mixer.
Thanks to Dan Margulis' excellent book, Professional Photoshop, Fifth Edition, I learned a few tricks on the right use of some of the Photoshop tools. For example, Dan showed how to brighten green foliage using Channel Mixer:
Following are the adjustments:
Searching around the web, I see that most people use the channel mixer as a kind of mysterious saturation or desaturation tool. Above we see how it is used to brighten a color. It is often used as a black and white conversion tool: all you need to do is check the 'Monochrome' box and adjust the sliders until you get the contrast you desire in your conversion.
For a while I've been interested in the Purkinje effect, which describes the shift in colors we experience as light gets dimmer. I was prompted to do this in response the the poor quality of photos I took around dusk: how, I thought, could I reliably and repeatedly correct my photographs to look something like I remember seeing it? My earlier efforts at coming up with a Purkinje correction are here and here.
This correction is a two-step process. First I adjust the relative tonalities of the colors in the scene. When light gets darker, the eye becomes more sensitive to blue-green light, and simultaneously gets less sensitive to red colors. In particular, foliage has a strong red color component in daylight which makes them appear yellow-green; under dim lighting, foliage looks relatively darker. I also noticed that I had to adjust the white balance towards a sky blue color.
In the scene above, I distinctly recall the foliage being quite dark, while the fountain (seen in the lower right corner), the limestone edging on the sidewalk, and the columns appeared much brighter than the surrounding areas. In a Luminosity layer, I used the channel mixer to both boost the brightness of the blue channel and to darken the red channel:
I could not just use this channel mixer indiscriminately across the image; the yellow light in the window in the tower was also darkened unrealistically. In this image, I applied the channel mixer with masking so that it did not change the brightest tones in the image.
I got these numbers in the channel mixer by comparing charts of light response of the dark adapted eye versus the sRGB primary color response to light. Measuring the response values across the color spectrum and doing some statistics, I was able to determine which mixture of color components best simulated the eye's night-adapted response. Here we are getting very close to the intended use of the channel mixer.
The most precise use of the Channel Mixer is for converting between various RGB color spaces. Please consider how I started the article: my old Dimage camera had an odd color space, which if not handled properly, would produce disappointing images and poor color rendition.
Every digital camera has a native color space, and it isn't the Internet standard sRGB or Adobe RGB. Every brand of digital camera has a native color gamut that is whatever. The electronics within the camera do the conversion between the camera's native color space and sRGB; or, if you shoot in RAW, the software on your computer (like Adobe Camera RAW, Lightroom, or Apple Aperture) does it for you after the fact. Digital cameras are sensitive to the various colors in a manner which is quite unlike the human eye's response. Practically speaking, a digital camera is limited by cost, manufacturing technique, and long-term stability; while the human eye is precious beyond cost, has the most complicated manufacturing known, and repairs itself. Therefore it is unrealistic to expect that cameras will see color precisely as is seen by human eyes.
As it turns out, it is very difficult to get precise color capture capability on a digital device, and forget about trying to capture color precisely as the human eye sees it, especially with exceptionally pure colors. (Technically speaking, digital cameras do not meet the Luther-Ives Condition, which determines if a camera can capture colors accurately.) There are cameras that do have better color rendition than consumer or pro-level cameras but a) you can't afford them, b) you don't want to spend the time getting them to work right, c) these cameras only work in controlled laboratory conditions, and d) you won't be able to display your accurate colors on a computer monitor or print them on a printer. So we are looking for good enough colors.
So we take a digital camera that has a color space of whatever, and we use the computer to convert the images to a standard color space like sRGB. Here is an example photo taken with my Nikon D40. I shot this X-Rite ColorChecker Passport in daylight using RAW capture. I set the white balance using the neutral card in the bottom photo. Here I used Nikon View NX2 software to convert the RAW image to JPEG in the sRGB color space:
I held up the target in daylight coming through my office window, and compared it to this image on my screen. The colors look pretty accurate. But this is not the image as the camera captures it. There is some significant processing going on to produce this final image. Here is an approximation of how the camera really sees the target:
I used the free and excellent RAW Photo Processor for Mac OS X. I set the white balance to UniWB, set the gamma to 1.0, and saved the image as raw pixels without a color profile loaded. By looking at this image we can see that the camera is very sensitive to green light, less sensitive to blue, and not very sensitive to red light. All cameras have a fixed, native white balance which does not correspond to any common lighting condition. Because digital cameras capture more than 8 bits per channel — usually in the range of 10 to 14 bits per channel — these extra bits are used to prevent banding artifacts when the software does this kind of processing. For daylight, the camera must amplify the blue channel by about 50% and approximately doubles the signal in the red channel. Under incandescent lighting, the red and green channels are usually fine, but the blue channel must be boosted strongly, which typically causes lots of noise.
Let's do a white balance. I used RAW Photo Processor to apply the white balance which I captured when I took the photo:
Cameras don't see light like humans do. In a camera, twice the light intensity generates twice the RAW signal; with humans, doubling the intensity of light makes a scene look only somewhat brighter. Likewise, halving the intensity of light only makes a thing look slightly darker. And so digital images are designed to provide extra sensitivity to the darker tones at the expense of brighter tones; this will allow us to more efficiently use our image data by allocating more data to the important midtones. To correct for this, we have to brighten the midtones in the camera's image, while keeping the very darkest and brightest tones unchanged.
Here I applied a brightness (or gamma) correction in RAW Photo Processor. This is not the precisely same brightness curve as is found in the sRGB standard, so the tonality of this image doesn't quite match the Nikon-processed image. But it is good enough for our purposes.
The first thing I notice is that the colors are disappointing. They look a bit flat and unsaturated compared to the first image. But this is actually a good thing. It tells me that my camera's native color space — whatever it is — is broader than the sRGB color standard. This flatness tells me that the colors could be potentially much brighter, if only I use a large enough color space, one larger than sRGB. In the camera native color space, the bright red color on our X-Rite target is merely mediocre.
To do this conversion from the camera native color space to sRGB in Photoshop, we imitate the processing used by the camera manufacturers by using Channel Mixer.
Suppose you take a given standard color, and take a photograph of it, being careful to do a good white balance and exposure. Good standard colors ought to produce a particular sRGB color value if exposed correctly; for example, a pure red the same color as the sRGB primary red color ought to give you R=255, G=0, B=0. But since your digital camera uses a different color system, it gives you another value, such as R=200, G=58, B=27. Your digital camera likely has a primary red color that is brighter, more saturated, and more pure than what the sRGB standard can describe.
So what we do is to boost the camera's red value somewhat, and then subtract out any green or blue that happens to be contaminating the red. So for any given Camera RAW value, we can get the equivalent sRGB values.
I got test data from DxOMark, a company that measures performance data for digital cameras and lenses. Here is an excerpt from the dataset:
Go to http://www.dxomark.com/index.php/Camera-Sensor/All-tested-sensors/Nikon/D40, click on Color Response, and click CIE-D50. This gives you daylight color data. They also provide CIE-A data, which models incandescent lighting.
Please note the White balance scales: this shows how much we should boost the various RAW color channels to get good white balance under D50 daylight conditions. Please note that D50 is much bluer than midday sunlight at mid-lattitudes, but is a good enough approximation for our use here.
To convert the RAW data to sRGB, we put the DxOMark Color matrix data above into the Channel Mixer:
Please note that due to rounding errors, the numbers in each Output Channel do not total to 100%. Undoubtably this will shift our white balance slightly. Generally speaking, be sure that each channel mixer output channel totals to 100% to avoid a change in white balance. However, the final image looks pretty good:
The colors are fairly close to the Nikon-produced colors.
You can use the same sort of process to do your own camera calibrations under all kinds of lighting conditions. Please note that the DxOMark color matrix data assumes the use of something like the channel mixer to convert from the camera's native color space to sRGB. For example:
sRGB Red = (1.64 x Camera RAW Red) - (0.61 x Camera RAW Green) - (0.02 x Camera RAW Blue)
If you have a target with known sRGB (or other color space) values, you can convert an image to these colors by comparing the delivered colors with the known colors. I use Microsoft Excel to come up with estimates for the channel mixer values, using the Solver tool found in the Analysis ToolPak add-in. This is a rather complicated step, and requires some knowledge of statistics.
Please note that this mathematical transformation between color spaces is not exact, but is rather statistical in nature; the conversion matrix merely gives good color conversions on average. A severe channel mixer setting will also cause much more noise in your image.
Monday, June 13, 2011
"The False Photographer"
ON THE LIMITS of photography:
— G.K. Chesterton, “The False Photographer”, from A Miscellany of Men.This weakness in civilisation is best expressed by saying that it cares more for science than for truth. It prides itself on its "methods" more than its results; it is satisfied with precision, discipline, good communications, rather than with the sense of reality. But there are precise falsehoods as well as precise facts. Discipline may only mean a hundred men making the same mistake at the same minute. And good communications may in practice be very like those evil communications which are said to corrupt good manners. Broadly, we have reached a “scientific age,” which wants to know whether the train is in the timetable, but not whether the train is in the station. I take one instance in our police inquiries that I happen to have come across: the case of photography.
Some years ago a poet of considerable genius tragically disappeared, and the authorities or the newspapers circulated a photograph of him, so that he might be identified. The photograph, as I remember it, depicted or suggested a handsome, haughty, and somewhat pallid man with his head thrown back, with long distinguished features, colourless thin hair and slight moustache, and though conveyed merely by the head and shoulders, a definite impression of height. If I had gone by that photograph I should have gone about looking for a long soldierly but listless man, with a profile rather like the Duke of Connaught's.
Only, as it happened, I knew the poet personally; I had seen him a great many times, and he had an appearance that nobody could possibly forget, if seen only once. He had the mark of those dark and passionate Westland Scotch, who before Burns and after have given many such dark eyes and dark emotions to the world. But in him the unmistakable strain, Gaelic or whatever it is, was accentuated almost to oddity; and he looked like some swarthy elf. He was small, with a big head and a crescent of coal-black hair round the back of a vast dome of baldness. Immediately under his eyes his cheekbones had so high a colour that they might have been painted scarlet; three black tufts, two on the upper lip and one under the lower, seemed to touch up the face with the fierce moustaches of Mephistopheles. His eyes had that "dancing madness" in them which Stevenson saw in the Gaelic eyes of Alan Breck; but he sometimes distorted the expression by screwing a monstrous monocle into one of them. A man more unmistakable would have been hard to find. You could have picked him out in any crowd—so long as you had not seen his photograph.
But in this scientific picture of him twenty causes, accidental and conventional, had combined to obliterate him altogether. The limits of photography forbade the strong and almost melodramatic colouring of cheek and eyebrow. The accident of the lighting took nearly all the darkness out of the hair and made him look almost like a fair man. The framing and limitation of the shoulders made him look like a big man; and the devastating bore of being photographed when you want to write poetry made him look like a lazy man. Holding his head back, as people do when they are being photographed (or shot), but as he certainly never held it normally, accidentally concealed the bald dome that dominated his slight figure. Here we have a clockwork picture, begun and finished by a button and a box of chemicals, from which every projecting feature has been more delicately and dexterously omitted than they could have been by the most namby-pamby flatterer, painting in the weakest water-colours, on the smoothest ivory.
I happen to possess a book of Mr. Max Beerbohm's caricatures, one of which depicts the unfortunate poet in question. To say it represents an utterly incredible hobgoblin is to express in faint and inadequate language the license of its sprawling lines. The authorities thought it strictly safe and scientific to circulate the poet's photograph. They would have clapped me in an asylum if I had asked them to circulate Max's caricature. But the caricature would have been far more likely to find the man.
Friday, May 20, 2011
“Prime Subjects of Photography”
IF YOU ARE interested, please see my new series of challenges at the Digital Photography Review website, called the Prime Subjects of Photography.
My first challenge, Unconventional Portraiture, is currently in the voting stage, while the current challenge, Photography of Flora, is generating an astounding amount of interest. This will be followed by:
The challenges in the series have a particular structure, with easier subjects coming first, with these being reflected by similar yet more difficult subjects later on. Unconventional Portraiture came first, because it has few to no rules which ought to be followed, while Classical Portraiture, which is far more difficult, comes later.
Typically, human subject challenges alternate with nature studies and inanimate objects. More specialized challenges come later in the series. The entire series will have 33 challenges, and each challenge includes basic hints for good photography for that particular subject.
The dpreview website is largely suited to beginning photographers. The challenges on this site serve rather well as a learning tool.
My first challenge, Unconventional Portraiture, is currently in the voting stage, while the current challenge, Photography of Flora, is generating an astounding amount of interest. This will be followed by:
- Sports Photography
- Cityscapes (urban landscapes)
- Night Photography
- Environmental Photography (taking a portrait of a person in the context of their work or home)
- Food Photography
- Street Photography (photos in public in an urban area)
- Modern Landscapes (landscape photos with extreme sharpness and focus, with little Photoshop afterwards)
- Abstract Subjects
- Child and Youth Portraits
- Wildlife Photography (large animals in the wild; later challenges will concentrate on small wild animals and insects, and birds)
- Concert Photography
- Architectural Photography
- ...more challenges planned...
The challenges in the series have a particular structure, with easier subjects coming first, with these being reflected by similar yet more difficult subjects later on. Unconventional Portraiture came first, because it has few to no rules which ought to be followed, while Classical Portraiture, which is far more difficult, comes later.
Typically, human subject challenges alternate with nature studies and inanimate objects. More specialized challenges come later in the series. The entire series will have 33 challenges, and each challenge includes basic hints for good photography for that particular subject.
The dpreview website is largely suited to beginning photographers. The challenges on this site serve rather well as a learning tool.
Tuesday, May 3, 2011
Zillions and Jillions
PLEASE CONSIDER the absolutely most minimalist camera possible. This camera will have precisely one pixel or light sensor location, and it will generate a photograph that has a bit depth of exactly one binary digit: black or white. This camera can produce precisely two images:

This maximally minimalistic digital camera is actually useful. These are incorporated into proximity switches; devices that answer the question is something there? You might find them on conveyor lines in factories, or on automatic door openers.
Instead of just one pixel, let's consider a camera with four. Here are all possible images taken with this sort of camera:

With just a 2 by 2 pixel array, at one bit depth, we are able to take 16 different photographs.
We can easily calculate the total number of individual photographs that can be possibly taken by a digital camera capable of displaying only black or white:
Total images possible =
Suppose you have an entire universe of particles, and then you give every particle its own universe of the same size, and in each of those universes, you assign a similarly sized universe for each elementary particle inside them, and repeat the process nearly a thousand times. That's how many unique photographs you can take with your cruddy 500x500 pixel 1-bit depth digital camera.
We can get large numbers when we examine matter, but information is another class of being in itself, vastly larger than mere matter. It is for this reason that philosophers have posited that information resides in a realm above, beyond, or outside that of mere matter.
The following ought to convince you that an image 500 pixels on a side with 1 bit pixels can be quite rich:

My fellow Saint Louisians ought to recognize this scene. 1-bit images are generally quite useful, and have been used for decades in copying machines.
Even a 1 bit depth digital camera can produce an astounding number of different images. But suppose we add color — the number of possible images becomes even more staggering. Take my lowly Nikon D40 camera; it has about 6 million sensors, and if I shoot JPEG, I get 256 possible values per sensor. The camera has about 3 million green sensors, and 1.5 million sensors each of red and blue; full color is mathematically estimated for each pixel location.
So for each pixel location, we multiply by 256. The total number of images = 2566016000 which is approximately equal to a 1 followed by 14,487,972 zeroes. This is a mere pittance compared to the Seitz D3 digital scan back, which can capture 500 megapixel images with 48 bit color per pixel:
But this vast potentiality of photography ought not get us puffed up with pride in our creativity. Alas, the vast, overwhelming majority of these theoretically unique photographs look like this:

Uniform random noise. A trillion monkeys, each generating a trillion random images per second for a trillion years, will likely never once produce anything that looks like a photograph. You could call this an ‘image’, but only in the most general terms. At best, images like this are only an exercise in conceptual art, and then only for the first photographer who does it. And I just did it.
[Note: to generate a random noise image such as this in Photoshop, be sure to start with a 50% gray image. If your starting point is a white image, then half of your final pixels will be white, and if you start with a black image, then half your pixels will still be black. Using the Filter->Noise->Add Noise... function, add 50% Uniform noise. Be sure to turn off ‘Monochromatic’. I find I get better results if I do this for each color channel independently.]
We call an image like this ‘random’ because it doesn't look like anything in particular. Perhaps a supremely intelligent being can look at this and be able to immediately discern the specific algorithm used by Photoshop to generate this. But we can't; we are finite creatures, and so the perception of noise is very much a human phenomenon. Perhaps we can imagine some figure in this noise, but that is tenuous at best. Actually, the entire concept of randomness is problematic: see my article here.
But we are good at perceiving some image if the noise isn't too great, especially if we are familiar with the subject:

Clearly, high ISO images, and heavily manipulated images, can have very high relative amounts of noise, much more than I suspected.
A 1:4 signal-to-noise ratio is roughly the limit I'm able to handle, while surprisingly a 1:1 ratio isn't horribly bad for some purposes. But please note that noise found in actual digital images is not uniform; rather it lurks most of all in the shadows, or rather, the signal-to-noise ratio is smallest there, for highlights have a large absolute amount of noise, even though it is small relative to the signal.
Suppose we are willing to accept a 4:1 signal-to-noise ratio, which means that 1/5 of our bits are just noise. For this image, which is 500 pixels on an edge, with 48 bits of color, that means that about 10 bits are noise. We can calculate:

For our 500 x 500 pixel full-color image, I estimate that there are approximately 4 trillion largely undetectable variations for every reference image. For larger images, the number goes up to values never heard of even in government economics.
OK, so I assert that of all theoretically possible images, the relative number which would be recognized as photographs is vanishingly small. Fortunately, since we are dealing with almost unimaginably large numbers, this isn't an issue. Roughly estimating the number of photographic images possible ought to be doable.
Patterns make an image. Either there are significantly large adjacent patches of pixels that are very similar, or there are similarities between pixels even though they are widely separated. Or, we can find a pattern that repeats on various scales.
Look at this image:

It is pretty obvious that we have symmetry of the left and right halves, as well as the top and bottom halves. Recall that the total number of possible variations of a 500x500 pixel, 1 pixel depth image is represented by a 3 followed by 75,257 zeros. Because we have mirror symmetry, we basically repeat a 250x250 pixel image four times:
Total number of images:
With this 1 bit depth image, I find that I can only detect symmetry when I have greater than a 1:1 signal to noise ratio. We also should be able to detect other variations, such as changing the location and orientation of the axes of symmetry — all we have to do is ensure that our axis of symmetry is not too close to the boundary of the image.
The eye can detect global patterns such as seen above, and also local patterns, where there is some correlation between adjacent pixels:

Within a 500 x 500 pixel image, we can produce a total of 400 x 400 = 160,000 different images of a black 100x100 pixel square; our numbers go up if we can accept slight variations in the color and size of the square and its orientation. But if we are willing to accept some noise, as we see here, we can get zillons of possible images.
No two photographs are alike, and even if you take multiple shots with an ordinary camera under controlled conditions, there is no chance in your life that your resulting images will be exactly the same. This can be helpful: if you take multiple shots, you can blend them together to greatly reduce the amount of noise visible in the final image. Super-resolution techniques can also use multiple images to construct a higher-resolution final image, and can even remove diffraction artifacts.
The sharpness of lenses is a major limiting factor for producing unique photographs. The blurring found in some optics means that adjacent pixels are often strongly correlated, even if they are supposed to capture a high-contrast edge. Chromatic aberration and the mysterious purple fringing also lead to greater correlation between pixels, reducing the originality of photographs. Same goes with noise reduction software. Extreme, high quality bokeh, found in excellent portrait lenses, can reduce the out-of-focus background detail to a nearly uniform blur; this lack of detail leads us to focus our attention on the subject of the photograph. With extreme blurring and the use of the Photoshop Threshold tool, we can even reduce our images to match the 1-bit camera demonstrated at the top of this article.
Despite, or rather because of, the huge variation of possible photographs, it is relatively easy to detect unauthorized duplicates of images. Forensic analysts can detect duplicates with overwhelmingly high certainty, even if the original image was severely altered. Likewise, the use of the Clone tool in Photoshop — this copies one part of an image to another part — is easily detected if a large enough area is cloned, even if it is visually blended well, because these kinds of correlations within an image can not be practically attributed to chance. Never in a jillon years can we expect something like that to happen on its own.
If two photographers with two different cameras each take a photograph of the same scene, they will be different from each other in a huge number of minor (or even major) ways, so much so that we can be absolutely certain that the two images are in fact different. On the contrary, with a reasonably complex scene and good image quality, it seems that we ought to be highly confident that these two photographs were in fact photographed at the same time, and we also ought to be able to detect if the scene was artificially recreated at a later time, or was adjusted in Photoshop.
I think this discussion of seemingly impossibly large numbers tells us that photography, and digital art in general, is an incredibly rich and humanly inexhaustible medium.
[Click here for a discussion of names for long numbers. As it so happens, practically the only time these names for long numbers are actually used are in lists of names of long numbers. The word ‘zillion’, even though it is almost meaningless, is a good enough name for the quantities we are discussing here.]
This maximally minimalistic digital camera is actually useful. These are incorporated into proximity switches; devices that answer the question is something there? You might find them on conveyor lines in factories, or on automatic door openers.
Instead of just one pixel, let's consider a camera with four. Here are all possible images taken with this sort of camera:
With just a 2 by 2 pixel array, at one bit depth, we are able to take 16 different photographs.
We can easily calculate the total number of individual photographs that can be possibly taken by a digital camera capable of displaying only black or white:
- 1 bit camera = 2 photos
- 2 bit camera = 4 photos
- 3 bit camera = 8 photos
- 4 bit camera = 16 photos
Total images possible =
- 2 x 2 x 2 x ..... (multiply a total of 249,999 times)
- = 2250000
- = 3 followed by 75,257 zeros, plus a bit more.
Suppose you have an entire universe of particles, and then you give every particle its own universe of the same size, and in each of those universes, you assign a similarly sized universe for each elementary particle inside them, and repeat the process nearly a thousand times. That's how many unique photographs you can take with your cruddy 500x500 pixel 1-bit depth digital camera.
We can get large numbers when we examine matter, but information is another class of being in itself, vastly larger than mere matter. It is for this reason that philosophers have posited that information resides in a realm above, beyond, or outside that of mere matter.
The following ought to convince you that an image 500 pixels on a side with 1 bit pixels can be quite rich:
My fellow Saint Louisians ought to recognize this scene. 1-bit images are generally quite useful, and have been used for decades in copying machines.
Even a 1 bit depth digital camera can produce an astounding number of different images. But suppose we add color — the number of possible images becomes even more staggering. Take my lowly Nikon D40 camera; it has about 6 million sensors, and if I shoot JPEG, I get 256 possible values per sensor. The camera has about 3 million green sensors, and 1.5 million sensors each of red and blue; full color is mathematically estimated for each pixel location.
So for each pixel location, we multiply by 256. The total number of images = 2566016000 which is approximately equal to a 1 followed by 14,487,972 zeroes. This is a mere pittance compared to the Seitz D3 digital scan back, which can capture 500 megapixel images with 48 bit color per pixel:
- Total = (248)500000000 = 1 followed by 7,224,719,896 zeros.
But this vast potentiality of photography ought not get us puffed up with pride in our creativity. Alas, the vast, overwhelming majority of these theoretically unique photographs look like this:
Uniform random noise. A trillion monkeys, each generating a trillion random images per second for a trillion years, will likely never once produce anything that looks like a photograph. You could call this an ‘image’, but only in the most general terms. At best, images like this are only an exercise in conceptual art, and then only for the first photographer who does it. And I just did it.
[Note: to generate a random noise image such as this in Photoshop, be sure to start with a 50% gray image. If your starting point is a white image, then half of your final pixels will be white, and if you start with a black image, then half your pixels will still be black. Using the Filter->Noise->Add Noise... function, add 50% Uniform noise. Be sure to turn off ‘Monochromatic’. I find I get better results if I do this for each color channel independently.]
We call an image like this ‘random’ because it doesn't look like anything in particular. Perhaps a supremely intelligent being can look at this and be able to immediately discern the specific algorithm used by Photoshop to generate this. But we can't; we are finite creatures, and so the perception of noise is very much a human phenomenon. Perhaps we can imagine some figure in this noise, but that is tenuous at best. Actually, the entire concept of randomness is problematic: see my article here.
But we are good at perceiving some image if the noise isn't too great, especially if we are familiar with the subject:
That is an image with a 1:10 signal/noise ratio. Can you guess the subject? What does your gut say?
I've never before attempted to estimate signal to noise ratios for digital images. Here, I've created a series of images with varying relative amounts of noise:
I've never before attempted to estimate signal to noise ratios for digital images. Here, I've created a series of images with varying relative amounts of noise:
Clearly, high ISO images, and heavily manipulated images, can have very high relative amounts of noise, much more than I suspected.
A 1:4 signal-to-noise ratio is roughly the limit I'm able to handle, while surprisingly a 1:1 ratio isn't horribly bad for some purposes. But please note that noise found in actual digital images is not uniform; rather it lurks most of all in the shadows, or rather, the signal-to-noise ratio is smallest there, for highlights have a large absolute amount of noise, even though it is small relative to the signal.
Suppose we are willing to accept a 4:1 signal-to-noise ratio, which means that 1/5 of our bits are just noise. For this image, which is 500 pixels on an edge, with 48 bits of color, that means that about 10 bits are noise. We can calculate:
- Number of acceptably noisy images equivalent to a reference image = (210)250000 = a 1 followed by 752,576 zeros.
For our 500 x 500 pixel full-color image, I estimate that there are approximately 4 trillion largely undetectable variations for every reference image. For larger images, the number goes up to values never heard of even in government economics.
OK, so I assert that of all theoretically possible images, the relative number which would be recognized as photographs is vanishingly small. Fortunately, since we are dealing with almost unimaginably large numbers, this isn't an issue. Roughly estimating the number of photographic images possible ought to be doable.
Patterns make an image. Either there are significantly large adjacent patches of pixels that are very similar, or there are similarities between pixels even though they are widely separated. Or, we can find a pattern that repeats on various scales.
Look at this image:
It is pretty obvious that we have symmetry of the left and right halves, as well as the top and bottom halves. Recall that the total number of possible variations of a 500x500 pixel, 1 pixel depth image is represented by a 3 followed by 75,257 zeros. Because we have mirror symmetry, we basically repeat a 250x250 pixel image four times:
Total number of images:
- = 2250 x 250 = 2 62500
- = about 1 followed by 18184 zeros
With this 1 bit depth image, I find that I can only detect symmetry when I have greater than a 1:1 signal to noise ratio. We also should be able to detect other variations, such as changing the location and orientation of the axes of symmetry — all we have to do is ensure that our axis of symmetry is not too close to the boundary of the image.
The eye can detect global patterns such as seen above, and also local patterns, where there is some correlation between adjacent pixels:
Within a 500 x 500 pixel image, we can produce a total of 400 x 400 = 160,000 different images of a black 100x100 pixel square; our numbers go up if we can accept slight variations in the color and size of the square and its orientation. But if we are willing to accept some noise, as we see here, we can get zillons of possible images.
No two photographs are alike, and even if you take multiple shots with an ordinary camera under controlled conditions, there is no chance in your life that your resulting images will be exactly the same. This can be helpful: if you take multiple shots, you can blend them together to greatly reduce the amount of noise visible in the final image. Super-resolution techniques can also use multiple images to construct a higher-resolution final image, and can even remove diffraction artifacts.
The sharpness of lenses is a major limiting factor for producing unique photographs. The blurring found in some optics means that adjacent pixels are often strongly correlated, even if they are supposed to capture a high-contrast edge. Chromatic aberration and the mysterious purple fringing also lead to greater correlation between pixels, reducing the originality of photographs. Same goes with noise reduction software. Extreme, high quality bokeh, found in excellent portrait lenses, can reduce the out-of-focus background detail to a nearly uniform blur; this lack of detail leads us to focus our attention on the subject of the photograph. With extreme blurring and the use of the Photoshop Threshold tool, we can even reduce our images to match the 1-bit camera demonstrated at the top of this article.
Despite, or rather because of, the huge variation of possible photographs, it is relatively easy to detect unauthorized duplicates of images. Forensic analysts can detect duplicates with overwhelmingly high certainty, even if the original image was severely altered. Likewise, the use of the Clone tool in Photoshop — this copies one part of an image to another part — is easily detected if a large enough area is cloned, even if it is visually blended well, because these kinds of correlations within an image can not be practically attributed to chance. Never in a jillon years can we expect something like that to happen on its own.
If two photographers with two different cameras each take a photograph of the same scene, they will be different from each other in a huge number of minor (or even major) ways, so much so that we can be absolutely certain that the two images are in fact different. On the contrary, with a reasonably complex scene and good image quality, it seems that we ought to be highly confident that these two photographs were in fact photographed at the same time, and we also ought to be able to detect if the scene was artificially recreated at a later time, or was adjusted in Photoshop.
I think this discussion of seemingly impossibly large numbers tells us that photography, and digital art in general, is an incredibly rich and humanly inexhaustible medium.
[Click here for a discussion of names for long numbers. As it so happens, practically the only time these names for long numbers are actually used are in lists of names of long numbers. The word ‘zillion’, even though it is almost meaningless, is a good enough name for the quantities we are discussing here.]
Tuesday, April 12, 2011
Photography as an Art
THE GREATEST OBSTACLE the modern photographer encounters is his adherence to an idea that the camera "holds a mirror up to nature," that it is "true to nature." If that were so, photography would be for all times contained among the sciences and debarred from art. For nature is never art, nor does nature as a whole ever affect us as art. In art we are dealing strictly with the mental and emotional faculties more or less developed in each individual. These faculties respond when, on a flat surface such as paper, we find certain emotional and intellectual records of things we have seen or experienced in nature. And it is the manner in which these records are made that affects us as art. Every stroke, touch, spot, and patch of light and dark governed by the mind and hand of the artist interprets first an emotion, second a meaning. In this lies the province of art. The "mirror of nature," as expressed by photography, is a cold, impersonal, undesirable tracing of certain facts reproduced by pure science — heartless, uninteresting. Its value is wholly scientific, and it deals with only one kind of truth. There is nothing impressionable or impressive about it. Pictorial art is strongly emotional. It exists to give pleasure and at the same time knowledge; not such knowledge as the dissecting sciences impart, but the kind inherent in music, poetry, literature, religion.— Art principles in portrait photography (1907), by Walter Beck, p. 18-19
Nature in itself has nothing to do with art; it is only the quarry, the reservoir out of which material for art can be taken. It is plain, then, that "true to nature" cannot refer to the comprehensive truth, but that of necessity selection of truths must be resorted to in any event. This being so, the phrase "holding a mirror up to nature" is evidently meaningless from the standpoint of art, and "true to nature" must be understood as referring to a phase of nature of which we have become conscious.
Subscribe to:
Posts (Atom)












