Down sampling and Nyquist limits

Discussion in 'Digital Photography' started by Scott W, Nov 1, 2006.

  1. Scott W

    Scott W Guest

    But pretty much the discussions of late have been all talk and no one
    showing the effects of their preferred way to limit the higher
    frequencies when down sampling.

    So I have put up an image that if not down sampled well will look like
    crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    bricks.

    There is also in the bottom part of the image a sin wave at 7.69 pixels
    / cycle. This image is meant to test down sampling to 25%, which puts
    the sin wave just past the Nyquist limit. If there were no aliasing in
    the down sampling the sin wave area would turn gray.

    Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    the test is to resize it to 800 x 500 pixels.
    http://www.pbase.com/konascott/image/69543104/original

    This is how I would normally down sample, bicubic followed but USM of r
    R=0.3 and 100%
    http://www.pbase.com/konascott/image/69546848/original
    you can see from my sin wave that I have a lot of aliasing right above
    Nyquist but the image look pretty good over all.

    Now clearly some filtering of the higher frequencies is needed or you
    end up with this.
    http://www.pbase.com/konascott/image/69547582/original

    I don't believe you can get a sharp looking photo if you do not allow
    some alaising at just above Nyquist, but I will be interested in what
    other come up with.

    Scott
    Scott W, Nov 1, 2006
    #1
    1. Advertising

  2. "Scott W" <> writes:

    > But pretty much the discussions of late have been all talk and no one
    > showing the effects of their preferred way to limit the higher
    > frequencies when down sampling.
    >
    > So I have put up an image that if not down sampled well will look like
    > crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    > bricks.
    >
    > There is also in the bottom part of the image a sin wave at 7.69 pixels
    > / cycle. This image is meant to test down sampling to 25%, which puts
    > the sin wave just past the Nyquist limit. If there were no aliasing in
    > the down sampling the sin wave area would turn gray.
    >
    > Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    > the test is to resize it to 800 x 500 pixels.
    > http://www.pbase.com/konascott/image/69543104/original
    >
    > This is how I would normally down sample, bicubic followed but USM of r
    > R=0.3 and 100%
    > http://www.pbase.com/konascott/image/69546848/original
    > you can see from my sin wave that I have a lot of aliasing right above
    > Nyquist but the image look pretty good over all.
    >
    > Now clearly some filtering of the higher frequencies is needed or you
    > end up with this.
    > http://www.pbase.com/konascott/image/69547582/original
    >
    > I don't believe you can get a sharp looking photo if you do not allow
    > some alaising at just above Nyquist, but I will be interested in what
    > other come up with.


    I believe you swapped the URLs to the scaled images. How did you
    produce those scaled versions?

    --
    Måns Rullgård
    =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=, Nov 1, 2006
    #2
    1. Advertising

  3. Måns Rullgård <> writes:

    > "Scott W" <> writes:
    >
    >> But pretty much the discussions of late have been all talk and no one
    >> showing the effects of their preferred way to limit the higher
    >> frequencies when down sampling.
    >>
    >> So I have put up an image that if not down sampled well will look like
    >> crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    >> bricks.
    >>
    >> There is also in the bottom part of the image a sin wave at 7.69 pixels
    >> / cycle. This image is meant to test down sampling to 25%, which puts
    >> the sin wave just past the Nyquist limit. If there were no aliasing in
    >> the down sampling the sin wave area would turn gray.
    >>
    >> Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    >> the test is to resize it to 800 x 500 pixels.
    >> http://www.pbase.com/konascott/image/69543104/original
    >>
    >> This is how I would normally down sample, bicubic followed but USM of r
    >> R=0.3 and 100%
    >> http://www.pbase.com/konascott/image/69546848/original
    >> you can see from my sin wave that I have a lot of aliasing right above
    >> Nyquist but the image look pretty good over all.
    >>
    >> Now clearly some filtering of the higher frequencies is needed or you
    >> end up with this.
    >> http://www.pbase.com/konascott/image/69547582/original
    >>
    >> I don't believe you can get a sharp looking photo if you do not allow
    >> some alaising at just above Nyquist, but I will be interested in what
    >> other come up with.

    >
    > I believe you swapped the URLs to the scaled images.


    No, you didn't. It was me confusing browser windows.

    --
    Måns Rullgård
    =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=, Nov 1, 2006
    #3
  4. "Scott W" <> writes:

    > But pretty much the discussions of late have been all talk and no one
    > showing the effects of their preferred way to limit the higher
    > frequencies when down sampling.
    >
    > So I have put up an image that if not down sampled well will look like
    > crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    > bricks.
    >
    > There is also in the bottom part of the image a sin wave at 7.69 pixels
    > / cycle. This image is meant to test down sampling to 25%, which puts
    > the sin wave just past the Nyquist limit. If there were no aliasing in
    > the down sampling the sin wave area would turn gray.
    >
    > Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    > the test is to resize it to 800 x 500 pixels.
    > http://www.pbase.com/konascott/image/69543104/original
    >
    > This is how I would normally down sample, bicubic followed but USM of r
    > R=0.3 and 100%
    > http://www.pbase.com/konascott/image/69546848/original
    > you can see from my sin wave that I have a lot of aliasing right above
    > Nyquist but the image look pretty good over all.
    >
    > Now clearly some filtering of the higher frequencies is needed or you
    > end up with this.
    > http://www.pbase.com/konascott/image/69547582/original
    >
    > I don't believe you can get a sharp looking photo if you do not allow
    > some alaising at just above Nyquist, but I will be interested in what
    > other come up with.


    IMHO ImageMagick with a sinc or lanczos filter does a slightly better
    job.

    --
    Måns Rullgård
    =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=, Nov 1, 2006
    #4
  5. Scott W

    Alfred Molon Guest

    Here is what I get:

    Lanczos (Irfanview) + USM 50% radius 0.3:
    http://www.ddde.de/test/Lanczos_USM50_0.3.jpg

    Gaussian blur radius 0.7, bilinear downsampling, USM 50% radius 0.3:
    http://www.ddde.de/test/gaussblur0.7_bilinear_USM0.3_50.jpg

    Not too much difference, although the Gaussian blur step helps and makes
    the image more pleasant for the eye. By the way, if you think that I'm
    violating your copyright, simply let me know and I'll remove the images.
    --

    Alfred Molon
    ------------------------------
    Olympus 50X0, 7070, 8080, E300, E330, E400 and E500 forum at
    http://tech.groups.yahoo.com/group/MyOlympus/
    Olympus E330 resource - http://myolympus.org/E330/
    Alfred Molon, Nov 1, 2006
    #5
  6. Scott W

    Scott W Guest

    Alfred Molon wrote:
    > Here is what I get:
    >
    > Lanczos (Irfanview) + USM 50% radius 0.3:
    > http://www.ddde.de/test/Lanczos_USM50_0.3.jpg
    >
    > Gaussian blur radius 0.7, bilinear downsampling, USM 50% radius 0.3:
    > http://www.ddde.de/test/gaussblur0.7_bilinear_USM0.3_50.jpg
    >
    > Not too much difference, although the Gaussian blur step helps and makes
    > the image more pleasant for the eye. By the way, if you think that I'm
    > violating your copyright, simply let me know and I'll remove the images.


    Naw, I am not worried at all about any copy rights on this image, not
    the kind of image I would imagine ever making money on. It is the side
    of my brother in laws house BTW.

    You links however don't seem to be working.

    Scott
    Scott W, Nov 1, 2006
    #6
  7. Scott W

    Scott W Guest

    Scott W wrote:
    > Alfred Molon wrote:
    > > Here is what I get:
    > >
    > > Lanczos (Irfanview) + USM 50% radius 0.3:
    > > http://www.ddde.de/test/Lanczos_USM50_0.3.jpg
    > >
    > > Gaussian blur radius 0.7, bilinear downsampling, USM 50% radius 0.3:
    > > http://www.ddde.de/test/gaussblur0.7_bilinear_USM0.3_50.jpg
    > >
    > > Not too much difference, although the Gaussian blur step helps and makes
    > > the image more pleasant for the eye. By the way, if you think that I'm
    > > violating your copyright, simply let me know and I'll remove the images.

    >
    > Naw, I am not worried at all about any copy rights on this image, not
    > the kind of image I would imagine ever making money on. It is the side
    > of my brother in laws house BTW.
    >
    > You links however don't seem to be working.
    >
    > Scott

    Hmm... maybe it is my browser, when I cut and paste you links they work
    fine.

    Your down sampling looks good, to my eye, but like mine it shows a lot
    of aliasing just above Nyquist. For me I don't think this is a
    problem, but there are a number of people who claim you need to remove
    the frequencies above the Nyquist limit, I believe if you do this the
    down sampled image will either look soft or have a lot of halos
    (ringing ).

    Scott
    Scott W, Nov 1, 2006
    #7
  8. Scott W

    Paul Rubin Guest

    Paul Rubin, Nov 1, 2006
    #8
  9. Scott W

    Bill Tuthill Guest

    Måns Rullgård <> wrote:
    >
    > IMHO ImageMagick with a sinc or lanczos filter does a slightly better job.


    I didn't try Sinc, but Lanczos had to be tweaked with sharpening (-unsharp)
    to come close.

    Downsampling 25% is not a particularly good test, because many algorithms
    produce identical results at that value.
    Bill Tuthill, Nov 2, 2006
    #9
  10. Scott W

    Paul J Gans Guest

    Paul Rubin <http://> wrote:
    >Alfred Molon <> writes:
    >> Lanczos (Irfanview) + USM 50% radius 0.3:
    >> http://www.ddde.de/test/Lanczos_USM50_0.3.jpg
    >>
    >> Gaussian blur radius 0.7, bilinear downsampling, USM 50% radius 0.3:
    >> http://www.ddde.de/test/gaussblur0.7_bilinear_USM0.3_50.jpg
    >>
    >> Not too much difference,


    >The Lanczos one has really blatant moire in the house shingles.


    I think we have a browser problem. I see no moire there at all
    in Firefox. But I see plenty in the white fence in both images.

    ---- Paul J. Gans
    Paul J Gans, Nov 2, 2006
    #10
  11. =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=, Nov 2, 2006
    #11
  12. Scott W

    Paul Rubin Guest

    Paul J Gans <> writes:
    > I think we have a browser problem. I see no moire there at all
    > in Firefox. But I see plenty in the white fence in both images.


    Are we looking at the same image? I'm using Firefox 1.5.0.7 and I
    don't see a white fence. Or do you mean that bar-code like thing that
    I thought was a synthetic test pattern? Yeah that has lots of moire.

    http://www.ddde.de/test/Lanczos_USM50_0.3.jpg
    Paul Rubin, Nov 2, 2006
    #12
  13. Scott W wrote:
    > But pretty much the discussions of late have been all talk and no one
    > showing the effects of their preferred way to limit the higher
    > frequencies when down sampling.
    >
    > So I have put up an image that if not down sampled well will look like
    > crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    > bricks.
    >
    > There is also in the bottom part of the image a sin wave at 7.69 pixels
    > / cycle. This image is meant to test down sampling to 25%, which puts
    > the sin wave just past the Nyquist limit. If there were no aliasing in
    > the down sampling the sin wave area would turn gray.
    >
    > Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    > the test is to resize it to 800 x 500 pixels.
    > http://www.pbase.com/konascott/image/69543104/original
    >
    > This is how I would normally down sample, bicubic followed but USM of r
    > R=0.3 and 100%
    > http://www.pbase.com/konascott/image/69546848/original
    > you can see from my sin wave that I have a lot of aliasing right above
    > Nyquist but the image look pretty good over all.
    >
    > Now clearly some filtering of the higher frequencies is needed or you
    > end up with this.
    > http://www.pbase.com/konascott/image/69547582/original
    >
    > I don't believe you can get a sharp looking photo if you do not allow
    > some alaising at just above Nyquist, but I will be interested in what
    > other come up with.
    >
    > Scott
    >

    I tried box averaging: 4x4, 8x8, 15x15, 16x16, 25x25 pixel
    boxes. ALL showed aliasing in the resulting image.
    That should be expected. 7.69 pixel period does not
    exactly match any of the box sizes.

    Roger
    Roger N. Clark (change username to rnclark), Nov 2, 2006
    #13
  14. Scott W

    Scott W Guest

    Roger N. Clark (change username to rnclark) wrote:
    > Scott W wrote:
    > > But pretty much the discussions of late have been all talk and no one
    > > showing the effects of their preferred way to limit the higher
    > > frequencies when down sampling.
    > >
    > > So I have put up an image that if not down sampled well will look like
    > > crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    > > bricks.
    > >
    > > There is also in the bottom part of the image a sin wave at 7.69 pixels
    > > / cycle. This image is meant to test down sampling to 25%, which puts
    > > the sin wave just past the Nyquist limit. If there were no aliasing in
    > > the down sampling the sin wave area would turn gray.
    > >
    > > Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    > > the test is to resize it to 800 x 500 pixels.
    > > http://www.pbase.com/konascott/image/69543104/original
    > >
    > > This is how I would normally down sample, bicubic followed but USM of r
    > > R=0.3 and 100%
    > > http://www.pbase.com/konascott/image/69546848/original
    > > you can see from my sin wave that I have a lot of aliasing right above
    > > Nyquist but the image look pretty good over all.
    > >
    > > Now clearly some filtering of the higher frequencies is needed or you
    > > end up with this.
    > > http://www.pbase.com/konascott/image/69547582/original
    > >
    > > I don't believe you can get a sharp looking photo if you do not allow
    > > some alaising at just above Nyquist, but I will be interested in what
    > > other come up with.
    > >
    > > Scott
    > >

    > I tried box averaging: 4x4, 8x8, 15x15, 16x16, 25x25 pixel
    > boxes. ALL showed aliasing in the resulting image.
    > That should be expected. 7.69 pixel period does not
    > exactly match any of the box sizes.

    A gaussian blur will do it, but you need a pretty big radius and by
    then the image is looking pretty soft.

    One thing many people done understand about aliasing is that the big
    problem frequencies are not the ones just above the Nyquist limit but
    the ones close to twice the Nyquist limit. These get translated down
    to close to DC and are the patterns we normally think of as moiré

    Scott

    Scott
    Scott W, Nov 2, 2006
    #14
  15. On Wed, 01 Nov 2006 21:07:28 -0700, "Roger N. Clark (change username
    to rnclark)" <> wrote:

    >Scott W wrote:
    >> But pretty much the discussions of late have been all talk and no one
    >> showing the effects of their preferred way to limit the higher
    >> frequencies when down sampling.
    >>
    >> So I have put up an image that if not down sampled well will look like
    >> crap i.e. nearest neighbor shows huge amounts of moiré in the roof and
    >> bricks.
    >>
    >> There is also in the bottom part of the image a sin wave at 7.69 pixels
    >> / cycle. This image is meant to test down sampling to 25%, which puts
    >> the sin wave just past the Nyquist limit. If there were no aliasing in
    >> the down sampling the sin wave area would turn gray.
    >>
    >> Here is the test file to be down sampled, it is 3200 x 2000 pixel and
    >> the test is to resize it to 800 x 500 pixels.
    >> http://www.pbase.com/konascott/image/69543104/original
    >>
    >> This is how I would normally down sample, bicubic followed but USM of r
    >> R=0.3 and 100%
    >> http://www.pbase.com/konascott/image/69546848/original
    >> you can see from my sin wave that I have a lot of aliasing right above
    >> Nyquist but the image look pretty good over all.
    >>
    >> Now clearly some filtering of the higher frequencies is needed or you
    >> end up with this.
    >> http://www.pbase.com/konascott/image/69547582/original
    >>
    >> I don't believe you can get a sharp looking photo if you do not allow
    >> some alaising at just above Nyquist, but I will be interested in what
    >> other come up with.
    >>
    >> Scott
    >>

    >I tried box averaging: 4x4, 8x8, 15x15, 16x16, 25x25 pixel
    >boxes. ALL showed aliasing in the resulting image.
    >That should be expected. 7.69 pixel period does not
    >exactly match any of the box sizes.
    >
    >Roger


    Hi!
    I tried to resample three times, 1: to 1900 pixels long; 2: 1167 p; 3:
    900 p and used "Smartsize" in PSP9. The sizes just ment to be uneven,
    or rather not to be a straight factor if you understand what I mean.
    I think it got almost as good as most of what have been shown so far.
    A bit softer but less artifacts. I think you have to check it at
    several different screenresolutions to minimize the influence of the
    "dotpitch" (LCD).
    /Daniel L.
    Daniel Lindström, Nov 2, 2006
    #15
  16. Scott W

    Bill Tuthill Guest

    Måns Rullgård <> wrote:
    >
    > These are made with ImageMagick convert -filter lanczos/sinc:
    >
    > http://inprovide.com/~mru/junk/lanczos.jpg
    > http://inprovide.com/~mru/junk/sinc.jpg


    They are a bit different (according to composite -compose difference),
    but it's hard to judge one better than the other. Maybe the roof-line
    looks smoother in the Lanczos JPEG.

    Do you think either looks better than the original 25% image presented
    on this thread? The bricks in the chimney aren't as sharp in the Lanczos,
    but OTOH the siding and roofline look smoother.
    http://www.pbase.com/konascott/image/69546848/original

    I don't know what the bar-code area is supposed to look like. I suppose
    the Lanczos and Sinc JPEGs make it look more like the original.
    Bill Tuthill, Nov 2, 2006
    #16
  17. Scott W

    Paul J Gans Guest

    Paul Rubin <http://> wrote:
    >Paul J Gans <> writes:
    >> I think we have a browser problem. I see no moire there at all
    >> in Firefox. But I see plenty in the white fence in both images.


    >Are we looking at the same image? I'm using Firefox 1.5.0.7 and I
    >don't see a white fence. Or do you mean that bar-code like thing that
    >I thought was a synthetic test pattern? Yeah that has lots of moire.


    >http://www.ddde.de/test/Lanczos_USM50_0.3.jpg


    Yeah, that thing. I just assumed it was a fence.
    What *is* it?

    --- Paul J. Gans
    Paul J Gans, Nov 3, 2006
    #17
  18. Scott W

    Scott W Guest

    Paul J Gans wrote:
    > Paul Rubin <http://> wrote:
    > >Paul J Gans <> writes:
    > >> I think we have a browser problem. I see no moire there at all
    > >> in Firefox. But I see plenty in the white fence in both images.

    >
    > >Are we looking at the same image? I'm using Firefox 1.5.0.7 and I
    > >don't see a white fence. Or do you mean that bar-code like thing that
    > >I thought was a synthetic test pattern? Yeah that has lots of moire.

    >
    > >http://www.ddde.de/test/Lanczos_USM50_0.3.jpg

    >
    > Yeah, that thing. I just assumed it was a fence.
    > What *is* it?

    It is a sinwave at with a period that will disappear if there is no
    aliasing when down sampled to 1/4 size. In other words when down
    sampled it would be just past the Nyquist limits. The reason it is
    there is to show that you have to accept some aliasing when down
    sampling if you are going to have an image that looks sharp.

    Scott
    Scott W, Nov 3, 2006
    #18
  19. "Scott W" <> wrote in message
    news:...
    SNIP

    >I don't believe you can get a sharp looking photo if you do not allow
    >some alaising at just above Nyquist, but I will be interested in what
    >other come up with.


    This is my quick attempt:
    <http://www.xs4all.nl/~bvdwolf/temp/Downsampletestimage_IMQ+SS.jpg>

    I used ImageMagick's resize function with the 'Quadratic' filter.
    Sharpening was done with Photoshop CS2 Smart (lens blur) Sharpening,
    0.4 radius, amount 200, with my suggested Luminosity blending layer:
    <http://www.xs4all.nl/~bvdwolf/main/downloads/Non-clipped-sharpening.png>.

    --
    Bart
    Bart van der Wolf, Nov 5, 2006
    #19
  20. Scott W

    Bill Tuthill Guest

    Bart van der Wolf <> wrote:
    >
    > This is my quick attempt:
    > <http://www.xs4all.nl/~bvdwolf/temp/Downsampletestimage_IMQ+SS.jpg>
    > I used ImageMagick's resize function with the 'Quadratic' filter.


    What led you to employ the Quadratic filter? Eyeball-based comparisons?

    > Sharpening was done with Photoshop CS2 Smart (lens blur) Sharpening,
    > 0.4 radius, amount 200, with my suggested Luminosity blending layer:
    > <http://www.xs4all.nl/~bvdwolf/main/downloads/Non-clipped-sharpening.png>.


    I hadn't heard of Smart lens-blur sharpening, which is new in Photoshop CS2.
    Here are several tutorials on it:

    http://www.earthboundlight.com/phototips/smart-sharpen-cs2-and-more.html
    http://photoshoptips.net/2006/03/09/smart-sharpen/
    http://www.eyefetch.com/tutorial-photo-sharpening-101.aspx

    Your use of the lens-blur sharpen filter seems to indicate that the
    original image was taken with a poor camera lens.
    Bill Tuthill, Nov 5, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc
    Replies:
    22
    Views:
    997
    Senti
    Jan 22, 2004
  2. Ramon F Herrera

    What sound format and sampling to use?

    Ramon F Herrera, Jul 7, 2005, in forum: VOIP
    Replies:
    2
    Views:
    6,911
    Morten Reistad
    Jul 21, 2005
  3. musicman
    Replies:
    0
    Views:
    628
    musicman
    Dec 29, 2006
  4. Thierry MARTIN

    netflow v5 sampling / configuration

    Thierry MARTIN, Jul 13, 2007, in forum: Cisco
    Replies:
    2
    Views:
    1,355
    alexandreee
    Jul 29, 2007
  5. Robert Cooze

    mp3's down sampling and wave to mp3's and lame

    Robert Cooze, Jan 6, 2007, in forum: NZ Computing
    Replies:
    16
    Views:
    749
    Lawrence D'Oliveiro
    Jan 11, 2007
Loading...

Share This Page