1

I'm making the reasonable assumption that software implements sharpening via convolutions.

Convolutions are both commutative and associative. So... why do we talk about capture sharpening, local contrast enhancement/HIRLOAM, and output sharpening as separate things when the can be done in any order, or all at once, for that matter? Clipping is the first thing that comes to mind; the second thing is that I'm an idiot who's misunderstanding something fundamental.

2

Yes, all the convolutions you mention could be combined into a single one for final implementation.

However, it makes sense to break the individual requirements apart in the user interface. A raw convolution kernel function is difficult for even someone trained in such things to mentally derive or convert to the time domain (in this case actually space domain) effects. You want several knobs that adjust things in human conceptual space, then have individual or combined convolution kernels created under the hood.

The reason for not combining the convolutions of several effects is more likely due to software structure. Especially with a larger application that has a plugin architecture, each plugin needs to do its thing independently. There would have to be special resources in the main app that would allow plugins to add their specific modifications to a global convolution kernel. And, that would only work in the case of linear effects, which many aren't. The single global convolution would also need to be quite large, possibly executing slower than a few smaller convolutions successively. The global convolution engine could look to see how far out the non-zero data extends, but that adds more complexity and more runtime decisions.

All that said, sometimes effects are combined. I do this in my own software on brightness mapping. I have several user-visible controls, some linear some non-linear, but much of the result ultimately gets converted into a set of lookup tables. I haven't implemented sharpening yet, but I probably will fold that into the output filter. That is currently a convolution used for anti-aliasing when writing to lower resolution.

Added about brightness mapping

My software allows for several ways of controlling linear brightness mappings, and multiple non-linear mappings that are combined. The linear mappings are ultimately converted to a Y = mX + b format internally, despite a number of ways of effecting that from the user interface. The non-linear mappings are defined in terms of logs and exponentials, which would be very time consuming to compute each pixel, or each individual contribution to the 2D filter for each resulting pixel value.

There is some computation that needs to be done on each color value as a whole, but most of the linear and non-linear mappings are ultimately combined into three lookup tables, one per color. I represent the raw image internally with 16 bits per color per pixel. For a modern computer, three lookup tables of 65536 entries each is no big deal. With that relatively small emount of memory, any arbitrary mapping from input intensity to output intensity can be represented. The tables are loaded by doing the log, exponential, and other calculations. When the actual pixel mappings take place, all that just becomes a lookup.

Three lookup tables per color can only handle certain things. Some mappings work on the whole pixel color globally and can't be separated into independent R, G, and B mappings. Still, many can, and the lookup tables combine any number of them conceptually applied in series and laboriously calculated into a single lookup.

  • Could you expand on what you are doing with brightness mapping? It sounds interesting. – JenSCDC Oct 17 '14 at 14:35
  • 1
    @Andy: See addition to the answer. – Olin Lathrop Oct 17 '14 at 15:11
2

Well, for one thing, output sharpening is resolution- and device-dependent. When it gets right down to brass tacks, you'd sharpen differently for different papers on the same printer and at the same resolution if you're at all interested in making the best possible print — a printer/paper profile may compensate for colour and (to a somewhat lesser extent) density range, but it won't compensate for dot gain and its effect on apparent detail rendering.

But to go a bit further: capture sharpening is essentially compensation for flaws in the process, from minor lens flaws to demosaicking and optical low pass filtration, to in-camera and post-processing noise reduction. Regardless of your final rendering intention (how much you wish to emphasize of de-emphasize detail and local contrast), you'll want the best possible baseline image to work with. The reason for doing this up-front is that your rendering intentions may change, and you want to establish a baseline as few times as possible in the process.

Neither output sharpening nor capture sharpening require much in the way of judgement; they're essentially "mechanical" processes applied to a two-dimensional image, one to get a good image to begin working with, and the other to render your final intentions to your chosen output media (on-screen at various resolutions as well as printed at various resolutions on various papers using various processes).

Creative sharpening is a separate process because it's not "mechanical" (unless you're the sort of "purist" who believes that you should take what the camera gives you and be thankful, in which case failing to shoot JPEG rather than raw is already showing a degree of hypocrisy). This is the part in the process where you choose your film (or combination of films), so to speak. And yes, depending on the software and workflow you're using, this can become irretrievably mixed in with capture sharpening (but, one would hope, not with output sharpening, unless you only ever render to one device/medium at one resolution). When there is a choice, you'd want to keep it a separate step so that you don't need to redo the capture sharpening when you change your mind. But creative sharpening is more about establishing contrast than finding and refining edges; it's working to give the illusion of a third dimension (or, in the case of things like skin smoothing, to selectively suppress the intrusion of the third dimension into the two-dimensional representation).

1

Splitting the sharpening into multiple tasks allows for finer control.

Since some kinds of sharpening are creative and therefore subjective (local sharpening of eye, local contrast enhancement etc.), it is a good idea to have individual control over all stages to make sure the result is not overcooked.

Besides that, different types and magnitudes of sharpening problems respond better to different sharpening algorithms or techniques (USM, deconvolution, high pass, edge masking...)

Clipping is the first thing that comes to mind;

Definitely. Some others are control of noise, suppression of large halos and to add an esoteric one, to preserve characteristic drawing style of a lens.

  • High pass sharpening falls under USM's umbrella- mathematically the only difference is the function used to blend the um... "high pass data" with the original data. With USM, you're limited to addition and subtraction, but if you use the HPS workflow you get more flexibility. – JenSCDC Oct 18 '14 at 10:42
  • FWIW there's something odd about PS's high pass. It's better to duplicate the layer, blur it, and then select the unblurred layer, do Apply Image using the blurred layer using Subtract, Scale = 2, and offset = 128. Here's the article where I learned this web.archive.org/web/20131005053201/http://… – JenSCDC Oct 18 '14 at 10:47
  • Yep, clipping makes those operations "Non Linear". Actually this is the magic behind USM in Photoshop in comparison to those who just apply is as classic math. – Royi Feb 23 '18 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.