VF - Tools of the Trade

31 August 2010

We continue our discussion on visual frequencies by examining the "tools of the trade" which we'll use to bed these ideas to our will in practical retouching. To do so, though, we'll start like we did last time by introducing more traditional audio equivalents as well as some definitions.

In principle, we will demonstrate that, just as we were adding frequencies together to form new ones before, we can subtract components out of a whole. Consider the figure below adapted from yesterday. By subtracting the low frequency component out of the whole, we are left with a high frequency signal.

Sound subtraction demo

We can do that same thing with an image, subtracting out the low frequency portions to leave us only with the high frequency:

Image subtraction demo

This should be fairly intuitive - if we can add two things together to get a sum, we should be able to tease them apart too. But before we get too far into that, we really do need to spend some time going over the definitions of a few terms to make sure that we don't confuse things later on. For reference, all of the terms I'm going to use are from general signals processing, and are therefore applicable to sound as well as to images.
  • Bandstop filter - A filter which stops a frequency band from passing through it. Generally, which frequencies are blocked is selected (or 'tuned') by the user.
  • Bandpass filter - A filter which allows only a select frequency band to pass through it. Like the bandstop filter, the range which is allowed to pass is controlled by the user.
  • Lowpass filter - A filter which allows only frequencies which are lower than a selected value to pass through.
  • Highpass filter - A filter which allows only frequencies which are higher than a selected value to pass through.
Let's put those in context. Let's say that I have an arbitrary sound source which consists of four component tones as below:
  • a 25Hz tone
  • a 200 Hz tone
  • a 1,000 Hz tone
  • and a 10,000 Hz tone
Now, if we apply a highpass filter set to 500 Hz to that sound, which components are going to be left in the result? Only two portions - the 1,000 Hz and the 10,000 Hz tones. By allowing only frequencies above 500 Hz to pass through, we have eliminated the other two entirely from the result.

On the other side of things, by applying a lowpass filter with the same setting (500 Hz), we can eliminate the 1,000 Hz and the 10,000 Hz tones while keeping the 25 Hz and 200 Hz components (those frequencies which fall below the cutoff).

We'll take this one step further. If I apply a bandstop filter to this sound, configured to block from 100-5,000 Hz, which components will be left? Because I am allowing nothing above 100 Hz, nor anything below 5,000 Hz, I'm left only with the 25 Hz and 10,000 Hz tones in my final sound. Equally, if we were to apply a bandpass filter with those same settings, we would have eliminated the 25 Hz and 10,000 Hz components while retaining the 200 Hz and 1,000 Hz portions.


Whew - you made it! Now let's apply those definitions to Photoshop terms so that we can get back to something fun, shall we?

I don't think you'll be surprised, but the Photoshop High Pass filter is.... a highpass filter! Shocking, I know. On the other hand, what a lot of people don't know is that Gaussian Blur is its exact opposite - it is a lowpass filter.

Now, Photoshop doesn't have bandpass or bandstop filters per se, but that doesn't mean we can't create them ourselves. Think about it. A bandpass filter is nothing but lowpass and highpass filters operating on the same source. So, if we apply the High Pass filter to an image, followed by a Gaussian Blur, we have selected (or bandpassed) all the frequencies between them, creating a layer which contains only those portions of the image.

So what about the bandstop filter? Well, let's think for a second. From its definition, a bandstop subtracts out the frequencies which we've selected. And in the paragraph above, we figured out how to create a layer which only contains those frequencies. Now, if we go back to arithmetic (yes, it's math, but hold on - it's easy math), you'll remember that subtracting one value from another is the same as adding its inverse. So, if we invert (Image->Adjustments->Invert) the layer which we created above, we'll have transformed it from a bandpass filter into a bandstop layer. Neat, huh?

Let's look at some examples again before we wrap up for today. Some of what I'll show you will look very weird, but please accept it for what it is - we'll get into applications by the end of the week. For now, just focus on understanding what's going on with the image and what we're doing to get there.

The first series is an image you've already seen - the difference is that you now know what you're really looking at. The left is the whole image. In the center, the original image after we've applied a lowpass filter. On the right, the original image after applying a highpass filter.

Sound subtraction demo

Next, we see the original image on the left. In the center, I have applied a bandpass filter to the image, allowing through only select intermediate frequencies. The right shows what happens to the image when I transform the bandpass filter into a bandstop filter. Crazy looking, isn't it? But I promise, it's going to be something you'll love before long

Sound subtraction demo

We'll stop here for tonight. I've given you a lot of information to chew on and throwing too much more at you now is as likely to make things worse as it is better. Consider what we discussed, review it as you have time, and feel free to ask questions if you have them in your forum of choice. When we come back on Thursday (tomorrow is a soccer game!) we'll jump into how we actually go about making these filters in Photoshop.

So that you know what we'll be covering generally, let me give you the tentative schedule for the rest of this series:
  • Thursday Saturday - The Mechanics - the process to actual apply these filters in PS - there are some sticking points!
  • Saturday Sunday - Why Are We Doing This? - how these techniques can be used in real-world retouching and how to make the process easier for yourself
  • Sunday Monday - Dirty Truths and Dirty Tricks - highpass was just the beginning + all my lies laid bare
  • Monday onward - Q & A - whatever you ask!
(schedule subject to change depending on Hurricane Earl and
whether Pepco is actually ready for downed lines this time)

Visual Frequencies

29 August 2010

Few subjects have gotten as much forum attention in the past couple of years as the 'awakening' surrounding the use of visual frequencies in retouching. I say 'awakening' of course because, while new HDR software is seemingly being released everyday, visual frequencies have always been a part of the images we work on. Up until now, though, only a very few retouchers knew they existed, and even fewer know even now how to fully employ them in production work.

So, my wife having left me for some high-speed training this week, I want to make use of the free time by embarking on a short series to try to make up for where my previous attempts to tackle the subject have fallen flat.

Before we get started, though, this is a very complex subject, and as such, I am very much going to be glossing over a lot of the details in the first few posts in order to convey the basic principles. The truth, as they say is ugly, and so we'll save it for when you have the foundation to tackle it properly.

For most people, our familiarity with frequencies is in terms of sound. We all know that birds chirping, glass breaking, and children screaming are (typically) high-pitched (or high-frequency) sounds. Equally, we associate sounds like explosions, fog horns, and books dropping as being low-frequency sounds. But what does that have to do with images?

Sine Wave
Well, we have to go back to high school physics for that one, so bear with me here - it's been a while for both of us. Do you remember what a low frequency sound 'looks' like, with a longish wavelength, or period? The figure at right (generated with ASU's J-DSP Editor) shows a graph of such a generic low frequency tone.

Sine WaveAnd what good would an arbitrary 'low' frequency tone be without a complimentary 'high' frequency tone? The figure at left shows just such, having a frequency which is twice that of our first sample. [Don't worry - I know this is boring, but it is leading somewhere good!]

Sine WaveNow, no one likes to sit around listening to single-frequency hums day in and day out, so what is happening physically when we mix two sounds together? You might remember that the two components can combine either constructively, emphasizing one another, or they can combine destructively, canceling one another out. The figure at right demonstrates what happens when we combine our low and high frequency sounds from above. Note how they combine constructively and destructively, depending on their relative values.

Sine WaveSine WaveSine WaveLet's trying applying this in a more visual sense. To do so in Photoshop, I constructed the figures at left, which consist of nothing but vertical bars evenly spaced across the screen. In a second layer (also shown at left) within the same document, I created another series of bars, this time twice as wide as those in the first. These should be considered as analogous to the equivalent sound waves which we looked at above. If we combine them in Photoshop (a process which we will go over later), we should get something similar to the combination of sounds from before. In fact, the third figure reflects just that - an eerily close replication of the sound pattern. Pay close attention to the way that the highs and lows combine just as they do in the audio signal. And while this example is simply one-dimensional and wholly contrived, it is a process which occurs across as many dimensions as we feed it - highs continue to build on other highs, and to cancel with lows.

At this point, it would be reasonable if you're thinking, "Gee, it's great that you can compose these frequencies like that Sean, but I'm not making photographs - I'm retouching them." Here's the magic part. Just as every sound which your computer microphone records can be broken down into its component frequencies using processes which are the reverse of what we did above (we'll talk about them later); we can use Photoshop to break images down into their component frequencies. Let me show you what I mean.

The triptych below shows a breakdown of a shot of DC United player Chris Pontius as he gains possession during an MLS match (yes, it's a 'real' photo). On the right is the image as output from Lightroom. One the left, I've used the Gaussian Blur filter to show only the lower frequency portions of the image; in the middle, only the high frequency portions. By combining the two back together, we can recreate the original. I will tell you right now that we can do this very, very accurately in Photoshop - at least as accurately as we can switch color modes.

DC United's Chris Pontius

This next image does it again, but this time I've broken the image into three different segments, combining back to the same source image. For now you'll have to take my word that we can do this as many times as we like for an unlimited number of separations, and really limitless possibilities for retouching.

DC United's Chris Pontius

Over the next few blog posts, I'll get into the hows, the whys, and above all things the details of this, but for a moment let sink in what we just demonstrated. Where many of us grew up in the retouching world with Margulis and Krause teaching us the 'revolutionary' idea that an image could have 10, 13, maybe 20 or more channel-based representations of itself; this idea represents the ability to create as many more permutations as we could ever want. You can look at an image not just in terms of additive or subtractive color; not just luminance and chrominance; nor even hue, saturation, and lightness - no, you can combine these with size; even with shape. We have a lot more to talk about, but all in good time. If you're too anxious to wait, head on over to ModelMayhem to read the "HighPass Sucks (+ solution)" thread which got a lot of this hubbub started; otherwise, I'll hope to see you again here soon.


Addendum: Much of the above was written hurriedly. If there are typos, I would appreciate your help in identifying them. Part of the rush has been that it was originally my intention to make this a video tutorial series, but I'm embarrassed to admit that I no longer know of any (free) utilities for generating and mixing constant audio tones (demonstration of mixed audio being the biggest boon in moving to a video format). If you know of such a utility (which is also GUI'd and easy to use), please drop me a note!