Luminous Landscape Forum

Raw & Post Processing, Printing => Digital Image Processing => Topic started by: marvpelkey on May 01, 2013, 12:27:56 am

Title: Most favourable up-ressing percentage
Post by: marvpelkey on May 01, 2013, 12:27:56 am
Not the best Subject heading to describe my question. And am looking at this topic from a layman's perspective so my question may seem somewhat naive, however...

Disregarding the printing stage for a moment.

I have read over the various algorithms associated to up-ressing and am wondering if there is any difference in quality between up-ressing an image by whole numbers i.e. 2x, 3x, 4x etc, as opposed to fractional numbers i.e. 1.5x, 2.3x or any other fractional number.

I realize the various algorithms are probably designed to  arrive at the best product, regardless, but it seems to me that whole number enlarging would/should have some advantage as it relates to control of artifacts and the quality of reproduction.

As an example, and I don't know if there is an algorithm that already does this (nearest neighbour??) but if one took an image and up-ressed it 2x in both length and height (so 400% in area), by taking the first pixel (if width is a - z and height is 1 - 10), which would be a1 and when up-ressed, that pixel would now be a1, a2, b1 and b2. A2 would now be c1, c2, d1, d2 and on it goes. As each original pixel is a single tone/hue it seems to make sense that replicating this exact tone/hue in 4 pixels would result in a larger image with the exact tone/hue and, perhaps even more importantly, sharpness as the original (so if perfectly sharpened to begin with, no sharpening would be required after up-ressing). Logic (at least in my simple mind) suggests this method would not introduce artifacts nor would the tone/colours of the new image need to "invented". The same could be done at 3x or 4x etc.

I realize restricting up-ressing to certain sizes would be impractical in some applications.

And I'm sure someone will provide an answer that will cause me to go "Doh, of course, why didn't I think of that?"

Marv

Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 01, 2013, 09:42:08 am
Not the best Subject heading to describe my question. And am looking at this topic from a layman's perspective so my question may seem somewhat naive, however...

Disregarding the printing stage for a moment.

I have read over the various algorithms associated to up-ressing and am wondering if there is any difference in quality between up-ressing an image by whole numbers i.e. 2x, 3x, 4x etc, as opposed to fractional numbers i.e. 1.5x, 2.3x or any other fractional number.

Hi Marv,

Fundamentally, interpolation is the process of using known data to estimate values at unknown locations. There are several methods in common use to do those estimations. Most of those methods preserve the values of the original locations if they happen to coincide with the original locations. The real issue becomes, how credible are the estimates at the unknown locations.

Quote
I realize the various algorithms are probably designed to  arrive at the best product, regardless, but it seems to me that whole number enlarging would/should have some advantage as it relates to control of artifacts and the quality of reproduction.

Unfortunately, in most natural images, that is not the case. As said, the values at the original locations will usually be preserved as closely as possible, but in the case of exact integer magnification factors there is zero information available in between the original locations.

So where does that new information come from then? Well, that's where the pixels that are surrounding the new location come into play. Have a look at the attached example cases of a single line fragment where one pixel needs to be inserted, and can give hugely different results (e.g. from 40 to 200), also (especially) depending on the surrounding pixel values that are not immediate neighbors.

The simplest interpolation just copies a the nearest known pixel value, Nearest Neighbor interpolation. That will not invent new values, it only uses the ones already known for sure, but they are probably quite wrong for the new location. It does indeed cause horrible edge detail, stair-stepping and other blocking patterns.

A somewhat more accurate interpolation is a bi-linear interpolation (like case 1 in the example), which takes a kind of average of the 4 closest (in 2D space) surrounding pixel values. While that produces better results, and fewer (edge) artifacts, it also is very soft, and low contrast.

An already much better interpolation method is by taking a weighted average of the 16 nearest pixel values with a BiCubic interpolation algorithm, which makes a smoother/non-linear transition between the different values.

As more and more surrounding pixel values are taken into account, and their contribution is weighted more elaborately, the original contrast and sharpness is preserved best at the new locations, while remaining smooth edged. It also becomes less and less relevant to only use integer magnification factors. However, the price to be paid is that the guess can also be wrong enough to produce noticeable artifacts, especially around abrupt jumps in contrast amidst an otherwise smooth surrounding (ringing artifacts). Clever algorithms allow dynamic adaptation of the interpolation algorithm to the local contrast situation.

Here (http://pixinsight.com/doc/docs/InterpolationAlgorithms/InterpolationAlgorithms.html) is a more technical write-up about some commonly used algorithms, with some examples for comparison. These algorithms are universal enough that they don't really care about integer magnification factors or those with decimal fractions.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Jim Kasson on May 01, 2013, 10:47:11 am
Well said, Bart.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 01, 2013, 06:13:15 pm
Thanks for the kind words Jim, you're welcome.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: marvpelkey on May 01, 2013, 11:46:33 pm
Bart,

Much thanks for the detailed response, and the link.

When I posed the questions, I kinda figured I was looking at things from a too-simplistic perspective.

Thanks again.

Marv
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on May 02, 2013, 02:24:18 am
If you are using scaling that can be classified as "linear (multirate) filtering based on Nyquistian (re) sampling", there are some consequences of using small integer factors. This cathegory includes most "traditional" resampling.

A practical, fast image scaler may be more accurate at certain "phases" than others. You never know except trial and error, but chances are that it will be closer to the idealized filter response for a factor of 2.0 than a factor of 2.01. In a good (IQ-focused) design this should not matter that much.

All scaling has artifacts. If your input contains highly regular (typically aliased) high-frequency material (fences, roof-tiles, birds feathers,...), these artifacts may give rise to patterns that are quite visible. If you keep your resampling factor to an integer, these patterns will tend to have a small period, that may be less annoying.

For most (properly sampled) real images, this should probably should be low on your list of worries.

-h
Title: Re: Most favourable up-ressing percentage
Post by: Schewe on May 02, 2013, 02:50:30 am
All scaling has artifacts. If your input contains highly regular (typically aliased) high-frequency material (fences, roof-tiles, birds feathers,...), these artifacts may give rise to patterns that are quite visible. If you keep your resampling factor to an integer, these patterns will tend to have a small period, that may be less annoying.

I agree, it's been my experience that upsampling (using your tool of choice) is better done in amounts like 2X, 4X because intermediate %'s can cause artifacts as hjulenissen hints.

The key is to upsample to above the final size/res you may need, apply sharpening and other tricks (like adding noise/grain) and only down sample to get to your final output PPI (360/720 Epson, 300/600 Canon & HP).

Here's an older article about upsampling that is still useful-The Art Of The Up-Res (http://www.digitalphotopro.com/technique/software-technique/the-art-of-the-up-res.html). I've had no problem upsampling 200% and if the original is photographically excellent, 400%. Higher upsampling can be done with exotic tools and techniques and the success largely is dictated by the final output. A glossy paper can render enormous detail and large upsampling can suck. Textured watercolor or canvas can hide a lot of resampling issues.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 02, 2013, 04:08:07 pm
All scaling has artifacts.

Hi,

Correct (unless one wants to settle for a very low resolution version), in practice one attempts to create an interpolated result with values at the new locations that can exceed the local values, unlike a bi-linear result which has very low contrast. However, some algorithms produce better results than others, in most cases (including non-integer magnification factors) of properly processed continuous tone images.

Quote
If your input contains highly regular (typically aliased) high-frequency material (fences, roof-tiles, birds feathers,...), these artifacts may give rise to patterns that are quite visible. If you keep your resampling factor to an integer, these patterns will tend to have a small period, that may be less annoying.

For up-sampling, that depends on the original image content, which should not be sharpened enough to be aliased (IOW proper capture sharpening, and not more than that). It also depends on the resampling algorithm, but that can be tested quite easily.

To test the quality of the resampling algorithm, one can use an image filled with uniform (white) noise, and preform a Fast Fourier Transform (FFT) on it after resampling. That will reveal  potential issues with the algorithm (although it requires a bit of knowledge about interpretation of Fourier transforms, i.e. lossless spatial domain to frequency domain transforms).

Here are e.g. the results of 3 different algorithms/filters on a 200% magnification, and the yellow circle indicates the Nyquist frequency (the default ImageJ result displays the Logarithm of the transform, to amplify the visibility of any weaker signal levels towards the corners):

(http://bvdwolf.home.xs4all.nl/temp/LuLa/FFT_200pct_01.png) (http://bvdwolf.home.xs4all.nl/temp/LuLa/FFT_200pct_01.png)

The Bicubic Smoother algorithm at the left is performing it's interpolation in the horizontal and vertical direction (possibly in 2 separate passes, for speed reasons). That also results in a higher diagonal resolution, the central noisy area extends closer to the Nyquist limit. Also clear is that that approach creates (mostly) horizontal and vertical (overshoot/ringing/aliasing) artifacts, and limits the horizontal and vertical resolution to some 62% of the new dimensions (so we have gained a little hor/ver resolution, but also some artifacts).

The middle FFT is of a 200% up-sampled noise image with ImageMagick, using the Elliptical Weighted Average (EWA) resampling method (-distort Resize). That EWA resampling results in more balanced resolution in all directions and angles. The Lanczos filter windowed resampling, produces the same horizontal and vertical resolution and less diagonal resolution, but also less aliasing (the signal levels outside the Nyquist circle are lower), but is also not (ringing) artifact free in the horizontal and vertical dimensions.

The example at the right is also an EWA resampling in ImageMagick, but this time the Robidoux windowing filter was used, which produces much higher horizontal and vertical resolution (equal to the diagonal resolution of an orthogonal resampling method), but also some more ringing and some aliasing in all directions, although mostly in horizontal and vertical directions.

Just for fun, I also tested Benvista's Photozoom Pro although it's main forte is adding new edge detail resolution. Here is the result of a 200% up-sample with the S-Spline Max algorithm:

(http://bvdwolf.home.xs4all.nl/temp/LuLa/FFT_200pct_02.png) (http://bvdwolf.home.xs4all.nl/temp/LuLa/FFT_200pct_02.png)

It too shows signs of orthogonal resampling, but no very prominent ringing or aliasing artifacts. There is some noise aliasing, but very evenly spread in all directions.  The actual up-sampled noise looks quite pleasant and well defined. Again, Photozoom's forte is in adding edge detail and resolution, but that doesn't show in an image with only random noise.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on May 02, 2013, 04:48:22 pm
The key is to upsample to above the final size/res you may need, apply sharpening and other tricks (like adding noise/grain) and only down sample to get to your final output PPI (360/720 Epson, 300/600 Canon & HP).
No scaling after sharpening, right?

I believe that DVDs could have looked a lot better today if they had a reasonable, linear response. Rather, I believe that many are heavily sharpened for 480/576-line TVs that were the norm once, making it hard to do good resampling to todays 1080p displays.

-h
Title: Re: Most favourable up-ressing percentage
Post by: Schewe on May 02, 2013, 05:40:01 pm
No scaling after sharpening, right?

Correct...
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on May 03, 2013, 05:29:15 am
For up-sampling, that depends on the original image content, which should not be sharpened enough to be aliased (IOW proper capture sharpening, and not more than that). It also depends on the resampling algorithm, but that can be tested quite easily.
Ideally, a scaler should be able to take _any_ image content at, say, 1000x1000 pixels, and blow it up to 1042x1042 while keeping its appearance as close as possible to the original (apart from size, of course).

Properly pre-filtered/sampled natural images are easier to scale (at least when using algorithms based upon theory that assumes properly pre-filtered/sampled data) than highly aliased text, OLPF-less cameras etc.

Applications such as PhotoAcute rely upon "improper sampling" (along with image series that are near duplicates, but with minute random shifts) to produce a single "scaled" output image that is claimed to be 2x - 4x the resolution.

-h
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 03, 2013, 11:22:39 am
I agree, it's been my experience that upsampling (using your tool of choice) is better done in amounts like 2X, 4X because intermediate %'s can cause artifacts as hjulenissen hints.

Hi Jeff,

That's a bit strange. Even when using the Bicubic Smoother up-sampling algorithm, which is not very good when compared to some others, testing does not reveal a significant difference when factors of 2x or more are used.

Here follows a stacked pyramid of up-sampled images (uniform noise, therefore complex high contrast amplitudes in random directions), from 400% re-sampling at the bottom to 200% resampling at the top, with 10% increments.

(http://bvdwolf.home.xs4all.nl/temp/LuLa/UniformNoise_200-400pct.png) (http://bvdwolf.home.xs4all.nl/temp/LuLa/UniformNoise_200-400pct-anim.gif)
When you click on the image, it should load an animated GIF version.


As you may see, the 5 pixel wide borders of the exposed lower images show that only the contrast gets a bit lower (because pixels are spread over more pixels), and that the diagonals remain relatively sharper than the horizontal and vertical edges (as was shown earlier in the Fourier Transform, due to the relatively Sqrt(2) higher diagonal resolution in an orthogonal resampling). That also means that these up-sampled images can be sharpened to recover the contrast loss due to the up-sampling (which does not add new detail, besides potential artifacts).

More importantly, there is no visible indication of suddenly better interpolation quality at the 200, and 400% image sizes.

Once the image is resampled by 200% or more, additional/intermediate pixel positions are added, the original source pixels just get over-sampled at their new locations. The only losses are due to the resampling algorithm (adding various artifacts), not specifically due to the amount of non-integer up-sampling.

I've also attached 4 samples of an up-sampled (200%, 210%, 220%, and 230%)  quadrant of a zoneplate (http://bvdwolf.home.xs4all.nl/temp/LuLa/QuarterZoneplate.png) with original detail from very low at the bottom right corner, to 0.5 cycles per pixel (1 cycle per 2 pixels) in the diagonal direction at the top left corner. The resampling was done with ImageMagick with EWA resampling (-distort Resize) with the default Robidoux filter, to allow comparison with your own preferred method.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: langier on May 03, 2013, 01:54:26 pm
Why not try out some of your concepts and see what works best for you? Doesn't have to be an extensive test, but what works for others in their workflow may not work as well for you.

As for me, I use one of several ways.

First things first, though, start with your best technique--best camera and lens combo, tripod, great technique, highest quality settings, critical aperture, great subject, good lighting and expsoure.

If I know I'm going large, I start with my highest-res camera. If available in ACR, I may up-res the image there. If that isn't enough, then I'll interpolate in Photoshop 6.x, usually using "automatic" interpolation. Sometimes, I'll use Perfect Resize. There's a number of different programs and plug-ins out there, most that you can download and try.

Try several different ways and see what works best for you and you'll do fine!
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 04, 2013, 08:02:50 am
there is no visible indication of suddenly better interpolation quality at the 200, and 400% image sizes.

Here is another way of looking at it, I've plotted the noise power spectra of the up-sampled uniform noise image. The images were upsampled with the state of the art EWA algorithm, with the default ImageMagick Robidoux filter.

(http://bvdwolf.home.xs4all.nl/temp/LuLa/ResampledPowerspectra.png)

(http://bvdwolf.home.xs4all.nl/temp/LuLa/ResampledPowerspectra2.png)

I've scaled the horizontal dimensions in the chart to the 200% upsampled version. All that basically happens, is that the lower spatial frequencies become a bit easier to quantify (because there are more pixels to do so), and there is more micro detail signal beyond Nyquist (because there are more pixels in the larger images). It is not adding any real detail, just more accurate artifacts (halo, ringing) but at a lower amplitude than the actual detail.

Again, there are no significant benefits for image quality from using only integer resampling factors. Good algorithms are flexible enough to perform quite well under all scenarios.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on May 04, 2013, 02:59:28 pm
Again, there are no significant benefits for image quality from using only integer resampling factors. Good algorithms are flexible enough to perform quite well under all scenarios.

Cheers,
Bart
I'd say that the scaling algorithms of ImageMagick seems to be state-of-the-art when it comes to "traditional" scaling. Most people do scaling within whatever application they do their image processing work within, and those will often be of a simpler design than those of mr. Robidoux.

-h
Title: Re: Most favourable up-ressing percentage
Post by: jrsforums on May 04, 2013, 04:47:58 pm
I'd say that the scaling algorithms of ImageMagick seems to be state-of-the-art when it comes to "traditional" scaling. Most people do scaling within whatever application they do their image processing work within, and those will often be of a simpler design than those of mr. Robidoux.

-h

I have no problem with Bart using what he feels is a "state-of-the-art" algorithm to make his example. 

While some of the math and examples he uses are, at times, lost on me, he has shown, in this post and others, that there are significantly better interpolation algorithms than the state-of-the-"past" Bicubic implemented by Adobe. 

If the requirement is to "do scaling within whatever application", Perfect Resize and Photozoom Pro provide superior routines and repeatable, consistent results than can be received using "secret incantations" with bicubic.

While ImageMagick Robidoux filter might require a "round trip" with a tiff, I suspect it is quite easier than some of the methods suggested using bicubic.

The last method Bart has mention, and the one I use, is Qimage Ultimate.  WHich, while outside the image processor used, is by far the simplest (once learned)...but that is a subject for a different thread.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on May 05, 2013, 10:48:09 am
I'd say that the scaling algorithms of ImageMagick seems to be state-of-the-art when it comes to "traditional" scaling. Most people do scaling within whatever application they do their image processing work within, and those will often be of a simpler design than those of mr. Robidoux.

Hi,

While that may be the case (although the "-distort Resize" method was actually already available for several years, but is now simpler to execute), it makes one wonder why e.g. Photoshop doesn't offer more state of the art resampling ...? A number of the newer features, e.g. lens distortion correction and perspective/keystone correction, are now based on a mediocre resampling foundation.

Besides all that, the above demonstrated insensitivity to either fractional or integer magnification even applies to Bicubic Smoother, so it is not only a feature of better resampling algorithms. To demonstrate that, I've also done the Noise Power Spectrum analysis on the same image after resampling it with Bicubic Smoother. Again, no sudden jumps in quality for 200% or 400% compared to the intermediate fractions, the higher spatial frequencies gradually lose absolute per-pixel resolution because there are more pixels for the same source detail:

(http://bvdwolf.home.xs4all.nl/temp/LuLa/ResampledPowerspectra3.png)

(http://bvdwolf.home.xs4all.nl/temp/LuLa/ResampledPowerspectra4.png)

As indicated, the pattern of detail loss is similar for all magnification factors of 200% or more. There is a difference with the earlier mentioned EWA circular sampling which causes symmetrical resolution in any direction, because the Bicubic algorithms create a higher diagonal resolution than in the horizontal/vertical directions (as shown earlier in the Fourier transforms). There will also be more ringing and aliasing in the horizontal and vertical direction, compared to the EWA sampling (as indicated by the Fourier transforms shown earlier). Therefore the spectra for Bicubic resampling as shown are an average for all directions, and will fluctuate with direction.

For those wondering what the Noise spectrum of the original uniform noise image that was used for the resampling looks like, it's basically a horizontal line (all spatial frequencies, covering the full spectrum, are present without attenuation or boosts).

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 22, 2014, 02:24:28 pm
Bart:

Would you be kind enough to show the corresponding plots for the following ImageMagick methods (all with the default 3 lobes)?

tensor Lanczos (-filter Lanczos -resize)

EWA LanczosRadius (-filter LanczosRadius -distort resize)

EWA LanczosSharpest (-filter lanczos -define filter:blur=0.88549061701764 -distort resize)

With thanks.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 22, 2014, 02:33:11 pm
Bart:

Could you also add EWA LanczosSharpest 4 (-filter Lanczos -define filter:lobes=4 -define filter:blur=0.88451002338585141 -distort Resize)?

For reference, all these methods are briefly documented in the Masters thesis of my former student Adam Turcotte http://web.cs.laurentian.ca/nrobidoux/misc/AdamTurcotteMastersThesis.pdf (http://web.cs.laurentian.ca/nrobidoux/misc/AdamTurcotteMastersThesis.pdf)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 23, 2014, 07:53:52 am
Here is another way of looking at it, I've plotted the noise power spectra of the up-sampled uniform noise image. The images were upsampled with the state of the art EWA algorithm, with the default ImageMagick Robidoux filter.
...
Bart:
Although the Robidoux filter, like all well-designed Elliptical Weighted Averaging methods, is isotropic when resizing and preserving the aspect ratio, it is applied to filter values laid out on a grid, which breaks the rotational symmetry. Do I understand correctly that the Robidoux noise power spectra plots were not the results of averaging in all directions, like you did for the Bicubic Smoother ones? I do understand that the difference may be small, but if possible I'd like to compare apples to apples.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 23, 2014, 10:42:47 am
Bart:

Would you be kind enough to show the corresponding plots for the following ImageMagick methods (all with the default 3 lobes)?

tensor Lanczos (-filter Lanczos -resize)

EWA LanczosRadius (-filter LanczosRadius -distort resize)

EWA LanczosSharpest (-filter lanczos -define filter:blur=0.88549061701764 -distort resize)

With thanks.


Hi Nicolas,

This is how a comparison of these resampling filters works out, both in a logarithmic FFT Power spectrum of White noise, and the same as plotted by spatial frequencies (the average radial profile of the plots), see attachments. I've used a 300% upsampling with different methods/filters as a comparison, not because 300% is more special in any way than say 290% or 310%, but more for safety because it allows to upsample and (deconvolution) sharpen a D800 file in Photoshop while staying below 2GB which may trigger memory issues with some plugins, yet big enough to see issues.

To add my interpretation based mostly on these graphs:
The EWA methods indeed produce circularly symmetric results with equal sharpness at all angles, in contrast to the tensor type of resampling in horizontal and vertical directions, which creates higher diagonal resolution in a rectangular pixel grid. The EWA sharpness is uniform at all angles, and there are progressively also relatively few aliasing artifacts added to the interpolated (additional) pixels.

Default EWA Robidoux filtering results in a relatively high modulation of spatial frequencies at and slightly beyond the Nyquist frequency of the original image content. It also has a relatively low modulation in the region where aliasing can be expected, but it tends to show a bit more/sharper stair-stepping after deconvolution sharpening.
The EWA Lanczos variants have a sharper modulation cut-off at the original image's Nyquist frequency which should reduce the contribution of high modulation aliasing just beyond Nyquist. However, as usual with Lanczos types of filters, there will be some ringing artifacts at sharp edges unless additional local regularization is performed.

It's not easy to declare a simple quality ranking, because it depends on image content. In general I prefer the EWA resampling because of its uniform sharpness, irrespective of edge orientation. The EWA Lanczos filtered methods all preform quite well, except for the ringing artifacts which may be an issue for some types of image content. The default EWA Robidoux filter seems to produce a bit less ringing, but more stair-stepping (which may be less of an issue with e.g. a final output resampling to 600 or 720 PPI, but more of an issue with significant resampling to 300/360 PPI printed output).

I have not extensively tested all these filters at multiple (non-)integer resampling factors, but I assume there will be not too much of a difference since these filters are not tuned for a single specific spatial frequency only, but more for general resampling. As always, the method one uses should be tested for the intended use, because some artifacts may be less important at certain viewing distances, and some subject matter benefits more than others.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 23, 2014, 11:22:18 am
Bart:
Although the Robidoux filter, like all well-designed Elliptical Weighted Averaging methods, is isotropic when resizing and preserving the aspect ratio, it is applied to filter values laid out on a grid, which breaks the rotational symmetry. Do I understand correctly that the Robidoux noise power spectra plots were not the results of averaging in all directions, like you did for the Bicubic Smoother ones? I do understand that the difference may be small, but if possible I'd like to compare apples to apples.

Hi Nicolas,

All the Power spectrum plots are averaged radial profiles, with equal weighting at all angles. I just used the ImageJ 'Radial Profile' plug-in to generate the chart data which was copied and pasted in Excel to combine multiple plots. As the FTT power specta show (do remember that they are logarithmic by ImageJ default, so with boosted lower amplitudes), the EWAs have much cleaner performance beyond the original image's Nyquist frequency, and the tensor Lanczos filter also is 'cleaner' than the Photoshop Bicubic Smoother filter for aliasing artifacts (but not for ringing artifacts unless addressed additionally).

The Robidoux filter, as can be seen in the logarithmic FFT Power Spectrum in the previous post, is indeed rotationally not as uniform as the EWA Lanczos versions. Upsampling of a zoneplate (rings) image, produces very clean results with 'EWA Lanczos Radius' and 'EWA Lanczos Sharpest 4' filters, the 'EWA Lanczos Sharper' shows more stair-stepping than both.

So for normal image content, not excessively sharpened yet, these may be very good for general up-sampling of properly AA-filtered image content. The risk of ringing is reduced when edge sharpness in the original image is moderate, or when adaptively reducing the amount of amplitude boost by choosing a different filter.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 23, 2014, 01:58:05 pm
Bart:

Thank you. Very much.

-----

Your comments match what I know.

For example, even though it is not mentioned in http://www.imagemagick.org/Usage/filter/nicolas/ (http://www.imagemagick.org/Usage/filter/nicolas/) which is slowly going stale, I now recommend EWA LanczosSharpest 4 for some types of content, and I am now more fond of EWA Robidoux (more for downsampling than upsampling, though) and EWA LanczosRadius than I previously was.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 23, 2014, 02:20:02 pm
The reason there is no pre-defined "LanczosSharpest" filter in ImageMagick right now is that I was focusing on 3-lobe methods when the door was open to add named methods, and "LanczosSharpest 3" is not that good.
When I have a minute, I may address this state of affairs.
Title: Re: Most favourable up-ressing percentage
Post by: digitaldog on March 23, 2014, 02:32:38 pm
Why not try out some of your concepts and see what works best for you? Doesn't have to be an extensive test, but what works for others in their workflow may not work as well for you.
If we're talking images being sent to some large output (or why size up?), I totally agree. Looking at synthetic images sharpened on-screen with differing methods is interesting. But most care what a print looks like after sizing and you have to make that print. I've tried different techniques and products but the final evaluation is an 8x11 print off my 3880 representing a small part of what would be a much bigger print. At this point, the several 3rd party products tested didn't provide anything other than much slower processing compared to using Lightroom or ACR for initial size and capture sharpening (which is more critical to the results than the actual upsizing processes, at least visibly on a print). Same with step interpolating.
Title: Re: Most favourable up-ressing percentage
Post by: David Eichler on March 23, 2014, 07:14:05 pm
No scaling after sharpening, right?


To which Schewe answered "correct".

However, what about this comment from Schewe above: "The key is to upsample to above the final size/res you may need, apply sharpening and other tricks (like adding noise/grain) and only down sample to get to your final output PPI (360/720 Epson, 300/600 Canon & HP)." As I understand Schewe's comments, one should upsample in even amounts (2x, 4x, etc.) to whatever it takes to get just larger than the final output size/res, sharpen and apply other final touches, and then downrez to the final output size/res without any additional sharpening or other final processing. Or have I misunderstood?
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 23, 2014, 10:12:35 pm
No scaling after sharpening, right?

To which Schewe answered "correct".

However, what about this comment from Schewe above: "The key is to upsample to above the final size/res you may need, apply sharpening and other tricks (like adding noise/grain) and only down sample to get to your final output PPI (360/720 Epson, 300/600 Canon & HP)."

Hi David,

As far as I understand Jeff, he generally suggests to upsample if the output resolution is below 300 / 360 PPI, or to 600 / 720 if output resolution is above 300 / 360, and downsample if resolution is above 600 / 720 PPI.

Personally, I would disagree about resampling after sharpening, because resampling in general reduces resolution and sharpening after resampling is usually beneficial.

Quote
As I understand Schewe's comments, one should upsample in even amounts (2x, 4x, etc.) to whatever it takes to get just larger than the final output size/res, sharpen and apply other final touches, and then downrez to the final output size/res without any additional sharpening or other final processing. Or have I misunderstood?

That seems to be his advice, but again I disagree. I have not seen anything that substantiates any benefit of integer/even resampling factors. In fact, most resampling algorithms are totally scale agnostic and will treat any resampling exactly the same way, totally scale invariant. In theory, it would be possible to devise an algorithm that benefits a specific scaling factor slightly more than other factors, but it would be impracticable for general use.

There is a demonstrable benefit to treating down-sampling differently compared to up-sampling, but even that is usually ignored by the generic resampling routines. Most software delivers rather sub-standard quality when it comes down to resampling, unfortunately (because it is avoidable).

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Schewe on March 24, 2014, 12:31:53 am
As far as I understand Jeff, he generally suggests to upsample if the output resolution is below 300 / 360 PPI, or to 600 / 720 if output resolution is above 300 / 360, and downsample if resolution is above 600 / 720 PPI.

Personally, I would disagree about resampling after sharpening, because resampling in general reduces resolution and sharpening after resampling is usually beneficial.

My response "no scaling after sharpening" was in reference to do image resampling before sharpening...if you were to then downsample then of course you would want to add sharpening because downsampling introduces softness.

Personally, since I use Lightroom (and usually large captures) the only resampling I do is in the LR Print module and I apply output sharpening where LR upsamples 1st and then sharpens...

As for the upsampling %'s, I've pretty much moved away from that (in part because of Bart's tests) and also since I don't do upsampling in Photoshop for the most part-although Photoshop CC's new "Preserve Details" option in Image Size is very interesting. If I were to need to do a massive upsample of a small original, I would prolly take a look at doing it in PS CC.

Title: Re: Most favourable up-ressing percentage
Post by: Jason DiMichele on March 24, 2014, 09:55:04 am
If we're talking images being sent to some large output (or why size up?), I totally agree. Looking at synthetic images sharpened on-screen with differing methods is interesting. But most care what a print looks like after sizing and you have to make that print. I've tried different techniques and products but the final evaluation is an 8x11 print off my 3880 representing a small part of what would be a much bigger print. At this point, the several 3rd party products tested didn't provide anything other than much slower processing compared to using Lightroom or ACR for initial size and capture sharpening (which is more critical to the results than the actual upsizing processes, at least visibly on a print). Same with step interpolating.

+1

Cheers,
Jay
Title: Re: Most favourable up-ressing percentage
Post by: Wayne Fox on March 24, 2014, 02:01:07 pm


While ImageMagick Robidoux filter might require a "round trip" with a tiff, I suspect it is quite easier than some of the methods suggested using bicubic.


I don’t know ... i was intrigued so I looked at it.  With no real GUI I just couldn’t bring myself into trying to figure out installation and the command line interface.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 25, 2014, 04:01:55 pm
Bart:

Again, I agree with all your observations and comments.

It's nice to re-read them and go "Yes.... Makes sense.... Yes.... Indeed...."

Thank you.
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on March 25, 2014, 06:07:29 pm
I have not seen anything that substantiates any benefit of integer/even resampling factors. In fact, most resampling algorithms are totally scale agnostic and will treat any resampling exactly the same way, totally scale invariant. In theory, it would be possible to devise an algorithm that benefits a specific scaling factor slightly more than other factors, but it would be impracticable for general use.
I took this checkerboard pattern (granted, not a very interesting image to look at)
http://protie.sweb.cz/checkerboard_1920_1080.gif

Resampled it by 200% and 203% in "image preview" in OSX 10.9 and cropped 100x100 pixel in the upper left corner. Then I zoomed a lot (retina displays are poor for 1:1 pixel peeping) and laid out the images side by side for a snap shot.

My point is that the result of an accurately integer ratio scaling, and a slightly different number produce some differences in the output for this particular kind of input. It is my understanding that any polyphase-type "linear" scaling procedure will have similar (in kind) behaviour.

I believe that the image shows that when you define the output pixel grid to be a nice multiple of the input grid, you get an output that is periodic with a short period, for "aliased"/periodic input. When it is a less nice multiple, the output period (or the "sampling" of the filter kernel) is larger. This does not make it any less mathematically correct, but it can make for visible differences that might not be desired.

I do not claim that this is a big visible problem for natural images. Usually, there will be some natural variation (e.g. variable distance/focus) that cause the pattern to be non-uniform anyways.

-h
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 25, 2014, 07:15:00 pm
...

I believe that the image shows that when you define the output pixel grid to be a nice multiple of the input grid, you get an output that is periodic with a short period, for "aliased"/periodic input. When it is a less nice multiple, the output period (or the "sampling" of the filter kernel) is larger. This does not make it any less mathematically correct, but it can make for visible differences that might not be desired.

I do not claim that this is a big visible problem for natural images. Usually, there will be some natural variation (e.g. variable distance/focus) that cause the pattern to be non-uniform anyways.
I agree with this too :)
(With the minor caveat that for this to work, one needs to use the commonly used "align corner pixel corners" image geometry convention. With the "align corner pixel centers" image geometry convention, which I recommend, all other things being equal, for upsampling over the other one, what you need is one less than the numbers of pixels in corresponding directions to be an integer ratio. Such "short periodic coefficient sequences" can help preserving uniform "texture" if it is there; it can also add unwanted periodicity, hence "macro" features, where you don't want them. Such artifacts are less of an issue with good low pass filters (EWA Lanczos, for example) than with, say, bilinear. And they are more of an issue when the resize ratio is close to 1.)
Title: Re: Most favourable up-ressing percentage
Post by: WayneLarmon on March 29, 2014, 07:55:38 pm
Quote
I don’t know ... i was intrigued so I looked at it.  With no real GUI I just couldn’t bring myself into trying to figure out installation and the command line interface.

Installing Imagemagick for Windows is easy--it has a regular Windows setup.exe type installer. 
http://www.imagemagick.org/script/binary-releases.php#windows (http://www.imagemagick.org/script/binary-releases.php#windows)

Mac looks a bit trickier and UNIXier
http://www.imagemagick.org/script/binary-releases.php#macosx (http://www.imagemagick.org/script/binary-releases.php#macosx)

You don't need to go near a command prompt.  Here is a thread on DPReview that has some simple wrapper .bat batch scripts so you can process images by dragging-and-dropping

Downsampling with ImageMagick (http://www.dpreview.com/forums/post/40282142)

Once you get something working, then you can change options in the .bat file to try the things that are being discussed in this thread.   For reference:

ImageMagick v6 Examples --
Resampling Filters (http://www.imagemagick.org/Usage/filter/)

ImageMagick is a cool power tool.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 30, 2014, 03:55:05 am
It is very easy to install ImageMagick on OSX with homebrew (preferred to MacPorts nowadays): http://brew.sh/ (http://brew.sh/)
Title: Re: Most favourable up-ressing percentage
Post by: bjanes on March 30, 2014, 09:14:42 am
Personally, since I use Lightroom (and usually large captures) the only resampling I do is in the LR Print module and I apply output sharpening where LR upsamples 1st and then sharpens...

As for the upsampling %'s, I've pretty much moved away from that (in part because of Bart's tests) and also since I don't do upsampling in Photoshop for the most part-although Photoshop CC's new "Preserve Details" option in Image Size is very interesting. If I were to need to do a massive upsample of a small original, I would prolly take a look at doing it in PS CC.

Like Jeff, I do most of my printing from Lightroom. It is very convenient and I am generally pleased with the results, even though they may not be optimal, according to Bart (who is very knowledgeable). After reading this thread, I did re-examine my LR printing workflow and learned that if one does not check the resolution box to specify a printing resolution and checks the dimensions in the guides panel, the linear size and pixel dimensions of the printed image are shown (as illustrated below). In his LR4 book, Martin Evening suggests not checking the resolution box in which case LR will send the full resolution to the printer and the downsizing will be done by the printer driver. I think it would be better to initially leave the resolution box unchecked and obtain a readout of the print resolution. With the Epson printer, one would then enable print resolution and use 360 ppi if the indicated resolution is less than 360 and 720 for a resolution greater than 760.

For best quality, it might be preferable to resize in Photoshop. For upressing I do have PhotoZoom Pro (recommended by Bart). If one is printing 8 x 10 inch with a 36 MP image, downsizing is needed. In Photoshop, one can use Bicubic Sharper (perhaps with a pre-blur) for convenience, but is there a plug available which could do a better job. Or I could use ImageMagic with a separate command line step. What are others doing?

Thanks,

Bill
Title: Re: Most favourable up-ressing percentage
Post by: Manoli on March 30, 2014, 09:45:41 am
If one is printing 8 x 10 inch with a 36 MP image, downsizing is needed. In Photoshop, one can use Bicubic Sharper (perhaps with a pre-blur) for convenience, but is there a plug available which could do a better job. Or I could use ImageMagic with a separate command line step. What are others doing?


I asked Bart this question a month ago and below was his response ..
http://www.luminous-landscape.com/forum/index.php?topic=45038.msg712955#msg712955
Title: Re: Most favourable up-ressing percentage
Post by: bjanes on March 30, 2014, 10:18:07 am

I asked Bart this question a month ago and below was his response ..
http://www.luminous-landscape.com/forum/index.php?topic=45038.msg712955#msg712955

That is interesting. Bart recommends regular bicubic, not bicubic sharper. He also recommends Topaz detail for sharpening. I recently acquired the program on Bart's recommendation, but have not yet mastered its learning curve. Does anyone know what downsizing algorithm would be used in LR?


Bill
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on March 30, 2014, 01:13:02 pm
Pictus (Luiz E. Vasconcellos) was kind enough to give me a link to the cleanest discussion of his "drag and drop" ImageMagick resize scripts: http://www.modelmayhem.com/po.php?thread_id=812189 (http://www.modelmayhem.com/po.php?thread_id=812189)
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 30, 2014, 02:37:02 pm
That is interesting. Bart recommends regular bicubic, not bicubic sharper.

Hi Bill,

That's correct, even though the specific answer mentioned above was in relation to upsampling, deconvolution sharpening, and down-sampling again to the original size. Down-sampling image detail that exceeds the highest spatial frequencies of the smaller size will lead to aliasing artifacts, and the various resampling filters produce different artifacts as a result. Bi-cubic sharper produces horrible aliasing, even regular bicubic down-sampling improves with a prior blurring of the highest spatial frequencies. In the specific up/down-sampling suggestion, there will be little image detail to cause trouble (even with bicubic) because there is not much aliasing potential.

Quote
He also recommends Topaz detail for sharpening. I recently acquired the program on Bart's recommendation, but have not yet mastered its learning curve.

With the 'Detail' plugin it's important to grasp the difference between the regular Detail and the Boost sliders for all detail sizes. The Boost sliders target the low contrast detail (but with a correlation to the Detail strength setting), the regular sliders target higher contrast detail of the specific size one is modifying (enhancing or reducing). Since micro-detail is by definition of lower contrast, because it has a lower MTF, the Boost slider can compensate for that a bit as well. One has to avoid smooth surfaces such as defocused areas or sky, and Detail 3 has masking capabilities to achieve that if one is working out of e.g. Lightroom without layer functionality like in Photoshop.

As for Output sharpening use, this video (http://www.youtube.com/watch?v=-1J8n3fOKPA) offers a reasonably good workflow explanation (using the older version of Detail, the newer version offers more tools such as masking thus reducing the need for Photoshop), although I'd also pay more attention to the "Deblur" panel, because it can mitigate some of the up-sampling blur. Good up-sampling generally should try to avoid adding big halos, and therefore produces low detail contrast which can be compensated for by deconvolution. This video (http://www.youtube.com/watch?v=kr2xXFbpAAw) (again of the older, more limited version) does a good job of explaining the basic controls. Some of those controls are using an innovative approach towards changing luminosity (contrast), also the luminosity component of (complementary) colors.

Detail 3 also allows to specifically address shadows and/or highlights with different settings from the overall settings. It's important to note that the  "Overall", "Shadow", and "Highlight" selections allow individual settings that will be combined! Shadows are usually dark because they receive less light, and that light is usually more diffuse/ambient than directional. If we have important detail in the shadows, but we do want to keep them dark, then we can use the shadow set of detail controls and regain some more detail there. That looks much more natural than adding too much fill light to accentuate subject structure in the shadows. Likewise, we may want to specifically target light sky structures with the highlight set of controls.

Quote
Does anyone know what downsizing algorithm would be used in LR?

I'm not sure, but it's quite decent. It's certainly better than regular Bi-cubic, and it produces much less aliasing than most filters/algorithms.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on March 31, 2014, 02:53:24 am
After reading this thread, I did re-examine my LR printing workflow and learned that if one does not check the resolution box to specify a printing resolution and checks the dimensions in the guides panel, the linear size and pixel dimensions of the printed image are shown (as illustrated below). In his LR4 book, Martin Evening suggests not checking the resolution box in which case LR will send the full resolution to the printer and the downsizing will be done by the printer driver. I think it would be better to initially leave the resolution box unchecked and obtain a readout of the print resolution. With the Epson printer, one would then enable print resolution and use 360 ppi if the indicated resolution is less than 360 and 720 for a resolution greater than 760.
If there really is a systematic benefit to choosing specific output resolutions when printing in Lightroom (depending on printer manufacturer) as has been stated by knowledgeable people here and elsewhere, it would be in line with the "make-things-work" philosophy of Lightroom to (as a default) make the sensible choice behind the scenes. I am not advocating removing the option of controlling things, only requesting that the first (default) option be "auto" (and that the algorithm does what Schewe & friends recommends).

It sounds like a simple algorithm?
If printer manufacturer == Canon
 base_dpi = 300
else
 base_dpi = 360

If image_dpi < base_dpi
 print_dpi = base_dpi
else
 print_dpi = 2*base_dpi

Quote
For best quality, it might be preferable to resize in Photoshop.
I assume that you mean "outside of Lightroom" and not specifically "in Photoshop".

I think it is interesting to know and understand how stuff works, when things start to break down, and how far quality can be stretched if one is willing to pay the price. Like you, I prefer the comfort of doing most of my stuff inside Lightroom, even if there might be some slight quality hit.

-h
Title: Re: Most favourable up-ressing percentage
Post by: Paul2660 on March 31, 2014, 07:24:23 am
I don’t know ... i was intrigued so I looked at it.  With no real GUI I just couldn’t bring myself into trying to figure out installation and the command line interface.

I totally agree. Appeared to be all command line.
Paul
Title: Re: Most favourable up-ressing percentage
Post by: Paul2660 on March 31, 2014, 07:48:36 am
One other question for the forum. Jeff in the past had recommended 240 dpi for larger prints 16 x 20 and up and 1440 on the printer, Epson. I have always worked on the principal that Epson's will do best with 180,240,360 and 720 for the print and 1440 dpi for the printer on larger prints.

For 20 x 30 and up most times I will use 240dpi for the print and 1440 on the printer as uprezing to 360dpi most time just does not give the best looking output.   Phase One images I tend to use 300dpi but I can get them to 360 easily enough.

Personally I just have never found a good software solution for uprezing that holds the finer details that the Epson printers can produce.   Uprezing say a 20 x30 at 240dpi to a 40 x 60 at 240 or 360dpi. For that I tend to go to 180dpi.

Paul
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 31, 2014, 08:24:12 am
I think it is interesting to know and understand how stuff works, when things start to break down, and how far quality can be stretched if one is willing to pay the price. Like you, I prefer the comfort of doing most of my stuff inside Lightroom, even if there might be some slight quality hit.

Hi,

Simpler workflow aside, resampling alone will make a significant difference to output quality (it usually lowers micro-detail contrast). Whether it's significant enough for an individual user/client is hard to say.

What is obvious is that so many people report significantly better output quality from the exact same file when printed with e.g. Qimage (which automatically up-samples to 600 or 720 PPI, then sharpens) versus Photoshop (which lets the printer driver resample, usually with bi-linear, sometimes with bi-cubic). So the anecdotal evidence shows that it can be a significant difference, although it obviously also depends on the specific image content.

When we accept the importance of better re-sampling, and we're going to invest some effort to achieve the required image size, then why not use the best option available that we can use (provided that the workflow remains workable).

The re-sampling algorithms of Lightroom use an unknown method (the up-sampling appears to push resolution yet avoid adding edge halos, maybe it's adaptive), with a few optional predetermined levels of re-sharpening at the final output size (which can be simpler if there are no added halos). Reading the reactions from users, LR seems to produce an acceptable level of output quality for them, although it's not clear whether they know if and how much better it could be ...

I've compared 300% upsampled output from Lightroom 5.3 and Qimage Ultimate (Fusion resampling), and indeed it's no longer all that different since LR up-samples to native printer resolution and then adds sharpening. Things do get better when one uses dedicated resampling, e.g. EWA Lanczos Radius or even more of a difference from PhotoZoom Pro which enhances edge resolution, and when applying dedicated sharpening to the resized for output image data. The more recent implementations of Perfect Resize (which seems to have come down in price as well) also offer some resolution enhancement and post resize sharpening. Being able to produce a print sized output file that allows further detail sharpening will add another step up for output quality, e.g. an EWA Lanczos Radius + Topaz Labs Detail.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 31, 2014, 08:56:32 am
One other question for the forum. Jeff in the past had recommended 240 dpi for larger prints 16 x 20 and up and 1440 on the printer, Epson. I have always worked on the principal that Epson's will do best with 180,240,360 and 720 for the print and 1440 dpi for the printer on larger prints.

Hi Paul,

Jeff no longer recommends that. Basically he now agrees with up-sampling to the printer's native resolution, 360 PPI or 720 (with finest detail selected) for Epson, and 300 PPI or 600 PPI for Canon / HP / and similar. It produces better quality when better resampling routines are used than what the printer driver uses, and it allows to add post-resize sharpening at that exact native resolution.

Quote
For 20 x 30 and up most times I will use 240dpi for the print and 1440 on the printer as uprezing to 360dpi most time just does not give the best looking output.   Phase One images I tend to use 300dpi but I can get them to 360 easily enough.

360 PPI should be superior to 240 PPI (assuming the use of proper resampling algorithms), but you need to re-sharpen after re-sampling. Phase One's Capture One uses a relatively simple (looks like bi-cubic) resampling. While better than what most printer drivers use, it would be awesome if they adopted some of the suggestions made in this thread (with a few enhancements).

Quote
Personally I just have never found a good software solution for uprezing that holds the finer details that the Epson printers can produce.   Uprezing say a 20 x30 at 240dpi to a 40 x 60 at 240 or 360dpi. For that I tend to go to 180dpi.

The printer driver will then automatically upsample from 180 to 360 PPI (= native printer driver resolution) with an inferior (usually bi-linear) algorithm, do no re-sharpening, and leave unused quality on the table. You should be able to do better!

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Paul2660 on March 31, 2014, 10:20:22 am
Bart:

Thanks for the info.  I will try this in the future.

Paul
Title: Re: Most favourable up-ressing percentage
Post by: Jim Kasson on March 31, 2014, 11:36:44 am
The printer driver will then automatically upsample from 180 to 360 PPI (= native printer driver resolution) with an inferior (usually bi-linear) algorithm, do no re-sharpening, and leave unused quality on the table.

Bart, as of three years ago, it was even worse that that with the Epson 3880 driver; it used nearest-neighbor.

http://blog.kasson.com/?p=487

Jim
Title: Re: Most favourable up-ressing percentage
Post by: bjanes on March 31, 2014, 11:44:52 am
That's correct, even though the specific answer mentioned above was in relation to upsampling, deconvolution sharpening, and down-sampling again to the original size. Down-sampling image detail that exceeds the highest spatial frequencies of the smaller size will lead to aliasing artifacts, and the various resampling filters produce different artifacts as a result. Bi-cubic sharper produces horrible aliasing, even regular bicubic down-sampling improves with a prior blurring of the highest spatial frequencies. In the specific up/down-sampling suggestion, there will be little image detail to cause trouble (even with bicubic) because there is not much aliasing potential.

Thanks for the detailed reply. The information concerning alaising when downsizing with bicubic sharper is of particular concern to me, since I am using the Nikon D800e, which does not have a low pass filter and thus already has alaising in that regard.

As for Output sharpening use, this video (http://www.youtube.com/watch?v=-1J8n3fOKPA) offers a reasonably good workflow explanation (using the older version of Detail, the newer version offers more tools such as masking thus reducing the need for Photoshop), although I'd also pay more attention to the "Deblur" panel, because it can mitigate some of the up-sampling blur. Good up-sampling generally should try to avoid adding big halos, and therefore produces low detail contrast which can be compensated for by deconvolution.

I did watch the video on output sharpening, which somewhat tries one's patience, since the presenter takes 45 minutes to cover what could be covered in 10 minutes at most. His approach is basically sharpen to taste using the small details slider when viewing the image at 50 to 75%. I was unable to view at 75%, since the zoom tool goes from 50% to 100% and one can not specify the zoom directly as one can do in Photoshop.

This approach is quite different from that of the Fraser-Schewe output sharpening approach where the parameters are mechanistic and determined by the image size and resolution according to the "magic numbers" obtained via laborious testing involving the printing of many images. If one starts with a 36 MP image rendered into 16 bit ProphotoRGB and then resizes to 720 PPI and adds a surface mask, the working image is well in excess of 677 MP. Even saving this image in case the parameters need to be adjusted for the final print takes a long time if one is using ZIP compression. This is where the parametric workflow if Lightroom really shines.

Regards,

Bill
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 31, 2014, 11:48:55 am
Bart, as of three years ago, it was even worse that that with the Epson 3880 driver; it used nearest-neighbor.

http://blog.kasson.com/?p=487

Hi Jim,

Indeed, NN is exceedingly primitive. Maybe it's still that way, but I do not have an Epson printer so I cannot check it without tasking it to others.

Anyway, I avoid it and get much better results than what's produced on average. Of course for high volume work one may choose a slightly different workflow, but a lot can be automated with (drag-and-drop) batch processing.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on March 31, 2014, 01:03:53 pm
Thanks for the detailed reply. The information concerning alaising when downsizing with bicubic sharper is of particular concern to me, since I am using the Nikon D800e, which does not have a low pass filter and thus already has alaising in that regard.

Hi Bill,

There are several things happening here. First there is inevitable aliasing due to under-sampling of the optical projection of our scene in front of the camera. Even cameras with an OLPF will usually produce some aliased results (but with lower amplitude) in the plane of best focus. That very high spatial detail is now converted into larger than Nyquist aliases. It's a fact of life, when using discrete sampling.

Next is the aliasing we create when we further reduce the sampling density of that already aliased data. Now all spatial detail smaller than the Nyquist frequency of the smaller down-sampled image grid will contribute to aliasing. Most of this aliasing will be avoidable to a large degree, but only if we use precautions (pre-filtering and good quality algorithms, using linear gamma also helps).

On my webpage (http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample.htm) about various down-sampling algorithms you can see that Bicubic Sharper produces somewhat higher sharpness (the 'rings' in the center extend slightly further, also into the corners) but also more aliasing artifacts than most other methods.

(http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample_files/Rings1_BCshrgb.gif)
Bicubic Sharper


(http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample_files/Rings1_LR5.3.gif)
Lightroom 5.3

Lightroom does a pretty decent job when down-sampling, so as long as the aliasing at capture is small enough, it won't interfere with down-sampling for e.g. web-publishing.

Technically, an EWA Robidoux with gamma 1 downsampling is even cleaner (especially for color), but very close to Lightroom as far as resolution is concerned:
(http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample_files/Rings1_EWA-Robidoux_G=1.gif)
EWA Robidoux (Gamma=1 during resampling)

Make sure to watch these images at 100% zoom in your browser. Browser resampling is pretty crude as well, and will fall flat on its face with such critical test images.

But up-sampling requires a different approach compared to down-sampling.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on April 06, 2014, 02:23:43 am
If you magnify the zone plate downsample done with the EWA Robidoux filter through linear light, you can see that this filter straightens almost straight vertical and horizontal lines with too much eagerness.
Not surprising, because it was designed to do exactly that.
Arguably, this is fine when processing images of buildings and keystoning was corrected. But not so fine otherwise: it leads to staircasing (as Bart noticed).
-----
At some point, I'll add another member to the Robidoux set of Keys splines filters for EWA (Elliptical Weighted Averaging) resampling. Maybe this one: http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=19823&start=30#p109820 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=19823&start=30#p109820)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on April 06, 2014, 02:34:29 am
If you read between the lines of the rather terse technical specification (which sneaks in linear operator theory---dual norms etc), this is a filter that should be pretty good at preserving midtones near sharp features.
But I've not tested it enough to know.
Title: Re: Most favourable up-ressing percentage
Post by: bwana on April 11, 2014, 12:05:13 pm
As I am rather naive in the tools available, I have stuck to LR . I am interested in using a better output workflow. Either going with perfect resize and then sharpening with topaz detail OR printing directly through LR using qimAge fusion.  I am still unclear on the steps for each workflow-and the considerations necessary to properly choose the right amount of sharpening.

Many references state that you cannot judge output sharpening on the display before printing even if you look at the image at 300% (the scaling necessary to view a 300 dpi image on a 100 dpi screen).

I wonder if Bart or another expert printer could share a link or perhaps a few details as these would be appreciated by a neophyte.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on April 11, 2014, 01:48:34 pm
As I am rather naive in the tools available, I have stuck to LR . I am interested in using a better output workflow. Either going with perfect resize and then sharpening with topaz detail OR printing directly through LR using qimAge fusion.  I am still unclear on the steps for each workflow-and the considerations necessary to properly choose the right amount of sharpening.

Hi,

There are several routes one can take to improve the output quality of images coming from LR. It depends on the required results, e.g. large volumes or single masterpieces, which route is to be preferred.

When large volumes are anticipated, or various sizes for the same image, then Qimage is probably the better route because it can do the nesting and resizing automatically and it sharpens after the resizing. All it requires is a high quality TIFF file as input. That file can come from LR, but can first be improved by using Photoshop (or another host program that can use PS plug-ins) and be treated with Topaz Labs Detail (currently available with a 50% discount) as Creative sharpening tool before Qimage does its work. TL Detail does a much better job than LR when it comes to Creative Sharpening. Horses for courses.

When not using Qimage, the output file needs to be resampled to the Printer's native PPI, i.e. 300/360 PPI or 600/720 PPI, with another application, because the printer driver will otherwise do it, and not very well. One can use dedicated resampling software for better results, e.g. ImageMagick, or PhotoZoom Pro, or Perfect Resize. When you hold back a bit on post resampling sharpening, then TL Detail (with mostly deblur and small detail enhancement) can again be used for that Output Sharpening purpose.

That's all.

Quote
Many references state that you cannot judge output sharpening on the display before printing even if you look at the image at 300% (the scaling necessary to view a 300 dpi image on a 100 dpi screen).

I think that's a bit misleading. Of course at the bloated display size, the sharpening will look different than at the smaller print size. As such it is indeed hard to predict how it will look. However, it's not that difficult to learn how that enlarged sharpening result will translate to the print. It's called experience.

When applying output sharpening, one mostly attempts to counteract the blur caused by resampling to the output size, and add a bit extra to compensate for additional losses that have yet to occur, as a result of the printing process and medium used. As it happens, all that's required is good quality sharpening at the smallest detail levels, so it becomes a simple job of adding enough halo artifact free sharpness and contrast to the already resized micro-contrast. Because we often up-sample before output sharpening, it should be relatively easy to see how far we can go before the detail starts to look obviously weird.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: alifatemi on June 20, 2014, 10:26:44 am
My response "no scaling after sharpening" was in reference to do image resampling before sharpening...if you were to then downsample then of course you would want to add sharpening because downsampling introduces softness.

Personally, since I use Lightroom (and usually large captures) the only resampling I do is in the LR Print module and I apply output sharpening where LR upsamples 1st and then sharpens...

As for the upsampling %'s, I've pretty much moved away from that (in part because of Bart's tests) and also since I don't do upsampling in Photoshop for the most part-although Photoshop CC's new "Preserve Details" option in Image Size is very interesting. If I were to need to do a massive upsample of a small original, I would prolly take a look at doing it in PS CC.



But in LR, in Develop module we first apply lots of sharpening/creative sharpening then we move to print module for upsampling then again using output sharpening just before printing so at least in LR, like it or not, part of sharpening happens before resampling. Am I right?
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on June 20, 2014, 12:47:36 pm
But in LR, in Develop module we first apply lots of sharpening/creative sharpening then we move to print module for upsampling then again using output sharpening just before printing so at least in LR, like it or not, part of sharpening happens before resampling. Am I right?

Hi,

Indeed, the sharpening/Clarity/tonal contrast/etc. adjustments in LR take place before resampling to the final output size. That does allow you to preview the adjustments at the 100 % zoom size of the original image, but you need to use your imagination/experience to judge how that will work out at the final size after final resampling/output sharpening and print.

A zoom setting to preview the image at the  final output size would be nice, but such functionality was also removed from Photoshop CC (a 'print size' button is still present in Photoshop CS6 on Windows OS) because it apparently generated too many support questions about how to set up the system.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Slobodan Blagojevic on June 20, 2014, 02:26:46 pm
... A zoom setting to preview the image at the  final output size would be nice, but such functionality was also removed from Photoshop CC (a 'print size' button is still present in Photoshop CS6 on Windows OS) because it apparently generated too many support questions about how to set up the system.

Hi Bart, it seems that, after numerous complaints, both CC and CS6 now have a View menu option "Print Size." Not a button, but the function is the same.

For it to work properly, however, one has to set PS "Preferences > Units & Rulers > New Document Preset Resolutions > Screen Resolution" to the monitor's native resolution (my iMac 27 is, for instance, 109 ppi).
Title: Re: Most favourable up-ressing percentage
Post by: Hening Bettermann on June 20, 2014, 02:35:59 pm
Hi,
[...]

A zoom setting to preview the image at the  final output size would be nice, but such functionality was also removed from Photoshop CC (a 'print size' button is still present in Photoshop CS6 on Windows OS) because it apparently generated too many support questions about how to set up the system.

Cheers,
Bart

PhotoLine has got it, menu View > Original Size. I find the name misleading, but it's there.
Title: Re: Most favourable up-ressing percentage
Post by: Tim Lookingbill on June 21, 2014, 12:02:00 am
I just discovered a neat way to uprez (and view the results at 100% and tweak capture sharpening) in ACR 6.7 CS5 and then see the desired output sharpening with one click in Photoshop by first choosing in ACR's resolution change dialog box (by clicking below the frame) and choosing Glossy Paper/High sharpening or the other sharpening options. This option wasn't in CS3 and I'm glad I found this because it motivates me to start working in CS5.

I've been using this method for posting downsized for the web 700pixel/long end using Bridge's "Image Processor..." and it seems to do a really good job of turning my 6MP PEFs into 25MP images and/or sharpening for web. I can adjust the level of crispyness sourced from ACR by either not uprezzing in ACR and just choose the sharpening options and view in Photoshop or change the sharpening options and go straight to "Image Processing...".

I always hated to have to open my 6MP PEF's in Photoshop only to get a different look to sharpness due to ACR's "only accurate at 100%" views and then have to downsize in Photoshop and resharpen for the web. Saved a lot of steps using this method and I get pretty consistent results as long as I capture sharp in ACR viewing at 100%.

Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on June 25, 2014, 10:22:43 am
Bart:
I am starting to see why you like (I think) EWA Robidoux. Here is what is does with sigmoidization.
magick QuarterZoneplate.png -set colorspace sRGB -colorspace RGB +sigmoidal-contrast 5,84% -distort Resize 230% -sigmoidal-contrast 5,84% -colorspace sRGB -quality 99 230.robidoux.s.5.84.jpg
Not very different from your own. The one's that's different is the one obtained by enlarging through linear light, which of course is generally not recommended.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on June 25, 2014, 11:44:04 am
Bart:
I am starting to see why you like (I think) EWA Robidoux. Here is what is does with sigmoidization.

Hi Nicolas,

They are all a compromise, but Robidoux (the filter, I wouldn't dare judging you ;) ) is a reasonable one by design, but there are others. The additional Sigmoidization is a bit of a hack, but it works (although the best values can differ depending on image content).

Quote
magick QuarterZoneplate.png -set colorspace sRGB -colorspace RGB +sigmoidal-contrast 5,84% -distort Resize 230% -sigmoidal-contrast 5,84% -colorspace sRGB -quality 99 230.robidoux.s.5.84.jpg
Not very different from your own. The one's that's different is the one obtained by enlarging directly through linear light, which of course is generally not recommended.

Yes, this shows that (angle independent) preservation of the same amount of resolution that I like, which looks quite natural for well behaved images. The upsample is without too many artifacts (there is a slight amount of moiré, due to gamma or source?).

As a photographer, I prefer natural looking images (artifacts draw attention away from content and creative intent), although viewing distance may be exploited to hide some artifacts that benefit other aspects of perceived image quality. If e.g. stairstepping is too small to be resolved by eye, but it does allow to enhance edge acutance, then I have no problem with that.

Something I also tend to keep in mind is this 1995 Tech memo (http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf) by a Microsoft employee.

I also think that a relatively soft and artifact-'free' upsampling can be very well combined with subsequent deconvolution, although that will be computationally more expensive at the larger size.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Jim Kasson on June 25, 2014, 12:55:11 pm


Something I also tend to keep in mind is this 1995 Tech memo (http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf) by a Microsoft employee.

Not just any Microsoft employee. PARC, too. Founded Pixar.

You were playing with us, right?

Marvelous, Bart. Thank you.

Jim
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on June 25, 2014, 01:02:19 pm
Bart:

Interesting and useful comments and tech report. (Who knew MS employees could be so spunky?).

I agree that often resampling "softly", leaving sharpening for a later stage of the toolchain, is desirable. (This is why I now recommend also the plain EWA Lanczos, not only EWA LanczosSharp 3, LanczosRadius 3 or LanczosSharpest 4, and why I am planning to put RobidouxSoft into ImageMagick.)

I also agree that as it stands now, sigmoidization should not be used "blindly". My opinion is that there is a good idea in there, but the implementation is blunt.

As for "natural looking", I have found that what people find pleasing (or even natural) in (digital) photographs is all over the place. I would bet that what most people find natural and pleasing is different now than it was 20 or even 5 years ago. Cartoon: Pixel art now looks natural.

Resampling is complicated by the lack of standardization of personal tastes.

As for "viewing conditions"... (grin)

Thank you (again),

Nicolas (a reasonable one by design, but there are others)
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on June 25, 2014, 02:12:17 pm
Not just any Microsoft employee. PARC, too. Founded Pixar.

You were playing with us, right?

Hi Jim,

Couldn't help myself. Understatement often works better ...

Here is some more background about Alvy Ray Smith (https://en.wikipedia.org/wiki/Alvy_Ray_Smith).

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Jim Kasson on June 25, 2014, 03:01:39 pm
Here is some more background about Alvy Ray Smith (https://en.wikipedia.org/wiki/Alvy_Ray_Smith).

I once participated on a SIGGRAPH panel on color management organized by Efi Arazi. Smith was a follow panelist. It was a humbling experience. A giant.

Jim
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on June 28, 2014, 09:58:40 am
...The upsample is without too many artifacts (there is a slight amount of moiré, due to gamma or source?)...
The sigmoidization values were settled on really quickly so may not be best. (On the other hand the fact that I don't know right off the bat says a lot.) In any case, I am wondering if the "kink" in the S-curve is to blame for the slight moire.
Maybe blending two enlargements, one with a well chosen gamma, the other one with a possibly different gamma >>applied to the negative of the image<< would be a better (but more complicated and expensive) strategy toward avoiding destructive overshoots using a linear filter with negative lobe(s) than using a single S-curve?
That is: Filter within two "kink free" colorspaces, one that suppresses dark halos, the other one that suppresses light halos (gamma "corrected" negative) and blend the results back in linear light.
Something like that was very quickly tried in the early days of sigmoidization. Maybe worth revisiting.
When I have "a minute", I'll have to try.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on June 29, 2014, 11:17:35 am
Here is another way of looking at it, I've plotted the noise power spectra of the up-sampled uniform noise image. The images were upsampled with the state of the art EWA algorithm, with the default ImageMagick Robidoux filter.

(http://bvdwolf.home.xs4all.nl/temp/LuLa/ResampledPowerspectra.png)
...
These plots may illustrate why EWA Robidoux probably should not be used to enlarge more than 250% or so unless the image is "soft": This is where the power spectrum goes from being monotone (the higher the frequency, the lower the "response") to having local "peaks". These peaks are low, but nonetheless I would guess that their impact can be seen, at least if one can "pixel peep".
P.S. Of course the fact that EWA Robidoux takes its sweet time to drop near Nyquist...
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on June 29, 2014, 11:20:52 am
I put a first sample of filtering through an extreme "gamma space" for the purpose of image enlargement as a P.S. to http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89751#p89751 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89751#p89751).
Two more: http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89728 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89728) and http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89746 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89746), in the P.S. too.
Title: Re: Most favourable up-ressing percentage
Post by: hjulenissen on July 03, 2014, 09:42:31 am
Not sure if I have linked this whitepaper, but I find it interesting since it involves viewers and finding detectability thresholds.
http://downloads.bbc.co.uk/rd/pubs/whp/whp-pdf-files/WHP092.pdf

They find that one can live with slightly lower transmitted resolution in tv systems if some sharpening is applied at rendering.

-h
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 04, 2014, 06:30:50 am
I put a first sample of filtering through an extreme "gamma space" for the purpose of image enlargement as a P.S. to http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89751#p89751 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89751#p89751).
Two more: http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89728 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89728) and http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89746 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=21804&p=89728#p89746), in the P.S. too.

Hi Nicolas,

Very interesting results. A warning (as you did add) is indeed appropriate, because more images would need to be tested (although I suspect most would survive just fine), but more so because you use an "HDR version" of ImageMagick which is not available as pre-compiled binaries for regular users. The extreme temporary gamma adjustments require floating point calculations for the image to survive.

Nevertheless, it's an interesting angle to look from at the general task of upsampling.

Cheers,
bart
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 04, 2014, 06:41:03 am
They find that one can live with slightly lower transmitted resolution in tv systems if some sharpening is applied at rendering.

It's interesting (but not surprising from how our retina is structured) to see how many tests keep confirming the 0.7 - 1.0 minutes of arc as practical resolution limit for viewing. That's why I chose those values in section 1.1 of my DOF Output Quality Planner (http://bvdwolf.home.xs4all.nl/main/foto/dofplan/dofplan.html).

The BBC paper also shows that sharpening of the output can help lower resolution input, but that should hardly come as a surprise.

The lesson one may draw from all that is also that some artifacts may be tolerable when viewed at a small enough scale. However, for large format output, which is why we usually up-sample, small artifacts may become large enough to be seen. So in general, fewer artifacts are better, and subsequent high quality sharpening becomes easier.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 04, 2014, 10:50:51 am
When I still believed in the existence of "free time", I was planning to scan BBC tech reports for goodies. The basis for this New Year resolution was this very article.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 04, 2014, 10:56:33 am
...you use an "HDR version" of ImageMagick which is not available as pre-compiled binaries for regular users. The extreme temporary gamma adjustments require floating point calculations for the image to survive.
Indeed. I should have put in big bold letters that users without access to an HDRI version of IM may not get acceptable results because you need the -gamma operation to be accurately invertible. This goes for sigmoidization too. (To make things even more messy, I believe that ImageMagick 7 still has fairly different sigmoidal-contrast code than the widely available ImageMagick 6. IM7's is better.)
This being said, it may work acceptably well when you don't care for 16-bit accuracy in the final result. I've not checked whether the round off error (and LUT) artifacts are visible. But I would not be surprised at all if they are with gamma 32, and would be disappointed but not shocked if they are at gamma 4.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 05, 2014, 04:33:29 am
My current "short list of recommended ImageMagick image resizing methods": http://www.dpreview.com/forums/post/53970721 (http://www.dpreview.com/forums/post/53970721)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 03:38:13 am
I am pretty sure that sigmoidization is now a dead prototype: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25736&p=113272#p113272 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25736&p=113272#p113272)
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 15, 2014, 10:27:22 am
I am pretty sure that sigmoidization is now a dead prototype: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25736&p=113272#p113272 (http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25736&p=113272#p113272)

Hi Nicolas,

Thanks for the progress update.

I'm also wondering if another approach could be easily implemented in ImageMagick. What most of the efforts sofar attempt to do is upsample and minimize artifacts (halo, ringing, blocking, some aliasing). The results look pretty useful. Most filters also attempt to improve the contrast compared to a simple bilinear interpolation (Triangle filter).

However, what about a version of upsampling that is not trying to increase sharpness when upsampling (maybe 'Gaussian'), and add some deconvolution to compensate for the upsampling losses. I understand that it is difficult to dynamically adjust the required (probably Gaussian) PSF radius with variable upsampling percentages, but that would not be too much of an issue if one uses fixed percentages in a batch/script file instead of from the command line console.

Here is an example for a 300% upsample (Windows batch file formatting, allows drag and drop):
convert %1 -filter Gaussian -distort Resize 300%% -define convolve:scale=^100%%,100 -morphology Convolve DoG:0,0,1.7 "%~dpn1_Gauss+HighPass.png"
The 100% part in the "-define convolve:scale=^100%%,100" parameter, allows to modify the 'amount' of High-pass sharpening. The 1.7 part of the "-morphology Convolve DoG:0,0,1.7" parameter allows to adjust the 'sigma' of the Gaussian High-pass.

This would have the benefit of allowing to control the upsampling artifacts through choice of resampling filter (e.g. Gaussian), and restore some sharpness by using a targeted approach (e.g. High-pass) which should not produce halos (or at least relatively controllable ones) if well dimensioned, or can be used to add a bit of halo to pre-compensate for later losses in our output medium (e.g. ink diffusion).

Of course a real iterative deconvolution method would be able to do an even better job than a simple single High-pass convolution sharpening.
Just some food for thought ...

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 12:31:50 pm
...
Just some food for thought ...
That's why I'm here :)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 12:33:51 pm
I don't have time to program or test this, but I would guess that a well chosen binomial would work better than a Gaussian.
Probably not a big difference, though.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 15, 2014, 12:44:56 pm
I don't have time to program or test this, but I would guess that a well chosen binomial would work better than a Gaussian.

Nicolas, do you mean a Lagrange filter version? I can give it a look.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 01:04:01 pm
Nicolas, do you mean a Lagrange filter version? I can give it a look.
I mean this: http://www.imagemagick.org/discourse-server/viewtopic.php?t=22432#p93883 (http://www.imagemagick.org/discourse-server/viewtopic.php?t=22432#p93883)
Note: If your idea works well, it will work well enough with Gaussians. What the binomial would do is ensure that your filter is C^0, which is pretty much a necessity when enlarging a lot.
Note 2: There is another direction I'm exploring. I am not sure I can do so in public, however. Need to check.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 15, 2014, 01:24:30 pm
I mean this: http://www.imagemagick.org/discourse-server/viewtopic.php?t=22432#p93883 (http://www.imagemagick.org/discourse-server/viewtopic.php?t=22432#p93883)
Note: If your idea works well, it will work well enough with Gaussians. What the binomial would do is ensure that your filter is C^0, which is pretty much a necessity when enlarging a lot.
Note 2: There is another direction I'm exploring. I am not sure I can do so in public, however. Need to check.

Thanks, I'll first have to read about that before trying to achieve it with IM.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 01:37:05 pm
Here is the attractive property that resizing through a gamma space does have, and that resizing through a sigmoidal space does not:
Suppose (for simplicity) that the three channels of an image are proportional, for example that
R=rL
G=gL
B=bL
where L is a function of position, but r and g and b are constant.
Suppose also that the resampling operator is linear.
Then, if we resample by first transforming R, G and B with a power law (that is, if we map the colors to a "gamma color space"), apply the linear resampling operator, and then apply the inverse of the power transformation (that is, if we undo gamma), the resulting image will also have proportional channels.
Consequently, if (locally) having (approximately) proportional channels describes an important property of images (in an "anchor" color space), resampling through a gamma space is a better proposition than through a sigmoidal color space.
Note: For this to work out as intended in practice, we must have that L, R, G and B are >= 0.
P.S. This property, about the interaction of gamma transformations with linear filtering, has to be well known.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 15, 2014, 02:24:11 pm
Maybe binomials are not such a great idea: Gaussians have the nice property of being rotationally invariant. Truncated far enough, no one would notice the result is not C^0. On the other hand you could use a binomial as an EWA kernel :)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 16, 2014, 04:43:49 am
Bart:
If you feel like programming a mildly complex ImageMagick command and testing a prototype method, please let me know. I think ImageMagick Q16 is good enough.
I'm "whipping other cats" (gallicism)
(https://plus.google.com/110142949827261116931/posts/fCbeJMm5iQv (https://plus.google.com/110142949827261116931/posts/fCbeJMm5iQv)) so this could speed up the exploration process.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 16, 2014, 06:48:42 am
Bart:
If you feel like programming a mildly complex ImageMagick command and testing a prototype method, please let me know. I think ImageMagick Q16 is good enough.

Hi Nicolas,

If I can figure out how to get it to work in Windows, and if time permits (don't know how complex a task you have in mind), I wouldn't mind giving a whirl. If you are looking for something very specific, we might start a new thread, so only the interested folks need to bother reading it.

Quote
I'm "whipping other cats" (gallicism)
(https://plus.google.com/110142949827261116931/posts/fCbeJMm5iQv (https://plus.google.com/110142949827261116931/posts/fCbeJMm5iQv)) so this could speed up the exploration process.

Ah, characterizing a sensor (bias, response curve, PRNU, shot-noise, read-noise)? Fun but potentially time consuming. It does reveal a lot about the engine one uses to take images with.

If my modest contribution to doing something useful in ImageMagick Q16 can help you, I'd be glad to spend some time on it.

Cheers,
Bart

P.S. you can of course P.M. me if you want to discuss details.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 16, 2014, 07:53:33 am
Bart:

Thank you. (Start a new thread elsewhere if you want. You pick. Give it the title you want. This is "halo minimizing resizing by gamma blending")

Here it is:

Gist: Resample with the same filter both in linear light and gamma light, and blend the two results so that the darker a pixel is, the less the linear light result contributes.

Details:

Let's assume the image to be resized is sRGB for simplicity.

Choose a gamma. Suggestion: 3.

Choose a filter. Suggestion: EWA LanczosRadius. Robidoux or LanczosSharp or even LanczosSharpest 4 should work well too.

Choose a resampling operation. I'll use enlarging by 800%.

Step 1: Let's standardize to linear light:

IMG0 = result of convert input.png -set colorspace sRGB -colorspace RGB

Step 2: Resample in linear light:

IMG1 = result of convert IMG0 -filter LanczosRadius -distort Resize 800%

Step 3: Resample in gamma light:

IMG2 = result of convert IMG0 -gamma 3 -filter LanczosRadius -distort Resize 800% -gamma .33333333333333333

Step 4: Compute a per pixel luminance value for IMG1. Any reasonable luminance (the Bayer one, for example, = 2*green + blue + green, or converting IMG1 to greyscale) should work. Normalize the luminance to [0,1] for the sake of exposition. (P.S. ImageMagick allows the use of actual images as alpha channel.) You may need to clamp IMG1 first (probably not needed if you don't use HDRI). P.S. Really nice normalization thanks to Bart Van Der Wolf: Use -constrast-stretch or -linear-stretch, possibly eliminating a few outliers in the process.

Call this normalized luminance (turned into an alpha, really) IMG3.

Step 5: Lerp (blend) the two results based on the luminance pseudo-image used as an alpha channel.

IMG4 = IMG3 * IMG1 + (1-IMG3) * IMG2

This, right there, is the key idea:

A pixel may be dark because it is part of an exaggerated dark halo. Since the version resized in linear light has the worst dark halos, use lots of the gamma version at this location. (IMG3 = 0 means black implies pure IMG2.)

Conversely, a light pixel is unlikely to be part of an offensive dark halo. If a pixel is light, use lots of the linear light result. (IMG3 = 1 means white implies pure IMG1.)

Note: The difference between IMG1 and IMG2 is only large where things are rapidly varying. Elsewhere, it does not matter which one we pick.

Step 6: Convert back to sRGB, basically getting the result of

convert IMG4 -colorspace sRGB output.png

-----

Pretty terse. Makes sense?
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 16, 2014, 08:11:15 am
I am particulary interested in whether it is useful for mild downsampling, and rotations.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 16, 2014, 07:47:06 pm
Pretty terse. Makes sense?

Yes. I've got a first version working, but my skills with blending in IM are limited, so I probably need to simplify the code a lot (after reading more about the various options), and not use so many temporary images on disk for assembling the transparency. I also get artifacts in the dark regions, and a colorprofile shift.

So it will take more time to check for errors, and probably 16-bits/channel are not enough to avoid artifacts. Other than that, the results look pretty good (as expected) on different types of subject matter.

Cheers,
Bart

P.S. The artifacts in dark regions are fixed by forcing all input to 16-b/ch, so maybe 16-b/ch is afterall enough for a gamma 3 and a linear light conversion. Some more testing is required to make 100% sure there is no significant damage.

P.P.S The color profile shift is also solved. It had to do with that PNGs used to officially not be Color managed, but some programs do colormanage them, others don't. So it was not an IM issue.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 17, 2014, 04:15:43 am
Bart: I believe you can force an early conversion to Q16 in IM by inserting a command into the toolchain early on?

Also, at least in Unix dialects, you can create a "stack" of intermediate results you can select outputs from. (I'm guessing this works in Windows because it really is part of the ImageMagick command line language.) I've done this in the past, only I forget the exact syntax.

P.S. Has to do with image lists and the \( (the "\" is the Unix escape) and -clone operators.

http://www.imagemagick.org/Usage/basics/#list_ops (http://www.imagemagick.org/Usage/basics/#list_ops)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 17, 2014, 04:35:46 am
Bart:

My apologies for not having the time to be more helpful right now (about my own experiment, no less).

Hints: Maybe the most efficient way to do this is to attach the luminance as an alpha channel to one of the two resized images, and then use something from the large tool box http://www.imagemagick.org/Usage/compose/ (http://www.imagemagick.org/Usage/compose/).

Also, if you start a ImageMagick User Forum post on this project, I am guessing you'll get pertinent advice.
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 17, 2014, 04:50:36 am
Also: It is very likely that IM normalizes alpha channels to the "quantum" (0 to 255 in 8 bit, for example) instead of [0,1] so that they can be understood as regular greyscale images.
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 17, 2014, 05:44:18 am
Also: It is very likely that IM normalizes alpha channels to the "quantum" (0 to 255 in 8 bit, for example) instead of [0,1] so that they can be understood as regular greyscale images.

Yes, I already had that covered, also by making it tweakable. That might help to avoid outliers from determining the maximum/minimum, but it's probably such a minor effect for resampling (all pixels will be new) that I'll relax that as well. Afterall, it's only a blending mask turned to an Alpha channel for a later 4-channel RGBA composite.

I'll send you a copy of my Windows batch file by PM as it currently is. It needs some more optimization (if possible), but that's now a smaller task).

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 17, 2014, 05:55:09 am
Bart:

My apologies for not having the time to be more helpful right now (about my own experiment, no less).

No problem, the script contains some operations I wanted to learn better anyway, so this was a nice opportunity.

Quote
Hints: Maybe the most efficient way to do this is to attach the luminance as an alpha channel to one of the two resized images, and then use something from the large tool box http://www.imagemagick.org/Usage/compose/ (http://www.imagemagick.org/Usage/compose/).

That's how I had already implemented it. Seems I was on the right track ;)

Quote
Also, if you start a ImageMagick User Forum post on this project, I am guessing you'll get pertinent advice.

Yes, although I'd have to subscribe to yet another forum. I have enough distraction as it is, but maybe I'll join yet.

Cheers,
Bart
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 17, 2014, 06:35:40 am
TTBOMK, in ImageMagick, you need to specify -set colorspace sRGB first thing if you want an sRGB png to be treated as sRGB.
This rather inconvenient choice was pushed by yours truly because, indeed, some people/programs shove non-sRGB content into PNGs, even though they are often sRGB. So, being agnostic seemed like a good idea. This probably was a mistake.
TTBOMK ImageMagick does not, by default, import based on colorspace information found in the metadata.
http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html (http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html)
Title: Re: Most favourable up-ressing percentage
Post by: NicolasRobidoux on July 17, 2014, 07:04:49 am
Bart:

Thank you. This was quick!

I really like your use of -contrast-stretch.

(No Windows machine so I'll translate back to unixese and see if I can use image lists to get rid of intermediate images, and also check whether there are 16-bit or other "computation" artifacts.)
Title: Re: Most favourable up-ressing percentage
Post by: Bart_van_der_Wolf on July 17, 2014, 12:00:32 pm
Bart:

Thank you. This was quick!

I really like your use of -contrast-stretch.

(No Windows machine so I'll translate back to unixese and see if I can use image lists to get rid of intermediate images, and also check whether there are 16-bit or other "computation" artifacts.)

I've 'fancified' the Windows formatted batch file a bit for easier use in a Windows environment, and started a new thread about it here (http://www.luminous-landscape.com/forum/index.php?topic=91754.0). With your permission it is available for all to use and enhance. Everyone is invited to Do share your thoughts and modifications, preferably in that thread.

Thanks for the inspiration and suggestions. Keep them coming...

Cheers,
Bart