Nick Karpowicz
Feb. 3, 2006
email: karpon at rpi dot edu
If you read any camera related forums, you've probably heard about the "banding" or "corduroy noise" problem in Nikon's new D200 DSLR. I bought one in December, and of course the idea of a defect like this in something on which I spent so much money is a bit unpleasant. My D200 doesn't exhibit very strong banding: I've only seen it when I was trying to make it happen. Still, it would be nice to not have to worry about it. One option is to send it back to Nikon to see what they can do, but I don't want to send it back, and it seems like they can't entirely eliminate the problem at this point. So, rather than worry, I made a little program in MATLAB to get rid of the stripes when they do show their faces.
If you look at the banding pattern, you'll notice something: it's always in the same direction, and it always has the same spacing. What this implies is that if you take the Fourier transform of it, it's always at the same frequency. Not only is it at the same frequency all the time, it's at a pretty high frequency. The kind of frequency that you wouldn't miss if were to disappear.
Let's look at an example.
You can see here that about the bright part of the light, there's a vertical, ribbed pattern that doesn't really belong there. This stuff shows up if you blow out a highlight by about four stops and your ISO is between 125 and 640 (at least on my camera). I've never seen it at ISO 100, and I can't see it at 800 or above, since it gets lost in the random noise.
Now, let's take the two-dimensional Fourier transform. This lets us look at the image in frequency space, rather than in the spatial domain we're used to.


See that spike? That tells us that we have a specific spatial frequency with a much higher amplitude than its neighbors. What does that mean? Well, since it's at the top of the FFT in the y direction, it's a horizontal oscillation. And since it's towards the middle of the image in the x direction, it's at a high frequency. Sound familiar?
This is the banding. In the spatial domain, it's periodic and covers a large area, so it follows that in the frequency domain, it's a small, sharp spike. Why isn't it a single pixel? It doesn't span the entire image, so it's broadened in the frequency domain a bit.
So now that we've found the culprit, what do we do about it? Anyone familiar with image processing will say that you should design a narrow band-reject filter to remove this component. I'm lazy, so my bandstop "filter" is to simply set the offending components to zero.
What does that do to our picture of a light-bulb?

Ta da! No banding. Those edges of the light are always going to be a bit weird. Notice that there isn't any blurring of the image like you'd expect from a less targeted filter.
So, just to check, let's do one more:

Works pretty well, huh? If you look closely, you'll see that even the noise that was on top of the banding is preserved. Yay math.
Now, if you're the paranoid type, you'll say, "but you just threw out information! What if there was an essential part of the photograph in that part of the spectrum?" It's a valid point, but there are two reasons not to worry too much about it. First, we're only taking out a small part of the high frequency spectrum, so it's extremely unlikely that you'll be able to see the loss of this information once we go back into the spatial domain. Second, to really see a feature in a photograph disappear from this, it would have to look almost exactly like the banding pattern. If you have features in your image that look like the banding pattern, chances are you won't notice the pattern anyway, and there's no reason to filter the image. Does this mean that I think Nikon shouldn't fix their cameras? No! I think it would be great if they released a firmware update to eliminate the possibility, or barring that offered a hardware fix. We'll just have to wait and see for the former, and the latter is a bit too much of a hassle for something this easy to remove.
I did this just to ease my mind (and those of other people with D200s). I doubt that I'll run into a problem with banding in a real photo, but just in case I do, I can always filter it out using this technique. My program is horrendously slow, so I wouldn't want to run it all the time, but so far it seems like I won't have to. I'm done taking pictures of light bulbs and computer screens.
Now, it is possible that some banding could sneak past the filter: if it was confined to a very small area so that only a couple of bands came up, then the frequency would be too broad for this type of filter to kill it. But again, small ones like that probably aren't worth getting too worked up over.
This was all done in the MATLAB scientific computing environment. If you have MATLAB, you can download my program here:
bandingfilter.mThat is just a plain text file containing the code, if you're the curious type. To run it, just put it and your image into the active directory (or put it into your toolbox if you'd like) and type:
bandingfilter('filename.tiff');
Where filename.tiff is obviously the file you want to filter. You need the quotes. The program will think really hard for a few minutes and then make a file called 'filename.tiff.filtered.tiff' in the same directory. Okay, it's a bit of a silly name, but it was the easiest thing to do.
If you're filtering in a different programming environment, these are the coordinates of the components you want to remove after you do the FFT (in MATLAB format, so (x-begin:x-end, y-begin:y-end) defines a rectangle:
The spike:As I said, this program is pretty slow, and it consumes a lot of memory, but I'm a physicist, not an engineer. I just wanted to demonstrate the concept. If someone with more programming experience than me wants to take the ball and run with it, and make a faster program (or a photoshop plug-in or something), that would be great.
There is a compiler for MATLAB that would create a stand-alone version of this program, but I don't have a license for it, or enough programming knowledge to make something that I would feel comfortable releasing. If someone out there has both, let me know...