Pages: [1] 2 3 ... 7   Go Down

Author Topic: Is this Aliasing?  (Read 49858 times)

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« on: January 12, 2010, 09:48:58 pm »

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
Is this Aliasing?
« Reply #1 on: January 12, 2010, 10:53:24 pm »

Not exactly.
« Last Edit: January 12, 2010, 10:56:50 pm by jjlphoto »
Logged
Thanks, John Luke

Member-ASMP

ErikKaffehr

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 11311
    • Echophoto
Is this Aliasing?
« Reply #2 on: January 13, 2010, 01:06:06 am »

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
Erik Kaffehr
 

thierrylegros396

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1947
Is this Aliasing?
« Reply #3 on: January 13, 2010, 03:42:20 am »

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

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
Is this Aliasing?
« Reply #4 on: January 13, 2010, 06:24:18 am »

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, 06:26:22 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

EduPerez

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 700
    • Edu Pérez
Is this Aliasing?
« Reply #5 on: January 13, 2010, 07:43:18 am »

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, 07:44:37 am by EduPerez »
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #6 on: January 13, 2010, 07:18:11 pm »

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, 05:57:33 pm by crames »
Logged
Cliff

joofa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Is this Aliasing?
« Reply #7 on: January 13, 2010, 08:10:49 pm »

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, 08:12:40 pm by joofa »
Logged
Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Is this Aliasing?
« Reply #8 on: January 13, 2010, 08:31:02 pm »

What is a reconstruction filter?
Logged
emil

joofa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Is this Aliasing?
« Reply #9 on: January 13, 2010, 08:46:12 pm »

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
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #10 on: January 13, 2010, 09:16:43 pm »

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, 05:57:11 pm by crames »
Logged
Cliff

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
Is this Aliasing?
« Reply #11 on: January 15, 2010, 03:00:21 am »

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
== If you do what you did, you'll get what you got. ==

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #12 on: January 15, 2010, 09:01:31 am »

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: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #13 on: January 15, 2010, 09:20:16 am »

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
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #14 on: January 15, 2010, 10:27:15 am »

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

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
Is this Aliasing?
« Reply #15 on: January 15, 2010, 11:25:14 am »

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, 11:27:26 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #16 on: January 15, 2010, 11:55:00 am »

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: 544
Is this Aliasing?
« Reply #17 on: January 15, 2010, 08:25:19 pm »

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, 08:33:11 pm by joofa »
Logged
Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #18 on: January 16, 2010, 12:35:10 am »

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
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #19 on: January 16, 2010, 12:47:04 am »

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   Go Up