Main Contents

Freeware tinting/toning plugin

September 1, 2008

This plug-in allows you to add tints to an image for artistic effect. e.g. sepia tone, warm, cool, bleach bypass, etc. It can also convert images to black & white and can emulate the use of color filters used for black & white photography. Check it out!

Free tint plugin

Filed under: Photoshop, color correction, still photography | Comments (2)

Saturation algorithms in RAW processors

August 24, 2008

One potential issue with some (but not all) RAW processors is that they may apply a saturation algorithm that is prone to making flesh tones appear green.


(click for a larger image)

In the comparison above, the image (the back of my hand) was processed via Adobe Camera RAW and Colormancer (my saturation algorithm). What is happening is that the saturation algorithm is being applied on the RGB values without gamma correction. This is the cause of the green shift.

In the video world, the RAW processor for the Red 4K digital cinema camera also exhibits a similar effect. Though keep in mind that RAW processors won’t necessarily all use the exact same saturation algorithm so this effect may not appear everywhere. But it is something to watch out for in your RAW processor of choice. Depending on the algorithm, increasing saturation too much can cause flesh tones to be too greenish.

Filed under: Photoshop, color correction, color science | Comments (0)

White Balance

August 13, 2008

Is there such thing as perfect white balance?  Some people worry over getting white balance technically correct. And there are products on the market such as Expodisc that try to do exactly this.  In my opinion however, you don’t need to obsess over white balance.  Why?  Because our perception of color is a guess to begin with.

The following picture appears to be a “white” business card lying on a black background.

I also happen to have many other “white” business cards.  By themselves, they all look white.  But when placed side by side, it’s apparent that they are all really different shades of (off-)white.

Two things to note here:

- Many white objects aren’t truly perfectly white.

- Despite that, these objects appear white to our visual system when viewed in isolation.

Our visual system has to guess the color of objects since the input is ambiguous.  A white card under slightly green light will reflect slightly green light.  So will a slightly green card under white lighting.  Multiple scenarios can lead to the same visual input.  Our visual system will nevertheless make an educated guess as to the object’s real color (these guesses tend to be very good) and that’s what we perceive.

When it comes to setting white balance, I wouldn’t worry over getting white balance 100% correc.  In a mixed lighting situation with two or more different light sources of different colors, there is no ‘correct’ white balance for the scene as each light source has its own correct white balance.  Perfect white balance is not always possible and it isn’t even necessary.  What I would strive for is to make the appearance of the final image fit your intent.  If it looks right then it looks right- it doesn’t need to be any more complicated than that!

Do white objects even need to appear white?

There are some cases when the correct white balance does not make white objects appear white.  There are certain lighting situations where our visual system’s “white balance” won’t completely adjust for the lighting.  A good example is golden hour, which is named the way it is since everything appears to pick up a golden tinge shortly before the sun sets.  In this case you don’t necessarily want to make white objects appear perfectly white if you want to maintain the golden tinge of the original scene.

Filed under: color correction, color science, still photography | Comments (1)

White Balance and Highlight Recovery Plug-in (free)

July 20, 2008

I’ve just released a freeware white balance and highlight recovery plug-in at Free Photoshop Plugins.

What it doesn’t do

It doesn’t do a better job than a RAW workflow. Shooting and processing RAW is still the best way of doing things. My plug-in works inside Photoshop so it does not have access to the RAW data. As white balance is applied when the image is turned into a JPEG, information is lost as white balance is a destructive process. Processing done by the camera also makes white balance (typically) an imperfect process.

What it does do

Lets you quickly white balance and recover highlights in situations where you don’t have access to the RAW data.

How it works

The desired white balance occurs when R = G = B for an area which should be a neutral color (e.g. grey, white). To achieve this, we can change the gain on the RGB channels / multiply all the red, green and blue pixels by some set of values. For example, if R=3 G=2 B=1 then G needs to multiplied by 1.5 and B by 3 to get the desired white balance. There are two issues:

1- Doing this will increase noise (bad). Multiplying the channels by some value will also multiply noise by that value and bring it up. We can’t really avoid this unless optical filters are used in front of the lens to set white balance (for still photography I don’t feel it’s necessary as you can use HDR techniques).

2- Changing the gain on each channel will cause some values to exceed white level (also bad). One of the channels will stay the same and have no gain applied to it.

Highlight recovery works by taking the values above white level and intelligently guessing what the values in the unchanged channel are. Suppose the neutral value is R=3 G=2 B=1 and there is some highlight in the image that is R=3 G=3 B=1.5. The highlight, after white balance, will be R=3 G=4.5 B=4.5. Suppose clipping occurs at 3. Normally we would just clip the data at 3. But instead of throwing the data away, we can do highlight recovery here.

Assuming that the highlight is white, the original scene value would have to be R=4.5 G=4.5 B=4.5. So we basically (A) make an assumption about the color of highlight and then (B) work backwards to perform highlight recovery. This means that highlight recovery will not work perfectly if the highlights aren’t white. But in most real world scenes they are, so it will work most of the time. You can turn highlight recovery down or off in situations where it won’t work.

In a nutshell, that is the basic explanation about how highlight recover works. On top of that, I add a rolloff that de-saturates highlights to deal with values close to white level. This is to avoid an abrupt transition between highlight recovery being used and pixels where it isn’t being used.

Why RAW is superior

One of the reasons RAW is superior when it comes to white balance is because it avoids white balance being done twice. Shooting JPEG will apply white balance in the camera and again when you adjust it. As explained earlier, white balance is a destructive process so it is best to only do it once.

The camera’s digital signal processing may also do things that will screw up the white balance process. Any colors that fall outside your working color space (e.g. sRGB, Adobe RGB) will be clipped; a RAW workflow would avoid this pitfall.

Processing shortcuts in the camera’s color matrix and a non-standard transfer function can also screw up the white balance process.

So shoot RAW if you can. But if for some reason you don’t have RAW data to work with (e.g. scanned images, JPEGs from third parties, etc. etc.) then check out the plug-in.

Filed under: Photoshop, still photography | Comments (0)

RAW is ALMOST always higher quality

July 19, 2008

For stills photography, many people advocate shooting RAW as it allows for more flexible processing and is higher quality. However, there is one weird case where shooting JPEG in camera can actually yield higher quality. This can occur when the deBayer/demosaic algorithm in the camera happens to do a better job than the RAW processor (e.g. Adobe Camera RAW).

In the comparison above, Photoshop (I call it Photoshop instead of Adobe Camera RAW for some reason) shows more color and mazing artifacts than the camera’s processing. Weird but true- in this specific situation, the camera’s digital signal processing does a better job than the Photoshop RAW plug-in. In practice this is likely not a huge deal since:

A- The image was of a test pattern that has lots of high contrast fine detail. Real world images tend not to be anything like this. RAW processing is typically designed to do well on real-world images and it is real world images that count, not evil test patterns.

B- Almost all of the time, the RAW workflow will yield higher quality. This specific situation would be so rare that I wouldn’t worry about it.

What’s happening

Since these RAW images come from a Bayer pattern sensor, the sampling of red, green, and blue is not co-sited. The red, green, and blue pixels do not stack on top of each other so the in-between data must be (essentially) guessed. This is not quite as bad as it seems as our eye is also like the Bayer pattern in that our S, M, and L cones aren’t co-sited either. (The real answer is more complicated as the human visual system doesn’t suffer from aliasing and debayer artifacts in the same way that cameras do. I believe this is because the HVS can implement tricks to fix these issues because the human eye moves when it samples a scene. Machine systems like scanners can move the sensor, but we cannot do this for still cameras. In practice, the Bayer pattern works very well for human viewing and is the choice for almost all dSLRs.)

But back to Bayer… one of the tricks to good debayering is to give special handling to edges to avoid zippering artifacts (see the example images at this site; search for the word “zippering”). Mazing artifacts can occur when these tricks do not detect edges correctly, resulting in erroneous lines and edges. High-quality debayering can get quite complex in trying to solve these problems. The debayering algorithm also interacts with the design of the camera. A properly-engineered camera will implement an optical low-pass filter (OLPF) in front of the sensor. A OLPF can be thought of as a blurry piece of glass. The blur is actually desirable as it reduces aliasing and “fills in the gaps” in the sampling structure. These images are less prone to mazing artifacts when processed through Adobe Camera RAW. Lenses will also introduce blur and can act as a OLPF. All this stuff interacts.

The practical thing to do is to run a test, or look at someone else’s. Dpreview.com has comparisons between JPEG and Adobe Camera RAW in their reviews (here is their Leica M8 review and their Nikon D200 review). The Leica M8 is notable because it has no OLPF (perhaps because Leica lenses are very sharp and the M8 designers wanted to show that off) and is therefore very prone to aliasing (and by extension, bayer artifacts).

To evaluate whether your prefer the camera’s processing or a RAW converter’s, shoot a test of both RAW and JPEG and see what the differences are. Keep in mind other differences in signal processing will affect image quality too (e.g. sharpening, color, highlight and exposure recovery tricks, etc.).

Filed under: still photography | Comments (0)

Adding color to black & white imagery

July 12, 2008

Another useful technique for black and white photos is to add a slight tint to it like a sepia tone.  Photo.net has a good tutorial on doing this.  The key idea is to add tints of slightly different colors for more ‘tonality’ to the image as opposed to a tint of a single color.

The feature films Sin City and The Spirit (upcoming) do very interesting things in their use of black & white.  Here is a frame grab from the trailer on Apple’s website (unfortunately the color tints may not show up in the Sin City trailers, even though they are there).  I apologize if the colors are not 100% accurate due to compression and possible Quicktime color management issues.

And with saturation boosted to help visualize all the tones in the image:

Aside from the obvious red tie, there is some subtle color tints added to this image… in particular, the sky has a blue tint added to it and the highlights are just a touch yellow.

Filed under: color correction | Comments (0)

Black and white conversions

July 12, 2008

When converting color images to black & white, a common technique is to control how each color contributes to the resulting image.  This is the same idea as using color filters when shooting a black and white film stock.

In the two images below, the top image uses channel blending to use 70% red and 30% green while the bottom image uses the standard Black & White filter in Sony Vegas.  (These shots are from a music video.)  Controlling the black and white conversion this way can be used to increase contrast in the image.

Another way of changing contrast is simply to use curves with a s-shaped curve.  The image below shows curves applied to the image above (it may help to open both images in Tabs and to click between the tabs to see the difference).

An interesting way of doing black and white conversions is to use channel blending to decrease contrast and then use curves to add contrast back.  Doing this on the right channels can result in an image with increased detail and texture.  Michael Kieran talks about this in his book Photoshop Color Correction.  Results can be seen below:

Play around these techniques and see if they give you more dynamic shots!

Filed under: color correction | Comments (0)

Hermann grid illusion / nobody knows anything

June 28, 2008

Hermann grid illusion

Illusion: In your peripheral vision, you may see dark spots where the lines intersect. If you look at an intersection directly, you can see that there is actually no dark spot.

The textbook explanation for this effect has to do with the ganglion cells in our eyes. In the center area of our ganglion cells, there is a positive response to luminance. In the surrounding area, any light has an inhibiting response. The ganglion cell fires less and this results in lower perceived brightness. When the ganglion cell is directly positioned over an intersection, the surrounding inhibitory area is looking at 4 lines. When the ganglion cell is positioned over a line but not an intersection, it is looking at 2 lines. So when it is looking at the intersection, the ganglion cell is being inhibited more and this corresponds to the lower luminance.

This theory is the one in textbook and being taught in universities. However, there is strong evidence against it. In the image below, the classic explanation would predict that the illusion would be stronger. To my eyes however, the illusion is either very weak or has no effect.

For another refutation of the classic explanation, check out Michael Bach’s visual illusions website. It references many academic sources with other possible explanations of this illusion. However, I haven’t seen an explanation that explains the following variation:

In the Flash demonstration above (you will need Flash to see it), you can drag the opacity slider to change the luminance of the squares in the center. Drag it to 0 to see a version of the classic Hermann grid effect. As you drag the luminance higher, you should see that the effect gets weaker and weaker. And then you hit a point where it starts becoming stronger again! I have no idea why this effect occurs. It could be that there are two different illusions/effects going on, but I wouldn’t know.

One issue that this raises is whether or not we really know anything about how the human visual system works. Perhaps it is an overstatement to say that “nobody knows anything”, but I certainly do feel that we have a lot more to learn about color science… especially when universities and textbooks continue to teach old theories that have little evidence supporting them.

Filed under: color science, visual illusions | Comments (0)

Chromaticity versus chrominance

June 23, 2008

Color spaces can generally be classified as chromaticity or chrominance based. Both are different styles of defining color. Chromaticity is “color” defined independent of luminance (or the equivalent of luminance in a particular color space). Suppose you used a neutral density filter on a camera or changed the intensity of the lighting. The chromaticity values of the image would stay the same. In a chrominance based color space, the chrominance values of the image will change if the intensity of light is varied as in the example. Chrominance can be thought of as a paint/pigment that adds “colorfulness” to an image. If mixing a gallon of paint, a certain amount of such a pigment would be needed. If mixing twice as much paint, twice as much of the pigment would be needed. And for three times the paint, three times the pigment would be needed, etc. etc. In a chromaticity based system, you would define color as the proportion to mix all the paints/pigments together.

If you are concerned with compression/bandwidth efficiency and/or uniform distribution of JNDs, then chrominance based color spaces tend to be more useful. For color correction however, chrominance based color spaces can cause problems if changing the luminance channel (or equivalent) without making similar changes to chrominance.

The first image below shows the original image. The second image below shows the L* channel in LAB space being halved in Photoshop. The third image shows the Luminosity channel being halved via a Levels adjustment Layer and the Luminosity blending mode (again, in Photoshop). The fourth image shows the RGB channels being halved - halving the luminance channel in a chromaticity based color space would yield similar/analogous results.

Original.

L* channel reduced 50% in LAB space (Photoshop).

Luminosity channel reduced 50% (Photoshop).

RGB channels reduced 50%.  Halving the luminance channel in a chromaticity based color space will produce results similar to this.

The chrominance based color space adjustments cause the resulting image to have oversaturated colors. To go back to the paint mixing analogy, there is now too much “colorfulness” paint. This can be avoided by doing adjustments in a chromaticity based color space. It is possible to convert any chrominance based color space into a chromaticity based one by dividing chrominance by luminance (or its equivalent) to yield chromaticity. Most programs do not do this unfortunately. In some situations like the one here, it is possible to get this by reduce the chrominance components by the same amount. However, this generally will not work if curve-based manipulations (e.g. s shaped curves) are applied to the luminance channel.

If doing color correction work with chrominance based color spaces or transformations, this is something to watch out for! If the adjustments are very minor then the error will be low and likely at an acceptable level. But push the image too much and you run the risk of unintended saturation shifts.

References:

Kerr, Douglas. “Chromaticity and Chrominance in Color Definition” http://doug.kerr.home.att.net/pumpkin/

Filed under: color correction, color science | Comments (3)

Is LAB useful for color correction?

June 23, 2008

For color correction, it might seem sensible to use a perceptually uniform color space. CIE L*a*b* is one such color space that is designed to be perceptually uniform.

In the context of LAB, perceptual uniformity means that the ability to tell two shades apart is uniform. This is usually measured in just noticeable differences (JNDs). Different shades are presented to the human test observers. Two shades are 1 JND apart when the observers can differentiate between the shades a certain percentage of the time (e.g. when they can tell the shades apart 50% of the time and get it wrong the rest of the time). LAB is designed so that distances in LAB space will correspond to JNDs.

However, LAB is not perceptually uniform when using other meanings of that phrase. Perceived hue and saturation (as interpreted by the human visual system) are not uniform in LAB space. The most noticeable situation where this occurs is when blue turns purple when lowering saturation[1]. The diagram below shows a patch of blue being de-saturated with different algorithms in Photoshop. The image you are looking at is likely inaccurate if you are using an uncalibrated monitor, the white point is not D65, etc. etc. etc. But what you should see is that LAB color space is the worst of the bunch- blue turns purple and it is more purple than all the other algorithms.

In my opinion, LAB color space is not ideal for color correction. Every other saturation algorithm shown here does a better job at maintaining constant hue! This makes sense, as LAB color space was designed for uniform JNDs and was not designed to be useful for color correction.


An explanation of the 5 different saturation algorithms:

  • The LAB result was generated using Photoshop. The a and b channels were reduced 50% via Levels.
  • Photoshop Hue/Saturation is the Hue/Saturation adjustment in Photoshop with a setting of -50.
  • Colormancer 0.25X and 0.5X are saturation adjustments via my Photoshop plug-in (see colormancer.com). They are added as a point of reference.
  • Rec. 709 chroma gain takes the original R’G'B’ values, converts them to Rec. 709 Y’CbCr color space, and multiplies the resulting chroma values by 0.5X. This type of algorithm is found in some high definition editing systems and color correction systems. The result appears dark because this algorithm does not follow the principle of constant luminance[2].

[1] For more information, see the section on The “Blue Turns Purple” Problem on Bruce Lindbloom’s website: http://www.brucelindbloom.com/MunsellCalcHelp.html

[2] Charles Poynton has a technical article on constant luminance here: http://www.poynton.com/notes/video/Constant_luminance.html

Filed under: color correction, color science | Comments (0)