PDA

View Full Version : Why you need anti-aliasing


jlw
10-20-2006, 13:15
Much has been made of the fact that the Leica M8 doesn't have an anti-aliasing filter in front of its sensor, the rationale being to provide sharper, more detailed pictures.

This claim may have made some people wonder why DSLR makers use an anti-aliasing filter at all. After all, doesn't everyone want sharp, detailed pictures?

I happened to run into a situation at work today that illustrates why some kind of anti-aliasing is needed, so thought I'd share it with the group.

I was photographing a bottle with a printed label; on the label, the "screening" (dot pattern) of the printing is fairly coarse. I was using a medium-format camera with a digital back (Fuji GX-680 III and MegaVision S3 for you gearheads) and this back does not incorporate a hardware anti-aliasing filter. (This is an old back, but most current medium-format digital backs don't use an anti-aliasing filter either.)

The first attachment shows a section of the image I captured. Note the magenta and green artifacts in the screened area to the left of the red zero. These colors are the result of aliasing: the screen pattern of the printing was interacting with the pixel pattern of the imager.

Just as Leica is doing with the M8, MegaVision's strategy for dealing with aliasing was to incorporate anti-aliasing routines in software. In MegaVision's case, there are three different filter routines (light, medium and heavy) from which to choose. Since the software runs on an old computer, it takes a couple of minutes to anti-alias each image! (Normally what you do is capture a bunch of raw files, then go to lunch while running a batch utility to anti-alias them and render them out as 16-bit TIFFs.)

The second attachment shows the result of this procedure. Much better, right? I'm sure Leica's in-camera software won't take as long as MegaVision's "outboard" software to apply anti-aliasing, but it will be interesting to see how they've balanced the tradeoff between fine detail and alias reduction, and how well their choice works out in practice.

John Shriver
10-20-2006, 18:00
Anti alaising is required any time you sample. Over time, over space. Part of the Nyquist-Shannon Sampling Theorem. Basically, all signals input into a sampling system must have NO information at over one half of the sampling frequency.

It is part of the CD recording process, else your CD would sound godawful. If you didn't have a anti-aliasing filter, when you recorded a 18 kHz sine wave, the CD on playback you give you back a 18 kHz sine wave and an equally loud 26.1 kHz sine wave. That's the original frequency, and the difference of that frequency and the sampling frequency of 44.1 kHz.

It would be worse on a telephone. Telephone trunks have been digital for decades, with an 8 kHz sampling frequency. Without the anti-aliasing (low-pass) filter on sampling, 3 kHz in would result in 3 and 5 kHz out. Completely non-harmonic distortion. My answering machine has inadequare low-pass filtering before record, and there's this Donald Duck background noise along with the voices. Ugh!

You get beats between the input signal and the sampling rate. That's what causes the Moire patterns in digital photography. That difference frequency is known as an "image".

I don't understand why Leica left off the anti-aliasing filter, unless it made the light falloff issue worse, which was the hobgoblin of the M8 project. There is no way in software to accurately separate out the true signal and the "image". No matter what Leica and Canon claim.

Leaving the anit-aliasing filter out is specmanship, it cannot result in more accurate photographs. I presume that the software just tries to detect the imaging or beats, and just blurs the area to hide them. I suspect it only works because the lenses are providing a low-pass filter that drops off fast enough to attenuate the aliased images.

It was interesting that all the Kodak pro digital cameras had excellent anti-aliasing filters. They understand all the theory behind digital imaging.

Oh, a good anti-alaising filter (sometimes called optical low-pass) is expensive.

John Shriver
10-20-2006, 18:02
Wikipedia's article on the Nyquist-Shannon Sampling Theorem is excellent.

jano
10-20-2006, 18:19
My answering machine has inadequare low-pass filtering before record, and there's this Donald Duck background noise along with the voices.

Sorry, kinda OT.. would you mind posting a recording of this.. :D

First, the obligatory disclaimer: I am a total layman with this. Regarding the AA filter.. it is my understanding that it is a piece of some kind of material located immediatley before the sensor. Is it possible to sell third-party AA filter like a UV filter for a lens -- and mount it directly to the lens? or would it actually have to go immediatley in front of the sensor?

DaveSee
10-20-2006, 20:39
Anti alaising is required any time you sample. Over time, over space. Part of the Nyquist-Shannon Sampling Theorem. Basically, all signals input into a sampling system must have NO information at over one half of the sampling frequency.
Wow, this is very interesting... thanks for the post/reply...
It is part of the CD recording process, else your CD would sound godawful. If you didn't have a anti-aliasing filter, when you recorded a 18 kHz sine wave, the CD on playback you give you back a 18 kHz sine wave and an equally loud 26.1 kHz sine wave. That's the original frequency, and the difference of that frequency and the sampling frequency of 44.1 kHz.
[snipped]
You get beats between the input signal and the sampling rate. That's what causes the Moire patterns in digital photography. That difference frequency is known as an "image".
OK, I read this, the wikiped ref you cited, &c.... so moire results from either too much (continuous) signal, OR too infrequent a (discrete) sampling rate, right?
I don't understand why Leica left off the anti-aliasing filter, unless it made the light falloff issue worse, which was the hobgoblin of the M8 project. There is no way in software to accurately separate out the true signal and the "image". No matter what Leica and Canon claim.
Well, light "falloff" has been cited/supposed; and 'tis true that s/w cannot /separate/ the original signal from the resulting data(aka "image")... and that has been the case for film too. So, why should anyone start now?
Leaving the anit-aliasing filter out is specmanship, it cannot result in more accurate photographs. I presume that the software just tries to detect the imaging or beats, and just blurs the area to hide them. I suspect it only works because the lenses are providing a low-pass filter that drops off fast enough to attenuate the aliased images.
Well, no... folks now understand that an AA filter is equally "specmanship", which means that "accurate photographs" captured with such laboriously sluggish and pitifully slow and inaccurate digital recording methods cannot be improved by a rationalized /grid/ of likely points of intersection for lenses of varied LPI capability; so "let them drink Starbucks!"(read: make the best of a rotten situation by processing JPEGS with /hints/ from a 6-bit salt that encrypts the image in "beauty".)

It was interesting that all the Kodak pro digital cameras had excellent anti-aliasing filters. They understand all the theory behind digital imaging.

Oh, a good anti-alaising filter (sometimes called optical low-pass) is expensive.
Take note of Leica(Kodak) using a lenticular film to adjust light at the "image" edges... by /speeding up/ certain rays, and slowing others, this AA issue may be seen as the 1990's kludge for poor image processing that it is... I mean really, why discard/accept light at the physical sensor as "0"/"1", respectively? That's what an AA filter does, and it's stupid. Leica(Kodak) has cleaned up the signal /path/, and have faster sampling algos: so AA filter is not, most likely, helpful... but harmful!

"I want a sensor, not a censor! AA filters must go!"

rgds,
Dave

AndyPiper
10-20-2006, 22:51
Actually, according to dpreview's review of the Kodak 14n full-frame pro DSLR - "no microlenses" "no antialias filter".

http://www.dpreview.com/reviews/kodakdcs14n/page2.asp

The Leica DMR also omits a physical AA filter - so much for the "vignetting issue" theory.

An AA filter won't even work ALL the time - the Canon 1Ds variants use one, and I still see some pattern aliasing of the type JLW encounters in some of the dpreview sample shots from those cameras.

For 90% of my work (based on DMR and a few beta-M8 shots with the signal filtering "off") aliasing is not an issue, and the extra resolution is worth dumping the filtering. For 90% of the remainder, the aliasing is easily correctible. In 1% of the shots it has been an issue one way or another.

I'll take 99% of my shots being sharper in exchange for 1% having troubles, over 100% being fuzzier.

When it comes to sound and some other kinds of signals, the Nyquist-Shannon stuff is critical, because almost all information-bearing sound or other signals to be recorded have a frequency built into them - usually a time-based frequency (X-many things per second - hertz, kilohertz, etc.).

A camera anti-alias filter affects spatial frequencies - and an awful lot of photographic subject matter is stochastic - with no regular frequency. If there is no regular frequency to the details of subject matter, they aren't a "signal" in the Nyquist sense.

Equally, there are some photo subjects that do have a repetitive texture - a spatial frequency - bricks, cloth, picket fences, jlw's printing dots. Formal architecture and fashion would be obvious places where sampling issues and filtering require attention.

But in the vast majority of MY work I just don't see moires happening - so I'm glad Leica decided not to follow the one-size-fits-all philosophy.

jlw
10-21-2006, 07:12
I admit that I don't understand this stuff at the same technical level as John, but it seems to me that fundamentally hardware and software AA filters work the same way -- by "contaminating" each sample value slightly with information derived from the surrounding samples. This is either done optically (by adding a plate in front of the sensor that introduces a small, controlled amount of blurring) or via software (by mathematically combining the values.)

Andy raises what seems to be a valid point in that one advantage of software anti-aliasing is that you can choose different strengths, or turn it off entirely when it's not needed (as is the case with my MegaVision software -- usually I leave the filter turned off to save on processing time, and turn it on only when photographing patterned objects.)

Also, since in my (limited) experience the main effect of aliasing seems to be the introduction of false-color patterns like those in my example shot, it wouldn't be such an issue in black-and-white photography and profitably could be turned off to increase textural detail. This suggests that Leica gave a thought to black-and-white shooters here -- as they properly should, given the heritage of their cameras!

The main potential downsides with software anti-aliasing seem to be processing time and algorithm quality -- there's bound to be a tradeoff between how good a job the algorithm does and how fast it runs. It'll be interesting to see how the M8 does in those areas.

phototone
10-21-2006, 10:04
It was interesting that all the Kodak pro digital cameras had excellent anti-aliasing filters. They understand all the theory behind digital imaging.

Well, Kodaks last pro-digital SLR's, the 14n, and the SLR/n and SLR/c did not have an AA filter, and I use them every day for my commercial studio work, and the types of material I shoot does not result in artifacts. The possibility of aliasing artifacts is there, and I have (on rare occaissions) seen them, but in practical fact they just do not impact on the work I do professionally.

I think this is going to be the case with the M8. The chance of getting aliasing artifacts is there, but in practial use, the chance of them being noticable in everyday shooting is low if you shoot the kind of images that RFDR cameras are known for. If you are going to shoot up-close detail shots of printed packaging, then the M8 is not the camera of choice for your work anyway. If you are going to shoot street photography, in b/w, then aliasing is not much of an issue, becaue of no color. Street photography in color, or scenics, or environmental photography will not show aliasing much in any case, unless you are a pixel-peeper.

I have encountered a couple of instances of aliasing in my Kodak shots of scenics, but these were only visible when printed 30x40" prints, and then only to me, who knew what to look for.

AndyPiper
10-21-2006, 11:00
I believe the digital filtering Leica uses is one of two types - either a "search and destroy" algorithm for the patterns of hot red and cyan pixels that are the most obvious results of Bayer aliasing (absent a physical filter) - or a blur or median filter only on the chrominance signal, which retains luminance sharpness while smudging out the color values across neighboring pixels . I suspect it's the latter, since that would not require analyzing the image in detail - it would be a global effect.

In fact, I use a PS median filter - 3 pixels, faded in "Color" mode 100%, to nip off most Bayer-pattern effects that make it through to my final shots (also a good way to knock down color noise).

The digital filtering is not used for RAW shots in any case.

Finally, I think that 5-10 years ago aliasing was far more of an issue when the sensor resolutions (and thus the sampling frequency, and thus the Nyquist limit) were lower (3.2 - 6 Mpixels) - and thus much farther below the average lens's resolution. And the pixels had to be enlarged more for a given print size making any artifacts more visible.

The Leica M8/DMR sensors have 6.8-micron pixels. That's 147 pixels per mm, so they should be able to handle a lens with up to 70 lpm resolution without an additional filter - the lens resolution limit by itself becomes the "low-pass" filter. Even with Leica lenses, in general use hand-held, the resolution in most shots is likely at or below 70 lpm - which probably explains why I don't see a lot of real-world aliasing.

Rico
10-22-2006, 22:33
I believe Leica omitted the AA filter to save money. The optional AA filter for the Kodak DCS 560 was $4K! As John S mentions, the low-pass filter is mandatory before sampling occurs - otherwise, the data is ambiguous. Postprocessing cannot properly eliminate rainbow fringing from a grey suit unless you confirm that the suit is actually grey, and not creatively colored! Andy is correct to observe that sensor-site density (or a blurry lens) can serve the function of an AA filter. Also effective is stopping down to induce diffraction.

Like sharpening algorithms and film grain, the high frequencies of an unfiltered image are pleasing to the eye because they impart a sense of detail. It's important to understand that this detail is false, even if the effect is not obviously false with the moiré patterns caused by a regular pattern in the image. With low-pass filter specified by the sampling frequency and a suitable sharpening regime*, you will enjoy the best image that the sensor can deliver - and no Russian roulette.

* Sharpening is also a science, although it requires knowledge about the physiology of the viewer's eye, the display medium, and the viewing geometry.