Luminous Landscape Forum

Equipment & Techniques => Medium Format / Film / Digital Backs – and Large Sensor Photography => Topic started by: LKaven on December 24, 2011, 03:43:53 pm

Title: Detail preserved after downsampling?
Post by: LKaven on December 24, 2011, 03:43:53 pm

One thing that has pleased me about high-resolution sensors is the way in which high-frequency detail appears to be preserved, even after downsampling to prints size, or even to web size.  The difference between my D3x and my D3s was striking even at small sizes.  I can see it in skin, hair, leaves, textures, etc.  I have no experience with the larger sensors, but have noticed the extra detail present in many images posted here.

But what are the factors that explain that?  I had a hypothesis -- that the cutoff of the low pass filtering was different in each case.  I ventured that this was not just a function of the OLP filters in each respective camera (or the lack thereof in some cases), but also a function of the total regimen of oversampling followed by downsampling.  Somewhere up near the Nyquist limit, the D3s starts to fragment.  In comparison at the same output size (12MP or less in this case), the D3x would produce good high-frequency detail.  This was illustrated in a quick experiment that Lloyd Chambers did with these cameras, photographing the label on a soup can and noting the smoothness of the text in the D3x capture when downsampled to 12MP, in comparison to the fragmented text D3s capture (at it's native resolution).

In an exchange with Bob Newman over at DPR, Bob suggested that I need look no further than the difference between the OLP filters on these two cameras.  The D3x does of course have a more gentle filter considered as a function of sampling frequency.  But I wonder if Bob's claim is true?  I asked Bob if a D3s with no OLP filter would produce output as detailed -- or more so -- than a D3x image downsampled to the same resolution.  Bob believes the answer is yes. 

Is that correct?  I had surmised that there were more factors involved with this.  For example, I had always thought of a downsampling filter as being in essence a LPF, with a cutoff that might vary somewhat in slope, depending upon the method.  I feel that surely I am getting additional benefits from supersampling and other processing that manifests itself in the retention of detail after downsampling.  But I don't have either the empirical or analytical tools at hand to resolve this question. 

Among those of you here who have investigated in this area, do you have either an empirical or analytical answer to this, or just a good hypothesis? 

Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 26, 2011, 01:33:47 pm
Hmm...  Too wordy?  Wrong forum?
Title: Re: Detail preserved after downsampling?
Post by: eronald on December 26, 2011, 04:42:13 pm
Hmm...  Too wordy?  Wrong forum?

I think anyone capable of answering that question is on vacation :)

Actually, I don't know if anyone has done the necessary tests to determine the transfer characteristics of the D3x and D3s. I know that some people have been using 5D2 cameras and even Nex7 without  filter, and of course many of us have MF without such.

Edmund
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 27, 2011, 06:00:00 am
Hmm...  Too wordy?  Wrong forum?

Hi Luke,

It's hard to comment on something you have noticed but I have not, because I use different cameras. Theoretically, at the amount of downsampling ("even to web size") you mention, the only factors can be the MTF curves of both your capture systems combined with the downsampling method used. An optical low-pass filter will barely have any influence on the spatial frequencies that remain after downsampling.

Proper downsampling will eliminate as much as possible all spatial frequencies that cannot be reliably represented in the downsampled image, and do so before downsampling. The filter used for that can make a difference on how exactly the transition from wanted to unwanted detail is shaped, a Lanczos windowed Sinc filter is generally considered being close to a best compromise.

A free commandline utility like ImageMagick allows to do that (the default filter for downsampling is Lanczos), and the result can even be improved by adding a Gamma linearization before the downsampling, in the same Convert command.

I'd be a bit surprised if there were significant differences visible between two almost identical images taken with the same lens and two different bodies. I do agree that it's hard to beat the look of a well downsampled image, almost without any of the possible aliasing artifacts.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 27, 2011, 11:51:37 am
Hi Luke,

It's hard to comment on something you have noticed but I have not, because I use different cameras. Theoretically, at the amount of downsampling ("even to web size") you mention, the only factors can be the MTF curves of both your capture systems combined with the downsampling method used. An optical low-pass filter will barely have any influence on the spatial frequencies that remain after downsampling.

I think one can compare cameras more broadly.  I picked the D3s/D3x not just because I have them, but because they are the same sized sensors.  I'm not sure that matters though.

It did also seem to me that the OLPF would not explain the difference entirely, and that there would have to be a difference in the total MTF of the two systems.  But I'm not sure where that difference would be.  I'd like to see those two respective curves somehow. 

I did look up Lloyd Chambers' experiment.  Cereal box, not soup can.  It's about 2/3 of the way down the page:
http://diglloyd.com/diglloyd/2009-01-blog.html

Quote
Proper downsampling will eliminate as much as possible all spatial frequencies that cannot be reliably represented in the downsampled image, and do so before downsampling. The filter used for that can make a difference on how exactly the transition from wanted to unwanted detail is shaped, a Lanczos windowed Sinc filter is generally considered being close to a best compromise.

A free commandline utility like ImageMagick allows to do that (the default filter for downsampling is Lanczos), and the result can even be improved by adding a Gamma linearization before the downsampling, in the same Convert command.

Thanks for the recommendation.  I have had a hard time finding a convenient Laczos filter that I can incorporate into my workflow.  I was hoping ImageJ had it, but it doesn't seem to.  Irfanview does it, but only at 8 bits.  Too bad there isn't a photoshop plugin that can invoke ImageMagick calls. 

Quote
I'd be a bit surprised if there were significant differences visible between two almost identical images taken with the same lens and two different bodies. I do agree that it's hard to beat the look of a well downsampled image, almost without any of the possible aliasing artifacts.

I wonder if I shouldn't interpret that antialiasing as a kind of high-frequency detail retention as well.  A smooth curve in comparison to the jagged curve has additional high-frequency components, and it seems that's mostly it, or what?  I'm not sure I know why "antialiasing" as a concept does any more work than that, except to speak specifically about perception in a narrow, practical sense.  [And the same I suppose might go for color gradations as distributed across the image surface, which have frequency components of their own.]

To recap:
The image from a high-resolution sensor with H megapixels, after being downsampled to L megapixels (L < H), appears to retain more high-frequency information than an image captured with a native L megapixel sensor when both are examined at L megapixel resolution.

Hypothesis: This would be explained by a difference in the total MTF between the two systems, especially approaching the high-frequency cutoff.  But what are the differences?

Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 27, 2011, 01:15:43 pm
Theoretically, at the amount of downsampling ("even to web size") you mention, the only factors can be the MTF curves of both your capture systems combined with the downsampling method used. An optical low-pass filter will barely have any influence on the spatial frequencies that remain after downsampling.
I do believe that the lack of OLPF can cause aliasing into low frequencies (even "DC") that may be visible not matter what the downsampling factor is?

-h
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 27, 2011, 02:58:56 pm
Thanks for the recommendation.  I have had a hard time finding a convenient Laczos filter that I can incorporate into my workflow.  I was hoping ImageJ had it, but it doesn't seem to.  Irfanview does it, but only at 8 bits.  Too bad there isn't a photoshop plugin that can invoke ImageMagick calls.

On the other hand, in Windows you can make a batch file in the "SendTo" folder, which will allow to Right Mouse Button click an image file and produce a smaller version (e.g. 800x800 pixels maximum for Web use). Or one can place a batchfile on the desktop and drag-n-drop image files on it, or use a batchfile to process an entire subdirectory with image files, and save the reduced size files to another subdirectory. 

Quote
To recap:
The image from a high-resolution sensor with H megapixels, after being downsampled to L megapixels (L < H), appears to retain more high-frequency information than an image captured with a native L megapixel sensor when both are examined at L megapixel resolution.

Hypothesis: This would be explained by a difference in the total MTF between the two systems, especially approaching the high-frequency cutoff.

That's most likely what you're experiencing, a higher MTF response near the Nyquist frequency.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 27, 2011, 03:04:05 pm
I do believe that the lack of OLPF can cause aliasing into low frequencies (even "DC") that may be visible not matter what the downsampling factor is?

Hi -h,

That's correct, but it's unlikely to be information that will help the downsampled image achieve that sharper look the OP is experiencing. Aliasing is a crap-shoot, you rarely get what you want.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 27, 2011, 04:18:31 pm
That's most likely what you're experiencing, a higher MTF response near the Nyquist frequency.

So would you agree with me that this is caused by factors above and beyond a difference in OLP filters?  In other words, if neither the L-resolution camera nor the H-resolution camera had OLP filters, there would still be an advantage (in high frequency detail, up near the Nyquist limit of L) to the H-resolution image even after it was downsampled to L-resolution?
Title: Re: Detail preserved after downsampling? How far down?
Post by: BJL on December 27, 2011, 04:33:55 pm
A question and a couple of thoughts, not scientifically tested at all:

Question: how far are you downsampling and still sensing a difference?

1) 2x linear (4x in pixel count) is the minimum for the JPEG or TIFF or whatever to have even one pixel of each color in the collection used to produce each output pixel, going the lower pixel count image has it's pixel count reduced by les than 4x, I can see why it might have less sharpeners.

2) In practice, demosaicing algorithms use a weighted average of data from many nearby pixels, not just the nearest ones of the needed color, so could it be that the "footprint" of each output pixel covers date for, say three or four photosites in each direction, which would mean that only when one goes past about 6x to 8x linear downsampling (36x to 64x pixel count reduction) is the smearing due to this process completely gone?

3) Downsampling can increase the SNR of the output pixels, so could downsampling from more sensor pixels give more local contrast and thus perceived sharpness in some cases?


P.S. in the experiment you describe, of a 12MP RGB output file format (so R, G, B values at each of 12 million locations) from a 12MP Bayer CFA camera (6 million green, 3 million each red and blue) and a 24MP camera (12 million green, 6 million each or red and blue) it would not at all surprise me that the latter gives more resolution, because the 12MP RGB output file format can hold more information than either sensor delivers, and specifically more luminosity information than the 12MP sensor gives, since that is based mostly or entirely on values from green pixels. Also, in each case, the output luminosity values rely on raw data from locations other than that of the output pixel: even the 12 million green pixels of the 24MP sensor are not at the same places as those of the output file.
Title: Re: Detail preserved after downsampling?
Post by: ErikKaffehr on December 27, 2011, 04:47:01 pm
Hi,

I may jump conclusions but I have two observations:

1) Both D3X and D3s have OLP (antialiasing filter), but the OLP on the D3X is optimized for 24 MP while the one on D3S is optimized for 12 MP. So the D3X will smear out detail far less than the D3S.

2) Downscaling an image will introduce aliasing, which my cause the perception of improved detail.

Best regards
Erik

One thing that has pleased me about high-resolution sensors is the way in which high-frequency detail appears to be preserved, even after downsampling to prints size, or even to web size.  The difference between my D3x and my D3s was striking even at small sizes.  I can see it in skin, hair, leaves, textures, etc.  I have no experience with the larger sensors, but have noticed the extra detail present in many images posted here.

But what are the factors that explain that?  I had a hypothesis -- that the cutoff of the low pass filtering was different in each case.  I ventured that this was not just a function of the OLP filters in each respective camera (or the lack thereof in some cases), but also a function of the total regimen of oversampling followed by downsampling.  Somewhere up near the Nyquist limit, the D3s starts to fragment.  In comparison at the same output size (12MP or less in this case), the D3x would produce good high-frequency detail.  This was illustrated in a quick experiment that Lloyd Chambers did with these cameras, photographing the label on a soup can and noting the smoothness of the text in the D3x capture when downsampled to 12MP, in comparison to the fragmented text D3s capture (at it's native resolution).

In an exchange with Bob Newman over at DPR, Bob suggested that I need look no further than the difference between the OLP filters on these two cameras.  The D3x does of course have a more gentle filter considered as a function of sampling frequency.  But I wonder if Bob's claim is true?  I asked Bob if a D3s with no OLP filter would produce output as detailed -- or more so -- than a D3x image downsampled to the same resolution.  Bob believes the answer is yes. 

Is that correct?  I had surmised that there were more factors involved with this.  For example, I had always thought of a downsampling filter as being in essence a LPF, with a cutoff that might vary somewhat in slope, depending upon the method.  I feel that surely I am getting additional benefits from supersampling and other processing that manifests itself in the retention of detail after downsampling.  But I don't have either the empirical or analytical tools at hand to resolve this question. 

Among those of you here who have investigated in this area, do you have either an empirical or analytical answer to this, or just a good hypothesis? 


Title: Re: Detail preserved after downsampling?
Post by: BJL on December 27, 2011, 05:02:09 pm
To combine comments on OLP filters with mine about demosaicing algorithms: does it make sense that to avoid aliasing, the OLPF should be limited to the lowest spatial resolution of each color, meaning to the resolution of the 6 million red (and 6 million blue) pixels in a 12MP Bayer CFA camera? If so, green resolution gets squashed down to that level too, suggesting that downsampling to anything above about half the camera's pixel count will have resolution limited by the OLPF/sensor combination rather than the downsampled pixel count.
Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 27, 2011, 05:46:02 pm
To combine comments on OLP filters with mine about demosaicing algorithms: does it make sense that to avoid aliasing, the OLPF should be limited to the lowest spatial resolution of each color, meaning to the resolution of the 6 million red (and 6 million blue) pixels in a 12MP Bayer CFA camera? If so, green resolution gets squashed down to that level too, suggesting that downsampling to anything above about half the camera's pixel count will have resolution limited by the OLPF/sensor combination rather than the downsampled pixel count.
My guess would be that the OLPF is a compromise between the spatial resolution of each color channel (slightly blurry for the green, slightly aliasy for red/blue).

-h
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 27, 2011, 06:50:41 pm
To combine comments on OLP filters with mine about demosaicing algorithms: does it make sense that to avoid aliasing, the OLPF should be limited to the lowest spatial resolution of each color, meaning to the resolution of the 6 million red (and 6 million blue) pixels in a 12MP Bayer CFA camera? If so, green resolution gets squashed down to that level too, suggesting that downsampling to anything above about half the camera's pixel count will have resolution limited by the OLPF/sensor combination rather than the downsampled pixel count.
Sounds like you are suggesting two possible sources for increased image fidelity, both of which seem plausible.  They seem to involve (1) Offset of R->R pixels, B->B pixels, and variously, G->G pixels, and (2) Blur radius of OLPF

In the case of (1) we're talking about a sampling frequency for each color component {R,G,B}, and suggesting that downsampling beyond that frequency offers a threshold of fidelity.

In the case of (2) we're talking about averaging out the effects of smearing in the OLPF to the point where they go from being consequential to being inconsequential.

Have I got this approximately right? 
Title: Re: Detail preserved after downsampling? MTF for D3X and D3S
Post by: ErikKaffehr on December 27, 2011, 11:37:07 pm
Hi,

MTF using Imatest based on D3X and D3S based on test images from The Imaging Resource.

First case: Both imported by default setting in LR

Second case: Both exported as JPEG in Lightroom, scaled to D3S image size using Lightroom, default settings.

Best regards
Erik
Title: Re: Detail preserved after downsampling? MTF for D3X and D3S Bicubic Sharper
Post by: ErikKaffehr on December 28, 2011, 12:08:07 am
Hi,

This compares LR conversion of D3S with LR converted D3X tiff downscaled with bicubic sharper. It seems that bicubic sharper sharpens significantly but also has very high MTF at Nyquist.

The enclosed crops show aliasing effects on the downsampled Nikon D3X image (the one on top). The bottom image is actual pixels from D3S. The image is at 200% for easier viewing.

Note: When the D3X arrived it outresolved the test target Imaging Review used, so they photographed it at doublie distance. The D3S was tested with a newer test target of higher resolution. For the MTF measurement this does not matter.

Best regards
Erik


Hi,

MTF using Imatest based on D3X and D3S based on test images from The Imaging Resource.

First case: Both imported by default setting in LR

Second case: Both exported as JPEG in Lightroom, scaled to D3S image size using Lightroom, default settings.

Best regards
Erik
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 28, 2011, 02:51:04 am
Erik, this is beautiful!  I'm sleep-reading them now.  Shh.  More when I wake up.
Title: Re: Detail preserved after downsampling?
Post by: BJL on December 28, 2011, 09:37:59 am
Erik,

    Thanks for all those graphs.

What do the red lines marked with suffix  "(corr)" signify?

Do the results showing sharpening with bicubic down sampling go with the comment in the thread on "N7 downsampled vs M9" http://www.luminous-landscape.com/forum/index.php?topic=60303.msg486061#msg486061 about the hazards of comparing downsampled to unsharpened images?

Or is it instead that by passing through JPEG conversion first, as in your first set of graphs, some sharpness advantage of the D3X files is lost?

Either way, it makes me realize how difficult resolution and sharpness comparisons are due to the intervention of different demosaicing algorithms and such.


P.S. I found the following reference explaining "(corr)". Those curves are with some standardized sharpening, which tries to compensate for the different sharpening in images from different sources. So this does seem the best comparison to use, and it also indicates the sharpening in bi-cubic down sampling from the D3X, since this sharpened red curve is no higher than the unsharpened curve.

http://www.imatest.com/docs/sharpness_comparisons/
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 28, 2011, 11:21:05 am
This really helps to address some key questions about the benefits or otherwise of high resolution sensors.  

I too was curious about MTF50(CORR).  I see Imatest has a reference page on measuring sharpness, but I couldn't find reference to it there.  Perhaps I needed to drill down further.
http://www.imatest.com/docs/sharpness/

I'm focusing on the TIF test, which doesn't involve questions about JPG artifacts and conversion.

It seems that the downsampled D3x image has significantly higher MTF than the native D3s image.  If I'm taking MTF50(CORR) to be the relevant comparison, there seems to be some advantage to the D3x image just beginning around 1000 LP/PH, and becoming somewhat significant by 1500 LP/PH.  I had not expected to see such a broad difference, but more of a difference up around the Nyquist frequency of the D3s sensor.  Am I reading it correctly?  It makes me wonder how other factors of conversion, downsampling method, sharpening, etc, figure into the results.

Do I also read correctly that the edge profile is sharper on the D3x, but also has a "ring," possibly an artifact of bicubic sharper?  I wonder how that would fare using Lanczos windowing?

This is really useful data, Erik, and I'm looking forward to seeing your interpretation.
Title: Re: Detail preserved after downsampling?
Post by: Chris Livsey on December 28, 2011, 01:39:52 pm
I think I am correct in that the RAW files from Nikon (and others) are not "pure" data but are manipulated by the software in the camera before writing. In that case if the software algorithms between the D3x and the s are different, and given they are different sensors they should be, the differences seen when files are processed externally in the same way to the same file size may be partially down to the "optimisation" deemed correct by the software internally.
So is the effect of downsampling larger sensors yet retaining detail as reported found in other "families" eg the Sony range SLR the Phase One range MF ? Is it a provable effect or subjective? (Not against subjective BTW).
Title: Re: Detail preserved after downsampling?
Post by: ErikKaffehr on December 29, 2011, 02:15:10 am
Hi,

Imatest, the program I used uses a concept of standardized sharpening to take into account the different amount of sharpening in the processing pipeline. Black lines are measured MTF data and the red ones are corrected for "standard" sharpening. As both data sets were converted using same settings in Lightroom I'd suggest that the black curves would be comparable.

Best regards
Erik



Erik,

    Thanks for all those graphs.

What do the red lines marked with suffix  "(corr)" signify?

Do the results showing sharpening with bicubic down sampling go with the comment in the thread on "N7 downsampled vs M9" http://www.luminous-landscape.com/forum/index.php?topic=60303.msg486061#msg486061 about the hazards of comparing downsampled to unsharpened images?

Or is it instead that by passing through JPEG conversion first, as in your first set of graphs, some sharpness advantage of the D3X files is lost?

Either way, it makes me realize how difficult resolution and sharpness comparisons are due to the intervention of different demosaicing algorithms and such.


P.S. I found the following reference explaining "(corr)". Those curves are with some standardized sharpening, which tries to compensate for the different sharpening in images from different sources. So this does seem the best comparison to use, and it also indicates the sharpening in bi-cubic down sampling from the D3X, since this sharpened red curve is no higher than the unsharpened curve.

http://www.imatest.com/docs/sharpness_comparisons/
Title: Re: Detail preserved after downsampling?
Post by: ErikKaffehr on December 29, 2011, 03:21:37 am
Luke,

Regrading comparing the TIFF and JPEG cases I would say that JPEG artifacts is a red herring. It is a very high quality JPEG conversion and I don't think possible JPEG artifacts upset Imatest.

I hope that other posters, more knowledgeable than me will chime in. Here is what I saw:

1) The JPEG images:

(http://echophoto.dnsalias.net/ekr/images/Articles/Luke1/Images/MTFLightroomExport.jpg)

Here I can see that the two conversions are very similar. In this case I wouldn't expect to see benefits from the higher resolution of the D3X nor significant artifacts.

2) Bicubic sharper

(http://echophoto.dnsalias.net/ekr/images/Articles/Luke1/Images/MTFBicubicSharper.jpg)

In this case I see two key differences, one is the higher MTF at medium frequencies in the scaled down image. The other one is that MTF around Nyquist is rather high in the downscaled image. According to most sources MTF exceeding 20-30% at Nyquist frequency would cause problems with aliasing.

3) Aliasing

(http://echophoto.dnsalias.net/ekr/images/Articles/Luke1/Images/ResolutionAliasing.jpg)

Both images show contrast inversion on the resolution target. The D3X (on top) shows it around 13  while D3S (bottom) shows it around 25. The D3X image is using an old version of the target photographed at double distance.

Both images are here at same size, the D3X image downsampled using bicubic sharper. Note that "Bicubic sharper" added some visible halos around the numbers.

I would recommend these two articles by Bart van der Wolf:

http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample.htm

http://bvdwolf.home.xs4all.nl/main/foto/down_sample/example1.htm


Best regards
Erik


This really helps to address some key questions about the benefits or otherwise of high resolution sensors.  

I too was curious about MTF50(CORR).  I see Imatest has a reference page on measuring sharpness, but I couldn't find reference to it there.  Perhaps I needed to drill down further.
http://www.imatest.com/docs/sharpness/

I'm focusing on the TIF test, which doesn't involve questions about JPG artifacts and conversion.

It seems that the downsampled D3x image has significantly higher MTF than the native D3s image.  If I'm taking MTF50(CORR) to be the relevant comparison, there seems to be some advantage to the D3x image just beginning around 1000 LP/PH, and becoming somewhat significant by 1500 LP/PH.  I had not expected to see such a broad difference, but more of a difference up around the Nyquist frequency of the D3s sensor.  Am I reading it correctly?  It makes me wonder how other factors of conversion, downsampling method, sharpening, etc, figure into the results.

Do I also read correctly that the edge profile is sharper on the D3x, but also has a "ring," possibly an artifact of bicubic sharper?  I wonder how that would fare using Lanczos windowing?

This is really useful data, Erik, and I'm looking forward to seeing your interpretation.
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 29, 2011, 09:10:11 am
Hmm.  Erik, is it your feeling that

(1) all of the increase in MTF in the bicubic sharpening case is explained wholly by the sharpening?

(2) the downsampled JPG conversion accurately represents the RAW image such that Imatest results are not being skewed by compression artifacts? 

I'm always wary of bicubic sharper down downsampling.  It always seems to produce a ring and I wouldn't use it as standard.  But this makes me wonder what is the optimal way to downsample an image in a case like this.

For example, among things various people have mentioned as a part of their regimen: would one deconvolve (to solve for the OLPF) as a standard sharpening before downsampling, would one blur slightly to reduce antialiasing before downsampling, would one use say a Lanczos windowed SINc to downsample?  What would be optimal?

Finally, there's one thing that an Imatest target doesn't capture, and that is color gradation and fidelity, the enhancement of which adds to the perception of detail. 
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 29, 2011, 10:33:01 am
Luke,

Regrading comparing the TIFF and JPEG cases I would say that JPEG artifacts is a red herring. It is a very high quality JPEG conversion and I don't think possible JPEG artifacts upset Imatest.

I hope that other posters, more knowledgeable than me will chime in. Here is what I saw:

1) The JPEG images:
[...]
Here I can see that the two conversions are very similar. In this case I wouldn't expect to see benefits from the higher resolution of the D3X nor significant artifacts.

Indeed, quite similar.

Quote
2) Bicubic sharper
[...]
In this case I see two key differences, one is the higher MTF at medium frequencies in the scaled down image. The other one is that MTF around Nyquist is rather high in the downscaled image. According to most sources MTF exceeding 20-30% at Nyquist frequency would cause problems with aliasing.

The downsampling filter did boost the medium frequencies but also introduced halos and aliasing artifacts. I wouldn't use Photoshop's "Bicubic sharper" because of that behavior. Regular bicubic is much better behaved, but by no means ideal. A Lanczos filter does much better in keeping sharpness, and avoiding aliasing artifacts as much as possible. 

Quote
3) Aliasing
[...]
Both images are here at same size, the D3X image downsampled using bicubic sharper. Note that "Bicubic sharper" added some visible halos around the numbers.

The "Bicubic sharper" halos are as predicted in my articles that you linked to. It beats me why Photoshop still doesn't offer a choice for Lanczos when downsampling, where Lightroom has a better (almost as good as Lanzos) downsampling filter.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 29, 2011, 10:49:03 am
Hmm.  Erik, is it your feeling that

(1) all of the increase in MTF in the bicubic sharpening case is explained wholly by the sharpening?

One could repeat the downsampling with Bicubic (regular) and see what difference the 'sharper' version introduces, or one could compare with a Lanczos filtered downsample, which is considerd close to ideal.

Quote
(2) the downsampled JPG conversion accurately represents the RAW image such that Imatest results are not being skewed by compression artifacts?

There are differences, e.g. in actual gamma and tonemapping and depending on the degree of compression, but Imatest attempts to reduce the influence of those by using oversampling, thus benefitting from statistical averaging of errors. The best input for Imatest are Raw conversions with linear gamma.  

Quote
For example, among things various people have mentioned as a part of their regimen: would one deconvolve (to solve for the OLPF) as a standard sharpening before downsampling, would one blur slightly to reduce antialiasing before downsampling, would one use say a Lanczos windowed SINc to downsample?  What would be optimal?

Deconvolution sharpening before downsampling doesn't help, and could possibly hurt the result. Preblurring is mandatory to reduce aliasing artifacts, and Lanczos is considered to be close to optimal.

Quote
Finally, there's one thing that an Imatest target doesn't capture, and that is color gradation and fidelity, the enhancement of which adds to the perception of detail. 

Imatest performs all sorts of tests, including color accuracy.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 29, 2011, 11:48:03 am
Bart, what would you consider to be the optimal pre-blur radius for downsampling?
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 29, 2011, 12:14:40 pm
Bart, what would you consider to be the optimal pre-blur radius for downsampling?

Luke,

Anything that's going to be smaller than 1 pixel in the downsampled image will add to the aliasing risk. So with, say 7:1 downsampling, a radius of 3.5 should theoretically cover it, but what weight to give to those pixels to preserve some of the information / resolution / average color ..., enters Lanczos.

A Gaussian blur as implemented in Photoshop would need to have a much smaller radius, because it will also include many more pixels outside of the required radius, thus causing a very soft result. As I described in the articles that Erik linked to, for a downsampling factor of 7, I would use a radius of about 7 x 0.25 = 1.8 for a quick fix before downsampling with PS Bicubic, and apply some sharpening to the result. But it'll be inferior to a straight Lanczos downsample in ImageMagick.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: madmanchan on December 29, 2011, 12:50:09 pm
There is a tradeoff in the resample kernel.  You can preserve more details with a so-called "sharpening" kernel like the one used in Bicubic Sharper but you may see edge-halo artifacts in some cases, depending on the magnitude of the negative lobe in the kernel.  If you use a kernel without any negative lobes (like a Gaussian) you can reduce aliasing, but your results will also be softer.  You can try to do the optimal thing for aliasing using a (windowed) sinc filter like Lanczos, but then you can (often will) get other problems -- e.g., ringing (*). 

There are also limits of detail preservation, regardless of what resample method you choose.  As a simple example, if you choose your output image to be 1 pixel in size (1 pixel high, 1 pixel wide), I think it should be clear you're not going to see much detail regardless of what resolution you started from, or what resample kernel you used.    ;D

Eric


(*) In other words, just because an kernel is optimal or nearly optimal for one property -- e.g., aliasing -- does not mean it is optimal for other aspects of image quality.  See Don Mitchell's SIGGRAPH paper on reconstruction filters, for example.
Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 29, 2011, 02:09:39 pm
Deconvolution sharpening before downsampling doesn't help, and could possibly hurt the result. Preblurring is mandatory to reduce aliasing artifacts, and Lanczos is considered to be close to optimal.
This is interesting. I would have thought that the following steps would be closer to optimal:
1. Use deconvolution to obtain an array properly lowpass-filtered according to Nyquist (i.e. maximize flatness in the passband below fs/2, maximize attenuation above fs/2).
2. Use a proper resampling filter (I consider the analog prototype filter shape to be integral to the resampling process). Lanczos order2/3 or some other similar passband/stopband/spatial-ringing trade-off.
3. Sharpen to taste (and according to deficiencies in output medium).

-h
Title: Re: Detail preserved after downsampling?
Post by: LKaven on December 29, 2011, 03:03:05 pm
This is interesting. I would have thought that the following steps would be closer to optimal:
1. Use deconvolution to obtain an array properly lowpass-filtered according to Nyquist (i.e. maximize flatness in the passband below fs/2, maximize attenuation above fs/2).
...

That's what I thought; but I admit, I don't have a clear reason for it.  I wonder why Bart doesn't recommend that. 
Title: Re: Detail preserved after downsampling?
Post by: BJL on December 29, 2011, 03:35:08 pm
Erik,

    About your comment that
Quote
...  MTF around Nyquist is rather high in the downscaled image. According to most sources MTF exceeding 20-30% at Nyquist frequency would cause problems with aliasing.
I would think that this aliasing worry only applies to the Nyquist frequency of the signal before down sampling. But I appeal to the local signaling processing authorities for advice on this!
Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 29, 2011, 04:43:49 pm
Erik,

    About your comment thatI would think that this aliasing worry only applies to the Nyquist frequency of the signal before down sampling. But I appeal to the local signaling processing authorities for advice on this!
Not sure if this is what you are asking, but generally when you are doing resampling from rate r1 to rate r2, the lowpass filter needs to have sufficient attenuation at and above min(r1/2,r2/2).

If a 1000x1000 pixel image, when downscaled to 100x100 pixels shows a lot of energy at 50 lp/pw (or ph) for wide-band input, I believe there is reason to be concerned about aliasing.

-h
Title: Re: Detail preserved after downsampling?
Post by: BJL on December 29, 2011, 05:01:30 pm
Not sure if this is what you are asking, but generally when you are doing resampling from rate r1 to rate r2, the lowpass filter needs to have sufficient attenuation at and above min(r1/2,r2/2).
OK, I see that ... but is it not possible, starting with a signal at a higher sampling rate r1, to filter with a near brick-wall filter in the digital domain, cutting off at r2/2, so that the guideline of MTF < 20-30% does not apply? I am guessing that this 20-30 guideline relates to the limitations of analogue low-pass filtering (as with OLPF's), not to the greater flexibility possible with DSP. Though it probably does not matter for the case at hand, where no MTF curve looks vaguely like a brick-wall, and all of them have significant signal above f(Nyquist).

Another point: from a 24MP Bayer CFA sensor, I think that the pixel spacing relevant to the Nyquist frequency for green is the spacing of the green pixels, which is sqrt(2) times pixels width (and for R and B the Nyquist frequency is lower) while for 12MP down-sampled output with full RGB data at each point, the relevant spacing is the width of the new, bigger pixels ... which is sqrt(2) times the original pixels, and so equals the spacing of green pixels. So it seems that the Nyquist frequency is no lower for the downsampling 12MP full RGB output than for the 24MP Bayer CFA input, and is if anything higher for the R/B "colour" information, where aliasing is most noticeable.
Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 29, 2011, 05:13:28 pm
OK, I see that ... but is it not possible, starting with a signal at a higher sampling rate r1, to filter with a near brick-wall filter in the digital domain, cutting off at r2/2, so that the guideline of MTF < 20-30% does not apply? I am guessing that this 20-30 guideline relates to the limitations of analogue low-pass filtering (as with OLPF's), not to the greater flexibility possible with DSP. Though it probably does not matter for the case at hand, where no MTF curve looks vaguely like a brick-wall, and all of them have significant signal above f(Nyquist).
Talking only about linear, space-invariant filtering here.

Brick-wall filters have a tendency to have large kernels, leading to issues with spatial ringing. The "ideal" filter from a passband/stopband optimization view would be an infinite sinc(x) function. I believe that the same can be achieved in practice for a finite image by processing in the 2-d DFT domain.

"Lanczos" filters are a trade-off where the infinite sinc(x) function is windowed so as to narrow down the kernel, leading to less brick-wall-like frequency domain behaviour. This is an example of "design by windowing" as opposed to directly calculating the kernel from some set of constraints. Usually, direct synthesis has more degrees of freedom to satisfy the constraints, but it seems that lanczos are pretty close to what most people prefer.

This whitepaper from 21 years ago sums it up pretty well, I think:
http://www.realitypixels.com/turk/computergraphics/ResamplingFilters.pdf

See also this:
http://downloads.bbc.co.uk/rd/pubs/whp/whp-pdf-files/WHP092.pdf
Quote
In these tests, two types of filter frequency characteristic were used. One was a practical implementation of a well-known sharp-cut filter (the ITU Rec. 601[1] channel-filter), and the other a softer filter that avoids ringing or overshoots (the Modified Raised Cosine filter).
...
Each of these two filters consists of 43 taps, and may be called a prototype. The Rec. 601 prototype filter has a rise-time (the 10 – 90 % edge rise-time) of 2 pixels and the Modified Raised Cosine prototype filter has a rise-time of 4 pixels.
...
the filtering process was modified to include a conversion to light-proportional signals by raising the unfiltered signals to a power, filtering and then raising the result to the reciprocal power. The power chosen was 2.35
...
the ‘ringing’ on edges caused by the Rec. 601 filtering serves to give a subjective impression of increased sharpness which allows the rise-time to be increased to give the same degree of apparent sharpness,
...
The most important result is that, when using the sharp-cut “Rec. 601” filter, the average visible limit of edge rise-time lies in the range 0.997 to 1.111 minutes of arc, with a confidence of 95%. Interestingly, the generally accepted figure for visual acuity is approximately 1 minute of arc.
Quote
Another point: from a 24MP Bayer CFA sensor, I think that the pixel spacing relevant to the Nyquist frequency for green is the spacing of the green pixels, which is sqrt(2) times pixels width (and for R and B the Nyquist frequency is lower) while for 12MP down-sampled output with full RGB data at each point, the relevant spacing is the width of the new, bigger pixels ... which is sqrt(2) times the original pixels, and so equals the spacing of green pixels. So it seems that the Nyquist frequency is no lower for the downsampling 12MP full RGB output than for the 24MP Bayer CFA input, and is if anything higher for the R/B "colour" information, where aliasing is most noticeable.
If you have aliasing at the capture stage, you may struggle with it later on no matter how much you downsample. Imagine a classical western-movie with wagon-wheels that seem to roll backwards or stand still due to the 24fps capture rate. If the movie is "resampled" to 12fps or 60fps, those problems will still be a problem, since the violation of Nyquists sampling theoreme means that the information is ambiguous.

I do believe that a "perfect" OLPF would have a higher spatial cutoff for the green channel than red/blue, but I imagine that it would be hard to make. As each sensel is not a point-sampler, but have an extent of its own, the optimal PSF for the color-channel-dependent OLPF may be non-trivial.

-h
Title: Detial and downsampling
Post by: joofa on December 29, 2011, 05:19:13 pm
Those of you who are photographers and want image detail (with or without downsampling) on real images, which you capture with your camera (and not some junky nerd lab rat who can't think beyond decades old and outdated MTF charts  ;D), can use my freely available detail measure plugin for Photoshop CS3 or Photoshop Elements 8, from the website link in my signature. This tool will let you run detail measure on the whole image or an area selection using the PS marquee tool, as shown below, which is useful for finding detail measures in different parts of an image:

(http://djjoofa.com/data/images/jidm.jpg)

Note that detail measure is reported in [0-1] range with higher numbers indicative of more detail. I ran the JDM on a whole image shown above with various downsmapling methods in PS and got the following:

Origianl image: 0.0835
Downsampling using:
- Nearest Neighbor: 0.1156
- Bilinear: 0.0879
- BiCubic: 0.0750
- BiCubic Smoother: 0.0617
- BiCubis Sharper: 0.0853

You can also download the free Raw Import plugin from the same download page and play around with detail measure (and/or other analyses) on separate R,G1,G2,B channels using the Raw Import plugin. And, free yourself of the issues such as which MTF chart to use, distance to an MTF chart, slanted this or that, sensor size, image size, size normalized or not, hey wait I can't see the lines, oops the light is not uniform, blah, blah, blah ...

Hope you find it useful.

Sincerely,

Joofa
Title: Re: Detial and downsampling
Post by: ErikKaffehr on December 29, 2011, 05:33:14 pm
Hi,

So your tool finds that "bicubic sharper" yields more detail. But it is real detail or fake detail?! In the case I tested it clearly produced visible haloes.

Best regards
Erik


Those of you who are photographers and want image detail (with or without downsampling) on real images, which you capture with your camera (and not some junky nerd lab rat who can't think beyond decades old and outdated MTF charts  ;D), can use my freely available detail measure plugin for Photoshop CS3 or Photoshop Elements 8, from the website link in my signature. This tool will let you run detail measure on the whole image or an area selection using the PS marquee tool, as shown below, which is useful for finding detail measures in different parts of an image:

(http://djjoofa.com/data/images/jidm.jpg)

Note that detail measure is reported in [0-1] range with higher numbers indicative of more detail. I ran the JDM on a whole image shown above with various downsmapling methods in PS and got the following:

Origianl image: 0.0835
Downsampling using:
- Nearest Neighbor: 0.1156
- Bilinear: 0.0879
- BiCubic: 0.0750
- BiCubic Smoother: 0.0617
- BiCubis Sharper: 0.0853

You can also download the free Raw Import plugin from the same download page and play around with detail measure (and/or other analyses) on separate R,G1,G2,B channels using the Raw Import plugin. And, free yourself of the issues such as which MTF chart to use, distance to an MTF chart, slanted this or that, sensor size, image size, size normalized or not, hey wait I can't see the lines, oops the light is not uniform, blah, blah, blah ...

Hope you find it useful.

Sincerely,

Joofa

Title: Re: Detial and downsampling
Post by: joofa on December 29, 2011, 05:40:58 pm
Hi,

So your tool finds that "bicubic sharper" yields more detail. But it is real detail or fake detail?! In the case I tested it clearly produced visible haloes.

Best regards
Erik



It measures the "perceived" sharpness in an image, even if introduced by image filtering. So actually it does agree with PS BiCubic Sharper being "sharper" than BiCubic and BiCubic smoother. So you can use it to find a measure of "sharpening ratio" after applying a sharpening step on an image:

(http://djjoofa.com/data/images/jisr_pks.jpg)

Joofa

Title: Re: Detial and downsampling
Post by: joofa on December 29, 2011, 06:52:04 pm
I ran the JIDM on a whole image shown above with various downsmapling methods in PS and got the following:

Origianl image: 0.0835
Downsampling using:
- Nearest Neighbor: 0.1156
- Bilinear: 0.0879
- BiCubic: 0.0750
- BiCubic Smoother: 0.0617
- BiCubic Sharper: 0.0853

Joofa


According to JIDM, apparently downsampling (50%) by BiCubic and BiCubic Smoother in Photoshop actually reduces image detail (sharpness) compared to the original image, where as BiCubic sharper results in a little sharper than the original. What this reveals is that PS implementation of BiCubic and BiCubic Smoother is attenuating more signal in the passband than perhaps what is desired, for the asked downsampling ratio (50%). Apparently, as a conjecture, PS implementation of these algorithms might shown quite different response for a different downsampling ratio (guess based upon BiCubic theory) - the bottom line being PS downsampling is not good enough.

Joofa
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 29, 2011, 07:08:59 pm
This is interesting. I would have thought that the following steps would be closer to optimal:
1. Use deconvolution to obtain an array properly lowpass-filtered according to Nyquist (i.e. maximize flatness in the passband below fs/2, maximize attenuation above fs/2).

In actual practice there isn't something like a brick-wall filter, it would also introduce ringing. We're forced to seek a compromise.

Quote
2. Use a proper resampling filter (I consider the analog prototype filter shape to be integral to the resampling process). Lanczos order2/3 or some other similar passband/stopband/spatial-ringing trade-off.

As I have been saying, a Lanczos windowed Sinc filter is close to optimal.

Quote
3. Sharpen to taste (and according to deficiencies in output medium).

Yes, but be careful because you'll (re)introduce stairstepping (=aliasing artifacts).

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: Bart_van_der_Wolf on December 29, 2011, 07:15:58 pm
Erik,

    About your comment that I would think that this aliasing worry only applies to the Nyquist frequency of the signal before down sampling. But I appeal to the local signaling processing authorities for advice on this!

That's correct, it only tells that there is some signal (e.g. stair-stepping, or accidental signal alignment with the sensel grid) which is a potential cause for aliasing upon further postprocessing.

Cheers,
Bart
Title: Re: Detail preserved after downsampling?
Post by: hjulenissen on December 29, 2011, 07:23:43 pm
My understanding is based on simplified linear systems theory. Perhaps the reason for not doing deconvolution early on is that it is (usually) nonlinear?
In actual practice there isn't something like a brick-wall filter, it would also introduce ringing. We're forced to seek a compromise.
Sure, but it the lense/OLPF/... introduce significant loss of signal in the passband, it seems sensible to fix it "close to the problem". I meant brick-wall in the loosest possible form, and should probably have said "some nice lowpass shape with passband < fs/2"

I do believe that brick-wall-filtering is _possible_ for limited-duration signals using DFTs? A finite-length sequence contains a finite amount of samples and can be fully described by a finite set of frequency coefficients. Set the desired gain in the DFT-domain, and you have (if desired) brick-wall filtering. The same caveats about frequency-domain vs spatial-domain design trade-offs, though.
Quote
As I have been saying, a Lanczos windowed Sinc filter is close to optimal.
This is common knowledge, but what are the conditions for this optimality? Is it only "looks good to me"? What is implied about the source image (gamma?) Or can one insert subjectively motivated constraints into something like the remez algorithm and see the lanczos popping out?
Quote
Yes, but be careful because you'll (re)introduce stairstepping (=aliasing artifacts).
According to some photographers, aliasing is much preferred over Nyquistian sampling. I can see why this can be true if you have complete control over the image chain and are willing to fiddle with pixels until it looks "good".

-h