Ad
Ad
Ad
Pages: [1] 2 3 ... 7 »   Bottom of Page
Print
Author Topic: Is this Aliasing?  (Read 27021 times)
crames
Full Member
***
Offline Offline

Posts: 210


WWW
« on: January 12, 2010, 08:48:58 PM »
ReplyReply

There are a lot of threads here now in the LL forum about aliasing, anti-alias filters, foveon vs. bayer array, upsizing, downsizing, etc.

What does aliasing look like?

Here is a synthetic image of a circular sine wave that has been sampled close to the Nyquist rate.



The original on the left is shown zoomed progressively larger to reveal the details in the pixel structure.

What do you see here? Is this what you would call "aliasing?"

Regards,
Cliff
Logged

Cliff
jjlphoto
Sr. Member
****
Offline Offline

Posts: 467


« Reply #1 on: January 12, 2010, 09:53:24 PM »
ReplyReply

Not exactly.
« Last Edit: January 12, 2010, 09:56:50 PM by jjlphoto » Logged

Thanks, John Luke

Member-ASMP
ErikKaffehr
Sr. Member
****
Offline Offline

Posts: 7331


WWW
« Reply #2 on: January 13, 2010, 12:06:06 AM »
ReplyReply

Hi,

Yes, it's what I would call aliasing. I'm not a signal processing scientist, however, so don't take my word for it!

Best regards
Erik


Quote from: crames
There are a lot of threads here now in the LL forum about aliasing, anti-alias filters, foveon vs. bayer array, upsizing, downsizing, etc.

What does aliasing look like?

Here is a synthetic image of a circular sine wave that has been sampled close to the Nyquist rate.



The original on the left is shown zoomed progressively larger to reveal the details in the pixel structure.

What do you see here? Is this what you would call "aliasing?"

Regards,
Cliff
Logged

thierrylegros396
Sr. Member
****
Offline Offline

Posts: 649


« Reply #3 on: January 13, 2010, 02:42:20 AM »
ReplyReply

Have a look at A/D converter manufacturers website like Texas Instruments and others.

You will find a lot of interresting explanations about aliasing and cure used.

Thierry
Logged
BartvanderWolf
Sr. Member
****
Online Online

Posts: 3576


« Reply #4 on: January 13, 2010, 05:24:18 AM »
ReplyReply

Quote from: crames
What do you see here? Is this what you would call "aliasing?"

Hi Clif,

Yes, that's aliasing. To put it in non-scientific terms, an alias is created when small details with a regular spacing are sampled with a regular spacing interval that's too large, AKA undersampling. When the regularly spaced detail is undersampled, larger aliases can/will appear. To reliably prevent undersampling, more than 2 samples need to be taken of each single feature.

When you increase your sampling frequency by a factor of at least Sqrt(2), you'll also satisfy the diagonal Nyquist requirements of >2 pixels per cycle:
[attachment=19431:ConcentricSine.png]

You may also like to look at this summary: http://en.wikipedia.org/wiki/Aliasing

Cheers,
Bart
« Last Edit: January 13, 2010, 05:26:22 AM by BartvanderWolf » Logged
EduPerez
Sr. Member
****
Offline Offline

Posts: 692


WWW
« Reply #5 on: January 13, 2010, 06:43:18 AM »
ReplyReply

AFAIK, "aliasing" is the origin of the problem (BartvanderWolf explained it very well);
those artificial patterns that can be seen is called the Moiré effect.
« Last Edit: January 13, 2010, 06:44:37 AM by EduPerez » Logged

crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #6 on: January 13, 2010, 06:18:11 PM »
ReplyReply

Ok, I apologize, it was a trick question.

There is no aliasing in the posted image.

It is a sine of 2.04 samples per cycle, which is about 98% of the Nyquist rate, and so definitely below Nyquist.

Here is a center crop of what you get if you apply a high-quality reconstruction filter to the original image:



vs. bicubic:



The point is that the failure to reconstruct, or reconstruction error, can be mistaken for aliasing, and can even badly affect images that have no aliasing at all.

Just something to keep in mind when comparing cameras, AA filters, and technologies like foveon vs. bayer.

Cliff

Note to Bart: No need to increase the sampling rate for the diagonals, in this case they already have a sqrt(2) advantage over horizontal and vertical.
« Last Edit: January 16, 2010, 04:57:33 PM by crames » Logged

Cliff
joofa
Sr. Member
****
Offline Offline

Posts: 486



« Reply #7 on: January 13, 2010, 07:10:49 PM »
ReplyReply

Quote from: crames
The point is that the failure to reconstruct, or reconstruction error, can be mistaken for aliasing, and can even badly affect images that have no aliasing at all.

Cliff mentions an important and sometimes less-known fact even if the samples are alias free, "aliasing" can result in reconstruction if the bandwidth of the reconstruction filter is longer than desired. For ideal sinc filter that would mean that sinc is no longer 0 at sample locations other than the pivot.
« Last Edit: January 13, 2010, 07:12:40 PM by joofa » Logged

Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins
ejmartin
Sr. Member
****
Offline Offline

Posts: 575


« Reply #8 on: January 13, 2010, 07:31:02 PM »
ReplyReply

What is a reconstruction filter?
Logged

emil
joofa
Sr. Member
****
Offline Offline

Posts: 486



« Reply #9 on: January 13, 2010, 07:46:12 PM »
ReplyReply

Quote from: ejmartin
What is a reconstruction filter?

A filter that converts digital samples into continuous output again. Can be the input for resampling operations.
Logged

Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins
crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #10 on: January 13, 2010, 08:16:43 PM »
ReplyReply

It's the "other end" of a sampling system, to reconstruct the original image from its samples. Ideally, it's a bandlimited sinc interpolator, to remove spectral replicas caused by the sampling process. You can approximate reconstruction to the continuous domain by interpolating to a higher res.

It was difficult to get a good result so close to the Nyquist rate. For the example I used a sinc interpolation method in Matlab by L. Yaroslavsky.

Cliff
« Last Edit: January 16, 2010, 04:57:11 PM by crames » Logged

Cliff
BartvanderWolf
Sr. Member
****
Online Online

Posts: 3576


« Reply #11 on: January 15, 2010, 02:00:21 AM »
ReplyReply

Quote from: crames
Ok, I appologize, it was a trick question.

There is no aliasing in the posted image.

It is a sine of 2.04 samples per cycle, which is about 98% of the Nyquist rate, and so definitely below Nyquist.

Here is a center crop of what you get if you apply a high-quality reconstruction filter to the original image:



Hi Cliff,

You are correct that the reconstruction filter used, makes a difference.

I assume you downsampled the original image, because this image is about 8 pixels per cycle (over-sampled 4x). If so, then how does it look at 2.04 samples per cycle with the high-quality reconstruction filter?

Cheers,
Bart
Logged
crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #12 on: January 15, 2010, 08:01:31 AM »
ReplyReply

Quote from: BartvanderWolf
I assume you downsampled the original image, because this image is about 8 pixels per cycle (over-sampled 4x). If so, then how does it look at 2.04 samples per cycle with the high-quality reconstruction filter?

The problem is that reconstruction results in a more finely-sampled (bigger) image. The image marked 100% shows the original samples, is has not been downsampled. The reconstruction example is a crop of a 4x upres. If you use nearest neighbor to reduce the size of the reconstruction by 4, you get back the original (possibly with a small phase shift due to how the nearest neighbor is done).

A 4x upres is more than needed. Here is a 2x upres/reconstruction (Yaroslavsky method):


The 100% original (2.04 pixels/cycle):


Just to show it's not aliased, the FFT magnitude of the 100% original:


Except for the case of pathological examples like this, reconstruction  by a 2x bicubic upres is often enough to get rid of obvious  reconstruction errors. But it always involves some kind of  upres/interpolation.

So the moral of the story is, it's bad to  pixel-peep at 100%. 200% is better!

Rgds,
Cliff
Logged

Cliff
Jonathan Wienke
Sr. Member
****
Offline Offline

Posts: 5759



WWW
« Reply #13 on: January 15, 2010, 08:20:16 AM »
ReplyReply

Quote from: crames
The problem is that reconstruction results in a more finely-sampled (bigger) image. The image marked 100% shows the original samples, is has not been downsampled. The reconstruction example is a crop of a 4x upres. If you use nearest neighbor to reduce the size of the reconstruction by 4, you get back the original (possibly with a small phase shift due to how the nearest neighbor is done).

A 4x upres is more than needed. Here is a 2x upres/reconstruction (Yaroslavsky method):

Would you mind posting the Matlab code you used on that image? I'd like to try using it for some demosaic experiments.
Logged

crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #14 on: January 15, 2010, 09:27:15 AM »
ReplyReply

Quote from: Jonathan Wienke
Would you mind posting the Matlab code you used on that image? I'd like to try using it for some demosaic experiments.

I used interp2d.m, found in the following set from Yaroslavsky's web site: http://www.eng.tau.ac.il/~yaro/adiplab/m-files.zip.

On real images, it can tend to create ripples (due to it being done in the Discrete Cosine Transform domain). There are ways around that - Yaroslavsky has papers on his site that address that problem, but I didn't find any matlab code for it.

Rgds,
Cliff
Logged

Cliff
BartvanderWolf
Sr. Member
****
Online Online

Posts: 3576


« Reply #15 on: January 15, 2010, 10:25:14 AM »
ReplyReply

Quote from: crames
The problem is that reconstruction results in a more finely-sampled (bigger) image.

Maybe it's my infamiliarity with the jargon, but isn't that called interpolation instead of reconstruction?

Quote
The image marked 100% shows the original samples, is has not been downsampled.

Again, excuse me, but I find that hard to believe, unless you mean that it attempts to show the original samples. If those are the original pixels, then it is impossible to arrive at your interpolated/reconstructed version without knowledge of how the pattern was supposed to look.

Quote
Just to show it's not aliased, the FFT magnitude of the 100% original:

But that is the FFT magnitude of the mathematical model, not the aliased image shown at the top of the thread as 100%.

Quote
So the moral of the story is, it's bad to  pixel-peep at 100%. 200% is better!

Indeed, oversampling at the moment of capture/aquisition has it's benefits. Sometimes it's a luxury we cannot afford, so I'm afraid we'll be stuck with compromises, Bayer CFA compounding to it and all.

Cheers,
Bart
« Last Edit: January 15, 2010, 10:27:26 AM by BartvanderWolf » Logged
Jonathan Wienke
Sr. Member
****
Offline Offline

Posts: 5759



WWW
« Reply #16 on: January 15, 2010, 10:55:00 AM »
ReplyReply

Quote from: crames
On real images, it can tend to create ripples (due to it being done in the Discrete Cosine Transform domain). There are ways around that - Yaroslavsky has papers on his site that address that problem, but I didn't find any matlab code for it.

I downloaded some of the PDFs, and found them very interesting reading, especially the one about fast discrete sinc interpolation. I thought the experiments he did rotating the images in multiple small increments using various resampling techniques were very interesting. The thought I had was to use some variant of his fast discrete sinc reconstruction filter to do Bayer demosaic interpolation, then apply deconvolution-based lens blur corrections using PSFs derived from images of a special test target shot with the same camera/lens combination and demosaiced with the same algorithm. The main idea behind this is that the PSFs would not only reflect the blur characteristics of the lens, but of the camera's AA filter and the demosaic algorithm as well.
Logged

joofa
Sr. Member
****
Offline Offline

Posts: 486



« Reply #17 on: January 15, 2010, 07:25:19 PM »
ReplyReply

Quote from: BartvanderWolf
Maybe it's my infamiliarity with the jargon, but isn't that called interpolation instead of reconstruction?

The term reconstruction has a wider usage associated with it. The usage is not restricted to interpolation. Reconstruction can apply to continuous signal obtained by downsampling the samples.  Additionally, "interpolation" has a technical meaning associated to it, viz., that the upsampled/interpolated signal has the same value at original sampling locations. Many approximation theory-based reconstruction methods on the otherhand upsample without regard to this property and may get better mse figures. More over, reconstruction methods can incorporate regularity conditions to restrict reconstructed signal smoothness, which will make them differ from interpolation on the technical grounds mentioned before.

Quote from: Jonathan Wienke
I downloaded some of the PDFs, and found them very interesting reading, especially the one about fast discrete sinc interpolation.

It is not a new thing and a technique known for decades.
« Last Edit: January 15, 2010, 07:33:11 PM by joofa » Logged

Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins
crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #18 on: January 15, 2010, 11:35:10 PM »
ReplyReply

Quote from: BartvanderWolf
Maybe it's my infamiliarity with the jargon, but isn't that called interpolation instead of reconstruction?

Interpolation is one of the ways to reconstruct a function (in this case the pattern of light on the focal plane) from its samples. Reconstruction is by interpolating curves between sample points.

Quote
Again, excuse me, but I find that hard to believe, unless you mean that it attempts to show the original samples. If those are the original pixels, then it is impossible to arrive at your interpolated/reconstructed version without knowledge of how the pattern was supposed to look.

Those are the actual samples. I provided a link to the interpolating code. If you don't have access to Matlab, maybe Jonathan can confirm for you that those are the actual results.

Bart, I know it's hard to believe because it goes against intuition. Sinc interpolation can seem like magic. All it is, is strict application of the sampling theorem - surely you don't think that is invalid!

Quote
But that is the FFT magnitude of the mathematical model, not the aliased image shown at the top of the thread as 100%.

That is the FFT of the 100% image. Again, the original 100% image is not aliased!

Rgds,
Cliff
Logged

Cliff
crames
Full Member
***
Offline Offline

Posts: 210


WWW
« Reply #19 on: January 15, 2010, 11:47:04 PM »
ReplyReply

Quote from: Jonathan Wienke
I downloaded some of the PDFs, and found them very interesting reading, especially the one about fast discrete sinc interpolation. I thought the experiments he did rotating the images in multiple small increments using various resampling techniques were very interesting.

He does seem to be a very smart guy!

Quote
The thought I had was to use some variant of his fast discrete sinc reconstruction filter to do Bayer demosaic interpolation, then apply deconvolution-based lens blur corrections using PSFs derived from images of a special test target shot with the same camera/lens combination and demosaiced with the same algorithm. The main idea behind this is that the PSFs would not only reflect the blur characteristics of the lens, but of the camera's AA filter and the demosaic algorithm as well.

A piece of cake. No, I'm kidding, that sounds really challenging.

Keep me posted, especially if you figure out how to combine reconstruction with demosaicking.

Rgds,
Cliff
Logged

Cliff
Pages: [1] 2 3 ... 7 »   Top of Page
Print
Jump to:  

Ad
Ad
Ad