Dan Margulis Applied Color Theory

 What Should Proper Sharpening Do?

proper "sharpening" at all scales, ideas (and rants) about the unsha
Posted by: Jacob Rus
Fri Dec 5, 2008 8:32 pm (PST)

Hi all,

I thought I'd send along some thoughts about "sharpening", because I hope that others either know where to look for improved tools or how to bend Photoshop into a more useful form, or will perhaps have ideas of their own in response to my rambling. Hopefully the length and assumed experience here aren't too off-putting: improving local/edge contrast of images is a large subject, which could probably fill a book, so it takes a bit of explanation to get my thoughts across.
 
Motivation
----------

Whenever I have the time to spend on an image, and after having made global contrast adjustments through curves (or usually the "Jacob's ladder" technique) I use the unsharp mask tool (I'd rather call this "Gaussian sharpen", since it does not behave quite the same way a real photographic unsharp mask would, and because that would give a much better indication of how it operates and its relation to the Gaussian blur tool--the two could incidentally be combined into a more useful tool, more on this later--but at this point we're probably stuck with the name) repeatedly on the L* channel, at several radii, starting with a very large radius (e.g. 250 pixels--the inability to push this higher is unfortunate) at some extremely low amount (usually no more than 4 or 5 percent, but enough to be a larger effect than ultimately desired), and then repeatedly stepping radius down by half or so & amount up, as I apply the filter again & again, each time aiming for a somewhat excessive effect. I do this all the way down to 0.2 pixels or so. Then, I can dial down the opacity of my "sharpened" layer to an appropriate amount (I usually do this about half), and the result is that I end up with an image which has the acutance (local contrast) I desire at every scale, and which is therefore as "punchy" as I can manage (or sometimes it has intentionally subtle distinctions, &c.), while avoiding creating garish halos or excessively accentuating noise.

A bit more about my technical thoughts about this below, but first a practical question: the best image quality is clearly achieved if as many radius steps as possible are included in the process (with substantially diminishing returns in time spent after five or six applications of unsharp mask), because this allows for details at every scale to be properly highlighted. Unfortunately, I've had some amount of trouble coming up with appropriate actions to automate the process: I adjust the amounts by eye, and the properties of different images require different treatments. I admittedly haven't done *that* much experimentation along these lines though, so my first question is whether anyone has tried to design actions or scripts which facilitate improving local contrast at every scale in a simple straight-forward way. Anyway, this takes rather more time than I'd like it to; more discussion about that below too.

Preliminaries: How unsharp mask operates
----------------------------------------

Unsharp mask essentially decides the value of a particular pixel (call it p) by multiplying the existing value of that pixel by (x + 1), where x is the "amount" of the pixel, and then subtracting x times a weighted average of all the pixels in the image, where the weighting function weights pixels using a Gaussian or normal distribution based on their distance from the pixel p--a distribution with standard deviation equal to the "radius" setting.

This "works" (i.e. increases acutance) because it drives the value of the pixel *away* from the local average value in the region, making the pixel more extreme. Several nearby pixels with originally identical values, against a dissimilar background, will all be moved in the same direction, especially at their edges, and the result is that the values at the edges of shapes move apart. The effect is strongest on the pixels of delicate features & sharp corners, but also significant along straight edges, and weakest (predictably) in the pixels which most closely match the average of their neighbors. Along any boundary between shapes (of two solid colors), an "amount" of 100% will double the difference in values between pixels on opposite sides of the edge (unless radius is extremely small); if the edge is straight, each pixel will be pushed half of that difference away from their average; if a foreground shape is extremely thin, then its pixels will be pushed 100% of the difference away from the background, while the background pixels will be nearly unaffected.

Hopefully the above explanation all makes reasonable sense. It's a bit complicated and would probably best be illustrated with diagrams. Anyway...

Okay, so what does radius mean practically? Well, we can think of the Gaussian distribution ("bell curve") which makes our weighting function as diminishing the effect of each pixel on our pixel of interest as the distance between them increases, but alternately, and more practically, we can imagine that as we move away from the edge, the overall effect of the filter on pixels in a shape falls off with distance from the edge, so that once all of the pixels within two or three standard deviations (multiples of the radius) of our pixel average to the same value as our pixel itself, the effect becomes negligible.

Aside: T he Gaussian distribution makes computation fast for 1980s-era machines, because as it can be decomposed easily into horizontal & vertical components, and then is a convolution of the image with a simply computed kernel which can be done in several ways, but is (at least) fast & simple math if FFTs are used (look convolution up in wikipedia if interested).

What's the matter with bell curves?
-----------------------------------

Unfortunately, the Gaussian distribution is *never actually* what we want to use in "sharpening" an image. It can easily create garish halos, because we want strong effects at tight edges, but also want to take into account the contribution of medium-scale shapes. (The unsharp mask tool has other problems, discussed below, but I'll focus on this one for now.) So what happens is, either we split the difference, picking a radius & amount which negotiates that trade/off between sufficient edge contrast and unattractive side-effects, or we do multiple passes with the unsharp mask tool, at different radii, with each one targeting different scale shapes. Dan oddly names our increase of local contrast at different scales by two different names,† respectively "hiraloam sharpening" & "conventional sharpening", which is unfortunate for three reasons: (a) neither name gives much indication of what is being attempted; (b) the distinction between the two is completely artificial, as they simply operate at different scales, so that a viewer stepping back a few paces, or examining the image as a whole would notice one and a viewer peering closely at details would notice another; but mostly (c) it implies that the additive combination of two Gaussian distributions is the proper shape for enhancing local contrast, an idea not quite but nearly as incorrect as the idea that a single Gaussian distribution can cut it.

Why is the Gaussian distribution bad for sharpening? Because it is relatively flat for a while in the middle, and then drops off precipitously to almost zero. This characteristic "shoulder" is the halo created by the unsharp mask tool which is so distasteful when overdone. The distribution has one benefit that I can see, which is that it makes the radius simple to understand conceptually, and limited to a single slider, and is therefore beginner friendly. But really, Gaussian sharpening as it exists in the unsharp mask tool is designed for 80s hardware & unsophisticated users, and I am astounded that it has not been improved in 20 years of Photoshop ("smart sharpen" is some kind of tragic ironic joke).

How can we improve our "sharpening"?
------------------------------------

In any image, we must make critical choices about how much contrast to allocate to each region, each detail, &c.: this is in a nutshell the art of photography and of image-making more generally: it's the idea of Ansel Adams's zone system, and the main point of every book about color correction in Photoshop, though some of them haven't necessarily considered it out in those terms, and the inspiration for the various HDR tone-mapping algorithms which have been developed over the past few years, including Photoshop's shadow/highlight tool, &c. In an existing image, what makes up details (shapes and textures) is contrast at different scales/spatial frequencies, in different parts of the image--this is the fundamental insight behind Fourier decomposition of images or other signals into a frequency domain, and we can think of "sharpening" and similar operations as operations in the spatial frequency domain in order to change the visual effect in the spatial domain. Anyway, I'll cut the math jargon so I don't start losing less technical readers. Basically, our image has different amounts of contrast at different scales, and that makes up the shapes that we see. If we start taking up more contrast in the small scale, we run up against overall limits in the amount of contrast we have available to us, and we either have to reduce overall ("global") contrast in the image, or we start to create nasty artifacts.

Okay, so when we apply unsharp mask to an image, what we're trying to do is bring out (i.e. make visually distinct and interesting) features: shape details, textures, and so forth. These features have different sizes, and contrast to different degrees. Humans generally find images with more distinct features at every perceivable scale to be the most interesting. So what we want to do is usually bump up the edge contrast for shapes of every size, so that, for instance, a tree contrasts with the grass behind it, and then individual leaves in the tree contrast with each-other, and then, at the smallest scale, the texture of the leaves is also apparent, and their edges have sharp definition and tiny detail.

If we use a Gaussian function for weighting our sharpen, we can increase the contrast in one such distance range, but instead of making razor-sharp-looking edges, we actually make somewhat wide edges, with definite halos with their own distinct shapes. This is because the Gaussian function has horizontal slope at 0, and then a "bell top" region of significant effect between 0 and 1 standard deviations from 0, and then very quickly falls off towards zero from there, and by 3 standard deviations has almost no effect whatsoever. Okay, so what happens is our pixel moves away in value from other pixels which lie at particular distances--mostly between 0 and 2 standard deviations. This has the effect of especially heightening any details which are overall 1 or 2 standard deviations in size. Anything bigger will have its edge contrast increased with a halo extending about 1 or 2 standard deviations away from the edge, and anything smaller will be effectively un-enhanced.

Because we want to highlight delicate details as well, and avoid halos, we want to instead use a weighting function which immediately starts decreasing at 0 (unlike the horizontal slope at 0 of the Gaussian function), and which does not go to zero quite so fast as we get away from 0. Perhaps some function which looks like `y = e^(-x)`. To construct such a function out of the unsharp mask tool involves its repeated application. We need to carefully eyeball the image after each step, and try to make sure that we overdo our sharpen by about the same relative amount each time, so that when we then cut global opacity on our newly-sharpened copy of our image, we'll end up with various distance ranges sharpened appropriately. This takes practice to learn, and time and finesse to perform; it's tedious and easy to screw up. Overall, we'd really prefer to just use a better tool. Still though, it's usually worth running unsharp mask at least four or five times, if not more, because the improvements to images are quite dramatic, and the result is significantly better than only one or two applications of the tool can accomplish.

What do we want instead?
------------------------

What would I prefer? Well, first and most simply, I don't understand why Gaussian blur and unsharp mask need to be separate tools, or why "sharpen", "sharpen more", "sharpen edges", "blur", or "blur more" even exist (they're utterly pointless). Gaussian blur is exactly the unsharp mask tool, where "amount" has been set to -100%, and threshold has been set to 0. I also can't really imagine uses for "box blur", "shape blur", "radial blur", but I can see that someone might imagine such a use; all three are nonetheless extremely simplistic, and radial blur in particular could be fairly easily beefed up for sophisticated users without sacrificing comprehensibility for novices. I think having all of these myriad menu options brings Photoshop down for everyone; many of these tools are so simplistic even novices have no use for them, but their existence bothers every advanced user who must visually scan past them every time Photoshop's menu is examined. Anyway, that rant is a bit off-topic.

What I'd like to see in an ideal world is a tool which provides something like a curve of some sort, with radius (probably in logarithmic scale) along the horizontal axis, and amount (maybe also logarithmically) along the vertical axis. I'd be able to adjust the amount of effect at every scale by drawing a curve in a box, and in a single interface with a real-time preview perform what now takes infinite (or to quite roughly approximate, at least 5 or 6) invocations of the current unsharp mask tool. This would have several benefits: it would let us sharpen different scales using a single tool, and would take a lot of the guess-work out of the process. It would allow the various inputs to the process to be figured out, and then applied selectively, with some deferred for the end--for instance, this would allow fine detail sharpening to happen very late in the image processing cycle, so that small exaggerations to noise wouldn't be further amplified by intermediate retouching steps. My ideal-world tool would allow the "amount" axis to range from at least -100% to +500%, so that blurring and sharpening at different scales could be achieved.

To be especially sophisticated, the tool would also have another curve by which I could set how much the effect should be at different amounts of contrast, so that I could accomplish the same thing the current threshold slider does, but with more nuance, and also could cut or cut out the sharpening effect at the top (already high contrast) end. We could, in other words, break down the linear transformation of edge contrast provided by the current tool. And the tool would maybe even have a way of separating the effect in highlights, midtones, and shadows.

This would require some amount of serious investment in experimentation and testing, to figure out the proper parameters to expose to the user, and possibly even some basic research in human vision, or at least the consideration of previous basic vision research. Designing a decent interface which didn't overly confuse new users would take considerable usability testing and implementation effort.

What can we build for ourselves?
--------------------------------

Here's where I'm hoping for some advice from the list. I still need to experiment, but I've been having trouble constructing actions to make manifest my desires for a sharpening tool. If I want to counter effects at different lightness levels, in different difference ranges, and so forth, I need to get really creative, with, for instance, putting curves on specially-constructed high-pass filter layers (I am not precisely sure what Photoshop's high-pass filter does--I should do some more experiments, but if anyone knows the technical details I'd be obliged), with masks built to hit mainly highlight or mainly shadow regions, etc. Some of this may be figure-out-able and generalizable, and scripts or actions could maybe be constructed to perform the desired movements. But I haven't figured anything out yet, particularly. Alternately, maybe there's a good tool outside Photoshop or in a plugin that does a better job at improving local contrast at various scales from small to big, and gives the operator lots of control. I'd like to hear about it.

I'm going to do some experimentation in about a month, during the finals period of this semester when I have a bit more time, and I'll report back with any progress I make. I'm hopeful that Photoshop can be hacked into shape, but am still looking for inspiration.

Two other problems with unsharp mask
------------------------------------

Unsharp mask also simply multiplies the value difference between adjacent shapes, in a linear way, and then has a single lower-bound cut-off point (called "threshold"), which prevents noise, and mostly this means color noise in RGB images, and especially in the R & B channels (not to suggest that Fats Domino or Ray Charles just makes noise!!), from being amplified, when overall there is not so much difference between pixels. First, the operation of this cut-off is quite arbitrary from the perspective of what the user needs it for, and indeed is mostly only needed because unsharp mask computation is performed in a brain-dead color space like RGB or CMYK, where such disproportionate color noise can "infect" channels which also contribute to overall value/lightness. But more importantly, this linear effect is bad because it undesirably excessively accentuates already strikingly contrasting shapes. That is, because the multiplication of contrast is linear, two strongly contrasting regions are spread apart with *even more* distinction than two less contrasting regions. What we actually want is to increase the contrast more among similarly valued pixels, so as to drive them apart. Two regions of extreme contrast only need a slight contrast boost, if any. In other words, we get really ugly excessive halos and we often over-sharpen fine details with already high contrast, or already rough textures, when all we really wanted to do was bring out edges and bring blurry shapes into focus. A truly sophisticated tool would provide some kind of curve or set of sliders for determining the shape of the fall-off at both low and high ends, so that a more accurate low-bound "threshold" could be determined, and also so that the effect could be reduced or eliminated (or perhaps sometimes even reversed) for very high contrast shapes.

Unsharp mask has the same effect at every absolute value level. Often, highlights or shadows call for differing strength effects, or even for different scale effects. This can be done through masking & the changing of blend modes, in various combinations, but that's a giant bother, and somewhat hard to get right at the edges of the masked regions. The "smart sharpen" tool does not properly address this set of concerns, though I guess at least they're trying.

Conclusion
----------

I think there's considerable remaining space for experimentation, both within Photoshop and without, first for the creation of algorithms which sharpen the image as we would like, and second for novel user interfaces for controlling their parameters. Even in the absence of new tools, I imagine that some of Photoshop's tools are hackable to give us some of what we want. At some point, I'll try to do some more careful and exhaustive experimentation. If others on this list have pointers though, or really any kind of responses, I'd be much obliged.

Do you think this is a useful way to discuss local contrast enhancement? Is there any good way of explaining the concept to novice users? Any diagrams which would do the trick? At some point I'd like to write some of these ideas up with example images and a bit of a tutorial bent, as I think even most experts don't think carefully about what sharpening really means.

Anyway, I should get back to real work now, as I've spent a whole afternoon on this email that I didn't really intend to spend. Apologies for its length and any excessive repetition or confusing description, or for anything I inadvertently left out.

Cheers,
Jacob Rus

† I hope that Dan doesn't take this as personal criticism. The oddity here extends to a whole industry of image experts and the whole software market, and Dan's peculiar terminology is far from the worst of it, though to be honest, I'd have expected a catchier term than "hiraloam" (what a mouthful!) and a more descriptive one than "conventional" even if a particularization is needed to denote local contrast improvement for, respectively, medium- & small-scale features.
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: George Machen
Sat Dec 6, 2008 10:55 am (PST)

Jacob Rus wrote:

... Dan oddly names our increase of local
contrast at different scales by two different
names,† respectively "hiraloam sharpening" &
"conventional sharpening", which is unfortunate ...

I actually take a complete opposite stance here. Indeed, I go so far as to object to even Dan's use of "hiraloam" and "sharpening" in the same breath, because I consider the two effects on images as qualitatively different enhancements:

- I regard sharpening as increasing edge definition, or acutance.
- I regard hiraloam or local contrast enhancement as shaping or modeling.

Even though both involve the same operational process at different scales, I think their effect on the image to better simulate human perception are in two distinct realms. I see use of the USM tool to attain shaping or modeling of image subject matter as a clever "abuse" of the tool outside the scope of its normal application, akin to use (abuse) of "false profiles" or "false separations" as swashbuckling methods to obtain different results unrelated to their intended purposes.

I think Jacob's subsequent remarks actually bear me out, but where he sees a continuum, I see a sharp conceptual break. I fear that not seeing them separately may lead to yet another flavor of a long-standing problem that has for so long plagued the color correction field: While Jacob's descriptions of his process of correcting images do indicate that he duly & thoughtfully considers their significant content subjectmatter, nevertheless my "Calibrationist radar" went off while reading his remarks (possibly knee-jerk; I hope I'm wrong), and I feel like I can already see it coming: a whole new initiative by the Pixel Mafia to take over an entire industry with "appearance modeling" involving automatic adjustment algorithms that ignore the individuality of image subjectmatters that only human judgement can discern.

I do like Jacob's proposed sharpening tool that uses curves (not Lightroom-type sliders!) to adjust various parameters. I can see how it could simplify our present cumbersome use of blend mode layers, masks, and such to accomplish our task.

Digression: Inasmuch as we're at the moment stuck with the cumbersome use of blend mode layers, masks, and such, there's an interesting thread over on DPReview about sharpening through a type of edge mask I've not heard of before:
http://forums.dpreview.com/forums/readflat.asp?forum= 1006&thread=29402337&page=1

It's a method for microdetail enhancement to sharp edges without introducing halos. Whereas Photoshop's USM presumably depends on some difference of blurs for edge detection (note: I have been led to understand that Photoshop's USM does not use Gaussian Blur, but one still gets those halos!), this guy's procedure uses an edge detection of a prior edge detection. A "second order" edge detection, if you will. Or a *rate of change* of edges.

- George Machen
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Francis Corvin"
Sat Dec 6, 2008 2:22 pm (PST)

Jacob,

I can't yet answer your questions, but I wanted to say I have rarely read such a cogent, clear and insightful explanation of the shortcomings of USM. I find it accurate in that it does reflect my own limited experience.

The idea that the series of stepped USMs attempts to approximate e^-x makes a lot of sense in theory (I haven't tried it in practice). However, using e^(-x) makes an arbitrary balance between sharpening at all scales that may not suit everyone (at some point, when I'm not happy with the overall contrast, I prefer to play with an S curve than a vast and unwieldy USM). Therefore you might want to consider an additional slider n such that you can work on e^(-x^n)... which would give you Gauss if you so wished.

Of course, the very advantage of the fast drop-off in a Gaussian blur is that it imposes a limit on the computation and therefore is a fast algorithm. So e^(-x) --- let alone a^(-x^n) --- may be too computationally intensive for today's time-sensitive workflows.

Best regards,

Francis Corvin
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sat Dec 6, 2008 7:51 pm (PST)

George Machen wrote:

Indeed, I go so far as to object to even Dan's
use of "hiraloam" and "sharpening" in the same
breath, because I consider the two effects on
images as qualitatively different enhancements:

- I regard sharpening as increasing edge
definition, or acutance.
- I regard hiraloam or local contrast enhancement
as shaping or modeling.

Even though both involve the same operational
process at different scales, I think their effect
on the image to better simulate human perception
are in two distinct realms. I see use of the USM

Well, the question I suppose is whether it's actually helpful to draw a bright line, and where? Between 1 px and 10 px somewhere? Between 10 px and 100? The visual effect depends on the distance of the viewer, and even what he's looking for when he examines the image. There's a clear trade-off between large-scale and small-scale contrast, because we have only a fixed amount of contrast to allocate (namely, between off and full brightness for a computer display, or between substrate and solid ink coverage for reflective media). So I like to think of the choices to "blur" or "sharpen" contrast at various scales as being significant artistic choices. Some of my favorite photographers have images which look very flat from a distance, because they instead focus on maximally emphasizing local details and textures. Others push whole regions of their photographs into near complete obscurity, because they want to emphasize dramatic large-scale contrast shifts between shapes. Even increasing acutance at the smallest scale to prevent an image from appearing blurry or out of focus has some (often substantial) impact on this trade-off.

tool to attain shaping or modeling of image
subjectmatter as a clever "abuse" of the tool
outside the scope of its normal application, akin
to use (abuse) of "false profiles" or "false
separations" as swashbuckling methods to obtain
different results unrelated to their intended purposes.

Hmm. I'd be somewhat interested to hear the history of the unsharp mask tool in graphics applications such as photoshop, and also to hear whether film photographers ever made dramatically unsharp masks to boost contrast at medium scale. I imagine that the high-end imaging workstations had similar tools before PS did, but I really have no idea. In any case, I'd hesitate to ascribe intent to programmers I've never spoken with.

I fear that not seeing
them separately may lead to yet another flavor of
a long-standing problem that has for so long
plagued the color correction field: While Jacob's
descriptions of his process of correcting images
do indicate that he duly & thoughtfully considers
their significant content subjectmatter,
nevertheless my "Calibrationist radar" went off
while reading his remarks (possibly knee-jerk;
I hope I'm wrong), and I feel like I can already
see it coming: a whole new initiative by the
Pixel Mafia to take over an entire industry with
"appearance modeling" involving automatic
adjustment algorithms that ignore the individuality
of image subjectmatters that only human judgement
can discern.

I do like Jacob's proposed sharpening tool that
uses curves (not Lightroom-type sliders!) to
adjust various parameters. I can see how it could
simplify our present cumbersome use of blend mode
layers, masks, and such to accomplish our task.

As a general principle, I dislike giving over control of any aspects of the image creation process unless I know precisely what they're doing. For instance, I am willing to enable autofocus and auto exposure metering only when I expect them to behave predictably. When it comes to software tools, I would much rather see software vendors such as Adobe aim to make tools which can be used quickly and effectively *with some experience*, but which are also flexible and put as much control as possible into users' hands. "Push-button" algorithms are nowhere on my agenda. That said, if some automatic algorithms can be developed which in one click dramatically improve most images, I wouldn't be opposed to revealing them: plenty of users just want to shoot and print snapshots without careful aesthetic judgment, and there's no reason not to provide them with best possible automatic output. Why do you consider automatic tools a plague?

masks, and such, there's an interesting thread
over on DPReview about sharpening through a type
of edge mask I've not heard of before:

http://forums.dpreview.com/forums/readflat.asp?forum= 1006&thread=29402337&page=1

This is a bit long and complex, but I'll try to read and digest when I have some time. Looks interesting anyway.

(note: I have been led to understand that Photoshop's USM
does not use Gaussian Blur, but one still gets those halos!),

It seems to me to have a pretty darn Gaussian looking shape: I'll try to see if I get identical results when I sharpen some shapes using Gaussian blur instead; my impression is that I will. If that is inaccurate though, I'd certainly be interested to hear more precise details of what the tool is doing.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Alex Kent"t
Sat Dec 6, 2008 7:51 pm (PST)

jacob,

thanks for this post, it was an interesting read.

i can reply to a few points quickly: unfortunately "sharpen", "sharpen more", "sharpen edges", "blur", or "blur more" all exist for historical reasons. presumably adobe are frightened of breaking people's recorded Actions and bad habits if they remove these.

"shape blur", "radial blur" - useful for creating; a simplistic example, to set a still wheel to a spinning.

the gist of your Filter Menu rant, i completely agree with. most of the Filters menu is antiquated crap, with horrible ui and very limited function. as you pointed out, there are so many filters included that each one gets diminished.

with regard to the wider argument for a more modern approach to sharpening;have you ever seen the 'KPT Equalizer' filter ? the KPT Equalizer, as i understood it, was a 'graphic equalizer' style row of vertical sliders each which controlled a different radii of USM/ blur. sliding each slider changed the amount +100% (sharpen) to -100% (blur) for each radius.

whilst this isn't actually using a continuous curve for the ui (which is an elegant idea i think), this filter had a similar function to that which you're suggesting: it allowed you to sharpen or blur details at many different scales all from one interface in a single pass.

i believe it was included with the KPT-X set, the last set of KPT filters released. i think there is a macosx version (as opposed to OS9) but i don't have it to hand so can't check if it works with a current Photoshop. i experimented with it for a while, but in the end the 'unique' interface of all the late KPT filters became too frustrating to use regularly.

alex kent.
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sat Dec 6, 2008 7:51 pm (PST)

Jacob Rus wrote:

It seems to me to have a pretty darn Gaussian looking shape: I'll try
to see if I get identical results when I sharpen some shapes using
Gaussian blur instead; my impression is that I will.

I just tried this, and verified that unsharp mask does in fact do the precise opposite of Gaussian blur. To see this for yourself, try the following:

* Get a low-contrast image in grayscale mode (something like all values falling between L* =40 and L* = 60; grayscale so we only have one channel to worry about )
* Make four copies of your background on separate layers.
* Apply unsharp mask to the topmost layer, 10px radius, 100%, no threshold. Set its blend mode to difference, and merge down onto the next layer below
* Hide that layer, apply Gaussian blur to the next layer down, 10 px, set *it's* blend mode to difference, and merge it onto the layer below
* Toggle between the two layers, and notice that they are identical

This happens because the difference blend mode is the *absolute value* of the difference.

Interestingly, high-pass filter doesn't seem to precisely have the same effect as Gaussian sharpen (unsharp mask) or Gaussian blur. It's fairly similar though. To use a high-pass filter for blur or sharpen, do these steps:

* Duplicate your background layer
* Run high-pass filter on the duplicate layer with the desired radius
* Set the blend mode to linear light
* Add a solid color adjustment layer, set to exactly middle gray, set its opacity to 50%, right click it and select "make clipping mask". Name this layer "cut 50%".
* Add a curves layer, with the curve inverted, so that it goes from the top left corner to bottom right corner of the box, and set this layer to also be a clipping mask. Name this layer "Invert".
* Toggle the invert layer on and off to swap between sharpen and blur.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sat Dec 6, 2008 7:51 pm (PST)

Francis Corvin wrote:

The idea that the series of stepped USMs attempts to approximate e^-x
makes a lot of sense in theory (I haven't tried it in practice).
However, using e^(-x) makes an arbitrary balance between sharpening
at all scales that may not suit everyone

Yes, I don't imagine ce^(-kx) [or really any similarly simple formula; the gaussian function is just ce^(-kx^2)] is ever precisely the kind of function we want. I was just tossing it out so people could get a better visual picture of the sort of shape I was discussing. :-)

As I said, in my ideal-world tool, there would be a great deal of control over the various effect at different scales.

–Jacob Rus
___________________________________________________________________________
Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sun Dec 7, 2008 6:00 am (PST)

Hi again everyone.

I really should be writing papers about, respectively, Latin American debt crises and the breakdown of the Breton Woods monetary system, but I got sucked into thinking carefully about this "sharpening" problem, and started reading the various links I could find, including that posted by George Machen, and have a (not-so-) quick response.

George Machen wrote:

Digression: Inasmuch as we're at the moment stuck
with the cumbersome use of blend mode layers,
masks, and such, there's an interesting thread
over on DPReview about sharpening through a type
of edge mask I've not heard of before:

http://forums.dpreview.com/forums/readflat.asp?forum= 1006&thread=29402337&page=1

It's a method for microdetail enhancement to
sharp edges without introducing halos. Whereas
Photoshop's USM presumably depends on some
difference of blurs for edge detection (note: I
have been led to understand that Photoshop's USM
does not use Gaussian Blur, but one still gets
those halos!), this guy's procedure uses an edge
detection of a prior edge detection. A "second
order" edge detection, if you will. Or a *rate of
change* of edges.

Actually, that's a somewhat misleading description of what it does (as far as I can tell from reading the text). What you wrote on that page is:

Since a Difference of Gaussians calculation is itself
a method of edge detection, what Joe0Bloggs is
doing would appear to be an edge detection of a prior
edge detection. A "second order" edge detection, if
you will. Or a *rate of change* of edges.

I've not seen that anywhere before, and I think its
use as a sharpening layer mask accounts for its
ability to single-out mid-contrast edges while largely
leaving high-contrast edges alone.

But actually, from what I understand, the intent in the method of mask construction is twofold:

1. Black out non-edge areas ("surface areas"), so that small noise won't be amplified. This is essentially an attempt to make an analogue of the "threshold" value in the unsharp mask tool which is slightly more sophisticated/adjustable.

2. Black out excessively edgy areas ("high contrast edges"), so that ugly halos and over-exaggeration of very rough/contrasty textures (for instance the highlights in hair) can be minimized.

To accomplish those two goals, this method subtracts two different "edge mask" layers from each-other, and uses the result as a new mask. The "edge masks" are constructed using the "find edges" tool, which basically results in a layer which is the absolute value of a high-pass-filtered image (there are various edge-detection algorithms which do variations on this theme; I'm not precisely sure how Photoshop's works), and one of the edge masks has its contrast changed using the levels tool, to force the highlights to clip. When this is subsequently subtracted from the other (notice, "subtracting" is different from "difference", the latter being the absolute value of the former), any areas which are particularly bright white end up getting knocked out of the mask. This is basically sets a particular "upper threshhold" on the mask as well.

Then this mask is used for a layer which is sharpened "conventionally".

What I wrote about the need for a way to deal with these two types of thresholds in my first email in this thread was:

Unsharp mask also simply multiplies the value difference between
adjacent shapes, in a linear way, and then has a single lower-bound
cut-off point (called "threshold"), which prevents noise, and mostly
this means color noise in RGB images, and especially in the R & B
channels (not to suggest that Fats Domino or Ray Charles just makes
noise!!), from being amplified, when overall there is not so much
difference between pixels. First, the operation of this cut-off is
quite arbitrary from the perspective of what the user needs it for,
and indeed is mostly only needed because unsharp mask computation is
performed in a brain-dead color space like RGB or CMYK, where such
disproportionate color noise can "infect" channels which also
contribute to overall value/lightness. But more importantly, this
linear effect is bad because it undesirably excessively accentuates
already strikingly contrasting shapes. That is, because the
multiplication of contrast is linear, two strongly contrasting regions
are spread apart with *even more* distinction than two less
contrasting regions. What we actually want is to increase the
contrast more among similarly valued pixels, so as to drive them
apart. Two regions of extreme contrast only need a slight contrast
boost, if any. In other words, we get really ugly excessive halos and
we often over-sharpen fine details with already high contrast, or
already rough textures, when all we really wanted to do was bring out
edges and bring blurry shapes into focus. A truly sophisticated tool
would provide some kind of curve or set of sliders for determining the
shape of the fall-off at both low and high ends, so that a more
accurate low-bound "threshold" could be determined, and also so that
the effect could be reduced or eliminated (or perhaps sometimes even
reversed) for very high contrast shapes.

But really, the solution offered in the link is a decidedly wrong way to handle this, because a) it is extremely inflexible, and b) there's no reason to believe the mask so constructed looks anything like ideal, no matter what the image.

In general, I think the idea of making "edge masks" for use with the unsharp mask tool is quite laughable, and is basically jumping through lots of unnecessary hoops by users who haven't really considered the straight-forward implications of the tools, and are instead blindly stumbling about using seriously ugly (and undoubtedly inaccurate) kludges based on these imprecise understandings. They're using one type of spatial frequency filter (the mask) to reduce the effect of another spatial frequency filter (the unsharp mask layer), when all the data needed for decision about how much to apply the effect at each pixel is *right there* in the effect of the unsharp mask itself.

Because the effect of unsharp mask is linear with respect to the amount of contrast at the edge, all we need to do is one of (a) separating out the effect of the unsharp mask tool or (b) just using high-pass filter directly, and then just apply a curve to these effects, where we damp down small changes ("threshhold" or "edge mask"), leave medium-level changes applying substantially, and then damp down big changes (this new type of "refined edge mask") as well. This looks like a curve in a shape something roughly like a demented sine wave, which is at 0 at the left, middle, and right, and has a flat slope in the middle to boot, and then swoops down to the mid-left and up to the mid-right. After constructing our curve, we put the whole set in linear light mode. We can adjust this curve to our heart's content and finely control the thresholds at both ends after the process is finished.

Note: this explanation is a bit tougher I fear than my first email, as it really needs diagrams and examples to explain. Apologies. Shorter version: all these "edge mask" sharpening techniques are inventing work for themselves, and in the process they make their operation less understandable, and much less flexible, than just doing the straight-forward thing.

Further note: the fact that people are doing this should imply to Adobe that something is broken that could be greatly improved, and they'd in so doing save their users a lot of extra trouble.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Stephen Marsh
Sun Dec 7, 2008 6:01 am (PST)

Jacob, firstly, thank you for the topic. I can see that it has a lot of potential, please do get back to the list when your other studies are over.

Your post is timely, I have recently been playing with this subject (yet again). I too will let the list know when I have something to report.

As your recent posts cover a lot of ground, feedback may be slow, so please do not feel discouraged if responses are not as you expected. I think that it will be easier for me to "cherry pick" selected comments from your posts, so please forgive any excessive snipping of your original comments, which are appreciated and will be taken into full account (we can all review the original text in context if required).

In reply to - http: //tech.groups.yahoo.com/group/colortheory/message/20703

Jacob Rus wrote:

Interestingly, high-pass filter doesn't seem to precisely have the
same effect as Gaussian sharpen (unsharp mask) or Gaussian blur. It's
fairly similar though.

If I remember the image processing theory correctly, USM and High Pass are doing different things that have similar results, perceptually and when compared with difference tests. Apologies in advance if there are any errors, this is just meant to be a very brief overview in order to perhaps flesh out your quote.

* USM creates the edge difference by subtracting a blurred version of the original image from the original - the resulting difference being between the original and the blurred image. This region of difference decides the areas that will be sharpened.

* High Pass is a [secret sauce] band pass filter, passing through frequencies that are high, while discarding lower frequencies.

* Subtracting a Gaussian blur from the original, normalised via a mid gray offset superficially resembles the Photoshop High Pass filter, however as you note it is not exactly the same, which is why I believe that there is some secret sauce in the Adobe High Pass filter, as it is not as simple as subtracting an inverse Gaussian of the same value (sometimes named Laplacian, although the Laplacian is more commonly detected via a simple convolution kernel and not the more complex Gaussian subtraction). I think it is safe to say that Adobe sometimes add some "secret sauce" to some commands, which may share a "standard" name or definition in other similar software, while at other times they give different names to the same functions as found in other software.

* As the principle of using the difference between the original image and a Gaussian blurred version demonstrates, one can sharpen an image. This principle is extended into finding the difference between two different Guassian blurs, such as found in the "Difference of Gaussians" or "DoG" sharpening approach, which is less sensitive to noise (independently of a threshold function).

* These basic principles can be taken further with say Difference of Median, or Difference of Gaussian to Median. It could be the difference of Smart Blur, Surface Blur, Lens Blur with alpha or many other softening methods.

As one can create the appearance of sharpness by finding differences, one could use the difference that is generated by a softer resampled image to the original. The variations go on and on. As there are many ways to blur or soften an image, one can sharpen with any of these methods.

Although some of these hybrid options are novel and may not have been created or used even today, as noted they are still using the same basic principle that has been around for decades.

So what of the present/future?

Some methods may use deconvolution restoration rather than sharpening to achieve similar results. Technically it is not the same as USM or whatnot, however an average person would probably not be able to tell the difference - both would appear to be sharper than the original. There are of course many problems with this approach, however it does appear to have potential.

Another approach that appears to be gaining some attention is wavelet based sharpening.

My search for information on these last two topics has taken me away from graphic arts and photography and into astronomy and medical imaging - not to mention the odd trip to machine vision and other places that are far beyond my humble background. One problem with this is that the only good info is in published journals, which are mostly at a level beyond my full comprehension (not to mention the cost per article). Finding freely published work is harder, it is mostly from vendors rather than neutral sources.

Sincerely,

Stephen Marsh
___________________________________________________________________________

proper "sharpening" at all scales, ideas (and rants) about the unsha
Posted by: "John Ruttenberg"
Sun Dec 7, 2008 8:45 am (PST)

I've been thinking about implementations which could enable some experimentation with these ideas. For the more advanced ideas of using some different math for the filter, it seems there is some sort of ability to do this in Matlab, which might help a lot. I've never done anything like it, but there is an interface and a Matlab image processing library. I wonder if anyone on the list has ever used this to make a plugin? Or just to experiment with images (perhaps outside of Photoshop.)

I also thought about how to play more flexibly with multiple applications of USM at different radii. What about making 5 or 6 smart filter layers, one for each of the radii? Instead of using a very low amount in the USM dialog, use a very low opacity for the layer itself. Once the layers are created, their opacity can be adjusted independently and even their thresholds can be changed. The actual creation of the smart filter layers can be automated easily into an action, leaving only the "small matter" of adjusting the opacity of the layers. I think this makes a much easier platform for exploring this technique than trying to guess ahead at the relative amounts of the USM applications.

--John Ruttenberg
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sun Dec 7, 2008 9:47 am (PST)

Stephen Marsh wrote:

* USM creates the edge difference by subtracting a blurred version of
the original image from the original - the resulting difference being
between the original and the blurred image. This region of difference
decides the areas that will be sharpened.

* High Pass is a [secret sauce] band pass filter, passing through
frequencies that are high, while discarding lower frequencies.

Okay, but both of these are effectively band-pass methods. The question is what the "secret sauce" is. It's possible that Photoshop's high-pass filter is closer to what we actually want than unsharp mask is.

* Subtracting a Gaussian blur from the original, normalised via a mid
gray offset superficially resembles the Photoshop High Pass filter,
however as you note it is not exactly the same,

You're right, it's not the same as a high-pass filter. It is however exactly the same as subtracting the original from an unsharp masked version.

(sometimes named Laplacian, although the Laplacian is more commonly
detected via a simple convolution kernel and not the more complex
Gaussian subtraction).

A Gaussian blur is just a simple convolution, so these would be the same operations.

* "Difference of
Gaussians" or "DoG" sharpening approach, which is less sensitive to
noise (independently of a threshold function).

This is basically the same idea as the threshold, though the implementation might be slightly different.

* These basic principles can be taken further with say Difference of
Median, or Difference of Gaussian to Median. It could be the
difference of Smart Blur, Surface Blur, Lens Blur with alpha or many
other softening methods.

As far as I know, median works on squares, resulting to some extent in square artifacts. I don't quite know what smart blur or lens blur do, technically, so I can't quite imagine what effect their various settings would have on an attempted sharpen. It would take understanding technically what these do before they could really be put to work.

As there are many
ways to blur or soften an image, one can sharpen with any of these
methods [...] some of these hybrid options are novel [... but they] are
still using the same basic principle that has been around for decades.

Sure. The question then is deciding what we actually want to do, when editing images; my suggestion is that we want to increase contrast using a radially-symmetric kernel which privileges fine detail but then falls off more slowly in its tail than a Gaussian function, and then we want to apply a curve to the resulting differences, so that we can chop out the effect on low- and high-contrast areas.

I think I can actually set something reasonably flexible up as a series of layers with adjustable opacities, and then a curves layer at the top of them, with the whole group set to linear light mode.

Some methods may use deconvolution restoration rather than sharpening
to achieve similar results.

Personally, I don't expect anything so fancy is needed. What we want is to give users control over contrast at different spatial frequencies, not necessarily to precisely counteract blur caused by a camera lens, though here I'm talking more about creative uses than salvaging horribly blurry original images; others likely have a different agenda.

Another approach that appears to be gaining some attention is wavelet
based sharpening.

This could be. I haven't ever seriously studied signal processing. I don't expect though that my first-order goals are un-meetable using Fourier-transformed data.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sun Dec 7, 2008 12:06 pm (PST)

Okay, here are some example images, so people have some idea what I'm talking about.

First, Dorothea Lange's classic "Migrant Mother":

<http: //www.hcs.harvard.edu/~jrus/colortheory/sharpening/mm-orig.jpg>

Then, the same, with unsharp mask applied about 6 or 8 times at different radii (I don't remember the precise settings), to improve local contrast:

<http: //www.hcs.harvard.edu/~jrus/colortheory/sharpening/mm-multiscale-sharpen.jpg>

This version has some unfortunate nasties, because the already high-contrast areas have been "over-sharpened", and also noise has been increased dramatically. So, we construct a layer which defines the difference between sharpened and unsharpened versions, and then apply a curve to it which damps small effects (to reduce noise), and also damps large effects (to avoid over-sharpening).

Interface screenshot:
http: //www.hcs.harvard.edu/~jrus/colortheory/sharpening/mm-curve-screenshot.png

Final image:
http: //www.hcs.harvard.edu/~jrus/colortheory/sharpening/mm-multiscale-curved.jpg

* * *

It's quite possible that my settings here are not ideal. But hopefully this helps others figure out the kinds of things I'm thinking about.

Cheers,
Jacob Rus
___________________________________________________________________________  

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Stephen Marsh
Thu Dec 11, 2008 5:36 am (PST)

In reply to:

http: //tech.groups.yahoo.com/group/colortheory/message/20710

Stephen Marsh wrote:
* USM creates the edge difference by subtracting a blurred version
of the original image from the original - the resulting difference
being between the original and the blurred image. This region of
difference decides the areas that will be sharpened.
* High Pass is a [secret sauce] band pass filter, passing through
frequencies that are high, while discarding lower frequencies. < <

Jacob Rus replied:
Okay, but both of these are effectively band-pass methods.

The difference between a sharp and soft version of the image is slightly less sensitive to noise than High Pass which contains the original high frequencies, which are then amplified and added to the original image via a contrast enhancing blending mode. Just as the difference between two Gaussian blurs is less sensitive to noise than is the difference between the original and a blurred copy. Just attempting to note the main theoretical differences, which may or may not mean much in final application.

Stephen Marsh wrote:
(sometimes named Laplacian, although the Laplacian is more
commonly detected via a simple convolution kernel and not the more
complex Gaussian subtraction).

Jacob Rus replied:
A Gaussian blur is just a simple convolution, so these would be the
same operations.

Ah yes, although the laplacian sharpen custom convolution kernel is much simpler (faster) than the Gaussian kernel, although as you say both are simple convolution operations.

The point I was making was that most would use a simple Laplacian kernel to find the Laplacian. However, there is an area in image processing known as Gaussian and Laplacian Pyramid processing. In this context, the Gaussian is used to create the Laplacian, instead of the simpler Laplacian kernel.

I don't have time to go into the rest of the message Jacob (it is much as above), I don't think that we are missing others main points although some of the small ones may be lost, however if a comment needs clarificaton, please ask.

Regards,

Stephen Marsh
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "John Ruttenberg"
Thu Dec 11, 2008 6:56 am (PST)

A copule of years ago I audited a Computational Photography course at MIT. The course notes (in the form of PowerPoint slides) are still online and quite a resource:

http: //groups.csail.mit.edu/graphics/classes/CompPhoto06/syllabus.shtml

They cover some relevant ground, particularly the image pyramid. I'm pretty sure the high pass filter is covered somewhere but haven't dug though the slides to find it.

I've already point Jacob at these slides, but Stephen's not makde me realize that someone else might be interested.

--John Ruttenberg
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Stephen Marsh
Thu Dec 11, 2008 4:22 pm (PST)

Thanks John, that reference will be handy for discussions on topics other than sharpening too.

Please keep such links coming (it beats paying for scientific journal downloads that are beyond my full understanding or ability to use).

Stephen Marsh
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Thu Dec 11, 2008 4:47 pm (PST)

I may have pasted this link in before, but I definitely recommend Dick Lyon's lectures to Google engineers about photographic technology, here: <http: //www.dicklyon.com/phototech/>

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Dan Margulis
Fri Dec 12, 2008 7:54 am (PST)

Jacob writes,

I thought I'd send along some thoughts about "sharpening", because I
hope that others either know where to look for improved tools or how
to bend Photoshop into a more useful form, or will perhaps have ideas
of their own in response to my rambling. Hopefully the length and
assumed experience here aren't too off-putting: improving local/edge
contrast of images is a large subject, which could probably fill a
book, so it takes a bit of explanation to get my thoughts across.

it's indeed a long and thought-provoking post. I agree with a lot of it. More practical alternatives exist for other parts. I encourage continued investigation, though. because sharpening is a stalking horse for other types of operations that depend on blurring, such as the overlay and multiply moves that pervade the picture-postcard workflow. Many of the problems are common to all three.

Figuring out a generalized sharpening method faces several obstacles.

*Unlike other areas of color correction, there isn't a general agreement on what looks good. By-the-numbers color correction is easy to analyze because certain moves appeal to everyone. A sharpen that's appealing to one person, however, may offend another.

*Also, unlike other areas, it's very difficult for us to evaluate what we've done. All sharpening depends on inserting halos or other artifacts and hoping that the viewer doesn't sense the artificiality. That we know for a fact that the halos are there, but our target audience does not, makes us overly sensitive to them, so we are biased observers.

*Sharpening is prone to more exceptions IMHO than any other area in color correction. One size does not fit all; everything depends on what's in the image and how far away the viewer who sees it will be. Some of these specific-image related issues are far from obvious--and sometimes the alternative method of sharpening is not obvious either. It's easy to sharpen an image pleasingly but hard to envision how it could have been done better.

*For all these reasons, testing ideas is extremely difficult. I've often been fooled by a series of misleading results, where as many as four or five trials suggest that a certain way is right or wrong, but the fifth or sixth try suggests the opposite. Also, a large number of alternatives need to be tested.

*The point of diminishing returns is easily reached. There are many credible sharpening methods out there. Any variation in quality between them is dwarfed by the impact of other corrections. In my class competitions sharpening only is decisive when a person omits conventional sharpening altogether or else uses *really* offensive settings.

*Better ways of sharpening often take more time than they're worth, and better algorithms eat computing time rapidly.

Unfortunately, the Gaussian distribution is *never actually* what we
want to use in "sharpening" an image. It can easily create garish
halos, because we want strong effects at tight edges, but also want to
take into account the contribution of medium-scale shapes. (The
unsharp mask tool has other problems, discussed below, but I'll focus
on this one for now.) So what happens is, either we split the
difference, picking a radius & amount which negotiates that trade/off
between sufficient edge contrast and unattractive side-effects,

Any form of sharpening is an artificial attempt to add focus. There is no such thing as too much focus but there is such a thing as looking artificial. Every sharpening method depends on introducing some form of artifact that hornswoggles the viewer into perceiving more crispness. Every method can be overdone to make the image look artificial, however the problem that each method produces would be different. To say that because Gblur-based sharpening can produce nasty diffuse halos, another way has to be better, is to say that because Clinton couldn't keep his pants on in the Oval Office, Bush is the better president.

Dan oddly names our
increase of local contrast at different scales by two different
names, respectively "hiraloam sharpening" & "conventional
sharpening", which is unfortunate for three reasons: (a) neither name
gives much indication of what is being attempted;

Technical discussion of how things work is generally useful and appreciated. Quibbling about what terms should be used to describe what, particularly when the terms are well established and understood, is generally a waste of time and also tends to descend into holier-than-thou fairly quickly.

(b) the distinction
between the two is completely artificial, as they simply operate at
different scales,

The two operations have major differences and should not be considered as two sides of the same coin.

*One depends on its artifacts (halos) being visible, but mistaken by the viewer as being something else; the other depends on not having the halos visible.

*Noise avoidance is a major concern in one and not the other.

*One fails when the Radius is too large, making the halos clunky; the other fails when the Amount is too large, making them visible.

*Color shifts are undesirable in one and usually desirable in the other.

That these should be considered as two separate forms is confirmed by the inability to split the difference between them. Conventional sharpening is obviously useful, otherwise it would never have become conventional. Hiraloam, where the Radius is around 25 times as high as in conventional, has also clearly demonstrated its use. Plus, at various times I've shown effective sharpening with an *ultra*-high Radius--75 or 100 times wider than conventional. But medium-Radius sharpening (Radius of maybe 5 times higher than conventional) has no beneficial effect AFAIK.

(c) it implies
that the additive combination of two Gaussian distributions is the
proper shape for enhancing local contrast,

It implies nothing of the sort.

Okay, so when we apply unsharp mask to an image, what we're trying to
do is bring out (i.e. make visually distinct and interesting)
features: shape details, textures, and so forth. These features have
different sizes, and contrast to different degrees. Humans generally
find images with more distinct features at every perceivable scale to
be the most interesting.

Not in faces, not in skies, not in flowers, not in butterflies. It's a slippery slope that the last sentence can start you down.

If we use a Gaussian function for weighting our sharpen, we can
increase the contrast in one such distance range, but instead of
making razor-sharp-looking edges, we actually make somewhat wide
edges, with definite halos with their own distinct shapes. This is
because the Gaussian function has horizontal slope at 0, and then a
"bell top" region of significant effect between 0 and 1 standard
deviations from 0, and then very quickly falls off towards zero from
there, and by 3 standard deviations has almost no effect whatsoever.
Okay, so what happens is our pixel moves away in value from other
pixels which lie at particular distances--mostly between 0 and 2
standard deviations. This has the effect of especially heightening
any details which are overall 1 or 2 standard deviations in size.
Anything bigger will have its edge contrast increased with a halo
extending about 1 or 2 standard deviations away from the edge, and
anything smaller will be effectively un-enhanced.

Right. That's why the choice of Radius is so important.

Because we want to highlight delicate details as well, and avoid
halos, we want to instead use a weighting function which immediately
starts decreasing at 0 (unlike the horizontal slope at 0 of the
Gaussian function), and which does not go to zero quite so fast as we
get away from 0. Perhaps some function which looks like `y = e^(-x)`.
To construct such a function out of the unsharp mask tool involves
its repeated application. We need to carefully eyeball the image
after each step, and try to make sure that we overdo our sharpen by
about the same relative amount each time, so that when we then cut
global opacity on our newly-sharpened copy of our image, we'll end up
with various distance ranges sharpened appropriately. This takes
practice to learn, and time and finesse to perform; it's tedious and
easy to screw up. Overall, we'd really prefer to just use a better
tool. Still though, it's usually worth running unsharp mask at least
four or five times, if not more, because the improvements to images
are quite dramatic, and the result is significantly better than only
one or two applications of the tool can accomplish.

What do we want instead?

Now you've reached the point of no return. You've identified the problem. There are two fundamental ways of proceeding. The elegant way is with a new algorithm that is designed to evade the problem (but is likely to introduce others in its stead.) The blunderbuss method is to apply damage control: if you find the halos too obtrusive, figure out a sneaky way to defeat them.

My suggestion is that the second way, while perhaps less intellectual appealing, is more practical. An example of inelegant, yet effective, planning: add to the current dialog a slider that says "Exclude Blues/Cyans". Why? Because serious problems with hiraloam sharpening, while they can occur anywhere, *most often* occur in skies, which don't have much noise to disguise a large halo. And in conventional sharpening, bringing out noise in skies is itself a serious problem. It's asymmetrical and illogical, but probably this single slider would add more quality to more people's work than a new sharpening algorithm.

The biggest need by far in any improvement to the sharpening routine is independent computation of the lightening and darkening artifacts, because usually the lightening is much more offensive than the darkening. I teach a workaround that is fairly quick (sharpen on a duplicate layer, then apply bottom layer, Darken mode, opacity 50%) but this only lessens the relative Amount of the lightening, whereas one would want to reduce the Radius as well. Doing this at present is ridiculously time-consuming.

In 2004, I wrote a column called "Life on the Edge" in which I showed how to sharpen an image using Gaussian blur only, plus some blend modes. My method took 23 steps and was intended as a joke. Nevertheless, a surprising number of people took it seriously and some actually started sharpening images that way. The suspicion has to be that, in addition to having a lot of time on their hands, these people saw the merits of computing light and dark halos independently, which the 23-step monstrosity did.

I think it is also now clear that we need a way to limit sharpening in saturated areas, although the blue/cyan problem is so severe that it warrants its own set of sliders.

But really, Gaussian sharpening as it exists in the unsharp mask tool is
designed for 80s hardware & unsophisticated users, and I am astounded
that it has not been improved in 20 years of Photoshop ("smart
sharpen" is some kind of tragic ironic joke).

True. 1980s scanners had independent control of light and dark sharpening, and to that extent were better than Photoshop. They did not, however, have the Threshold, which AFAIK was a Photoshop innovation, and a good one. When I started using Photoshop in the early 1990s, unsharp mask required SERIOUS computing time--on my office Macintoshes, which were state-of-the-art at the time, running USM on a decent-sized image could take 10-15 minutes. Under those circumstances, the Photoshop implementation has to be seen as a good one.

What was adequate in 1992, however, was obsolete by 1996, and it hasn't been improved since, For a tool of such fundamental importance, this is indeed stunning. Everybody comes up with multi- step workarounds to make up for the inadequacy of the filter itself. That Smart Sharpen was seriously offered as a substitute, plus the incorporation of somebody else's hiraloam routine as Clarity in ACR, suggests that whatever you come up with will have to work independently, as the Photoshop engineers will not be able to help you.

What would I prefer? Well, first and most simply, I don't understand
why Gaussian blur and unsharp mask need to be separate tools,

USM contains a Threshold that is inappropriate for Gblur.

or why "sharpen", "sharpen more", "sharpen edges", "blur", or "blur more"
even exist (they're utterly pointless).

Because some people are used to them, and as the Photoshop engineering team has no vendetta against those who employ them, it does not threaten to delete them.

Gaussian blur is exactly the
unsharp mask tool, where "amount" has been set to -100%, and threshold
has been set to 0. I also can't really imagine uses for "box blur",
"shape blur", "radial blur", but I can see that someone might imagine
such a use; all three are nonetheless extremely simplistic, and radial
blur in particular could be fairly easily beefed up for sophisticated
users without sacrificing comprehensibility for novices.

Give the matter some more thought.

As you noted, while a blur of some kind is probably necessary, there's no requirement that it be of the Gaussian persuasion. Any of the blurs above will also serve to sharpen the image but the artifacting structure would be different. Smart Sharpen has different blurs preloaded if one wants to experiment.

Suppose we sharpen an image hiraloam as usual with Gblur methodology, but also sharpen a second image, trying to mimic the radius effect, using a different blur. To make sure we don't lose any opportunity, these are good, stiff sharpens, more than we would like. If we then blend the two 50-50, place the result on a layer on top of the original, and reduce opacity to taste, the result will be better than by using either parent. It happens because while both methods add certain positive effects, their negative effects largely cancel one another. The unpleasant soft Gblur halos that you complain about are reduced.

Of course, if we make the split not between two different blurs but four, the effect gets better. Plus, we can add various kinds of interference, or operate at different geometry, prior to a Gblur to make the result less predictable.

Do I know which types of alternate blur work best, or what kind of ratio should be? No, although I've had good results from mixing Motion blurs at different angles. Do I have any plans to comprehensively investigate the matter? No. But I do know that the concept works. Obvious halos can be sharply reduced while retaining perceived sharpening. It will, however, take somebody a whole lot of testing to find the optimal default method because not only would one need to find a way to make Radii correspond and pick proper ratios, but some types of blurring should be done in the equlvalent of Darken or Lighten mode.

What I'd like to see in an ideal world is a tool which provides
something like a curve of some sort, with radius (probably in
logarithmic scale) along the horizontal axis, and amount (maybe also
logarithmically) along the vertical axis. I'd be able to adjust the
amount of effect at every scale by drawing a curve in a box, and in a
single interface with a real-time preview perform what now takes
infinite (or to quite roughly approximate, at least 5 or 6)
invocations of the current unsharp mask tool. This would have several
benefits: it would let us sharpen different scales using a single
tool, and would take a lot of the guess-work out of the process.

This mistakes sophistication for damage control. First, the above presumably applies only to hiraloam sharpening, as in conventional the halos are too small for a difference to be noticeable. In both conventional and hiraloam, there's an optimal range for each image--a cascade of different Radii is often counterproductive. For example, in good hiraloam sharpening of a face, we add shape and depth. If the Radius is too low, the subject gets bags under the eyes. And if it's too high, the whole face lightens or darkens as a unit. Doing multiple sharpens masks objectionable halos, for sure. But there's a price: it also masks some of the positive effects of choosing the right Radius. Better IMHO to do multiple types of blur at approximately the same Radius and merge them, as discussed above.

Here's where I'm hoping for some advice from the list. I still need
to experiment, but I've been having trouble constructing actions to
make manifest my desires for a sharpening tool. If I want to counter
effects at different lightness levels, in different difference ranges,
and so forth, I need to get really creative, with, for instance,
putting curves on specially-constructed high-pass filter layers (I am
not precisely sure what Photoshop's high-pass filter does--I should do
some more experiments, but if anyone knows the technical details I'd
be obliged),

Gernot Hoffmann has an excellent paper on Gaussian functionality,
including a good discussion of high and low pass, at

http://www.fho-emden.de/~hoffmann/gauss25092001.pdf

Unsharp mask also simply multiplies the value difference between
adjacent shapes, in a linear way, and then has a single lower-bound
cut-off point (called "threshold"), which prevents noise, and mostly
this means color noise in RGB images, and especially in the R & B
channels (not to suggest that Fats Domino or Ray Charles just makes
noise!!), from being amplified, when overall there is not so much
difference between pixels. First, the operation of this cut-off is
quite arbitrary from the perspective of what the user needs it for,
and indeed is mostly only needed because unsharp mask computation is
performed in a brain-dead color space like RGB or CMYK, where such
disproportionate color noise can "infect" channels which also
contribute to overall value/lightness.

It's needed in LAB, too. There's plenty of non-color noise in this world.

It's correct that sharpening the L is technically better than sharpening RGB in Luminosity mode, for the reasons stated above: sharpening color noise can change luminosity in RGB, but not when the L channel is sharpened. However, the effect is tiny. I did a whole lot of testing of this and found that in many cases if we looked at individual channels at 400% magnification we could see how the L sharpening was better. But not, of course, in a composite image at 100%. Much of the colored noise is in the blue, whose impact on luminosity is next to nil.

I recommend that people sharpen in LAB if they are already there anyway. I'd be perfectly happy to say that every file should be converted to LAB one way or another to take advantage of the better sharpening. The results, however, don't justify such a recommendation.

The Threshold field is another example of something that was state-of-the-art in 1995 and leaves a lot to be desired today. Now, we could put intelligence into it to make its decisions as to what is noise and what detail more accurate.

But more importantly, this
linear effect is bad because it undesirably excessively accentuates
already strikingly contrasting shapes. That is, because the
multiplication of contrast is linear, two strongly contrasting regions
are spread apart with *even more* distinction than two less
contrasting regions.

An excellent point. This explains why double-conventional sharpening is usually a bad idea and there are plenty of other images where it gets in the way, also. So, what may be needed is a reverse threshold: something that places a limit as to how big a move will be tolerated.

A truly sophisticated tool
would provide some kind of curve or set of sliders for determining the
shape of the fall-off at both low and high ends, so that a more
accurate low-bound "threshold" could be determined, and also so that
the effect could be reduced or eliminated (or perhaps sometimes even
reversed) for very high contrast shapes.

Correct, although the problem is so much more severe at the dark end that it probably deserves a more sophisticated tool. So let's add these to what's been discussed already and sum up by envisioning a filter that answers as many of the points as possible, even in a crude way. To avoid total chaos we will forget the possibility of doing a conventional and a hiraloam sharpen in the same dialog. What we have is:

1) The light and dark haloing are computed independently, both as to Amount and Radius.

2) Each side (light and dark) is a weighted average of four different blur methods at approximately the same radius.

3) The Threshold routine is updated to try to recognize noise as opposed to actual detail.

4) A counter-Threshold permits us to limit the amount of sharpening of very high-contrast edges.

5) Shadow and highlight limiters as described above.

6) In addition, an Avoid Shadow Noise slider.

7) An Avoid Blues/Cyans slider.

8) A separate Avoid Saturated Colors slider.

All these are worthy attributes to have available, and all could be made more complex. But suppose that we hypothetically throw it into Photoshop CS5 in the above "simple" form?

Even granting that computers will be faster by that time, apply this filter to a 100mb file and we'll have time to step out for a beer while it runs.

I think there's considerable remaining space for experimentation, both
within Photoshop and without, first for the creation of algorithms
which sharpen the image as we would like, and second for novel user
interfaces for controlling their parameters. Even in the absence of
new tools, I imagine that some of Photoshop's tools are hackable to
give us some of what we want. At some point, I'll try to do some more
careful and exhaustive experimentation. If others on this list have
pointers though, or really any kind of responses, I'd be much obliged.

Better sharpening tools call for individual initiative, which it sounds like you have. While I am interested in the field and know how I would proceed if I were going to develop stuff myself, I am not planning to invest significant time in it. Last year we nevertheless made some progress. I pointed out that there seems to be a strong argument for reducing conventional sharpening in colorful areas. I suggested sharpening through a mask based on a hypothetical black channel. Iliah Borg wrote an Action to do it that has become quite popular. If we can get more stuff like that out of your investigations, it would benefit everybody. Thanks for the very detailed post.

Dan Margulis
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Michael Jahn
Fri Dec 12, 2008 10:01 am (PST)

Hi Dan,

you wrote;

" think it is also now clear that we need a way to limit sharpening
in saturated areas, although the blue/cyan problem is so severe that
it warrants its own set of sliders."

I absolutely agree - and would like to add that I cheat in a slightly different way sometimes..

I create layers and erase areas that I want no sharpening then sharpen that and create multiple layers (using masks) if i need different amounts of sharpening on different areas of the image - I am sure you already thought of that, but just in case others have not...thought I would share...

oh, and on Thereshold - I sometime get questions from people wanting to scan a document that they want to re-print - they try scanning in 1 bit mode and can't find the sweet spot (sometimes this is complicated when they scan a page of a book while the page is still in a book) - I tell them to never use the Threshold - if ONLY adobe would put TWO points *sigh* in that tool, that would help !

I always tell users to use Levels instead - they can then get the areas they want as white cleaned up, while making the slightly lighter black type and the 100% black areas of the same...

For software developers in that "paper to PDF" market, this is all done via auto-image anaylysis and image processing (no one wants to work on a 900 page book one page at a time) - but of course, there is always Photoshop Actions - I share this as there are of course instance where one approach can be applied to large amounts of files that have a similar problem.

Always learning here, thanks for your thoughts, as always.

--
Michael Jahn
Jahn & Associates
PDF Color Conversion Specialist
1824 North Garvin Avenue
Simi Valley
California 93065
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: George Machen
Fri Dec 12, 2008 10:01 am (PST)

I think that much of the problem in real-life images with USM's Threshold might be mitigated if the slider could be split (like Option/Alt-dragging the sliders in Blend-if), to "feather" the transition point. This visible abruptness where sharpening begins in many images was Bruce Fraser's chief complaint about Threshold. Right now, about the only workaround on images where the problem is visible is to do otherwise same USM on two layers with different Thresholds, then adjust Opacity to taste.

As to a future Threshold distinguishing noise from detail, I can only envision the underlying algorithm employing something along the lines of Dan's 1.0 gamma Surface Blur, as described in PP5E, chpt. 15, for the Fig. 15.2 image. In 1.0 gamma, the shadow noise preferentially would get blurred, leaving much of the detail in the lighter ranges relatively untouched. This is because there would be more distance between the same levels in the shadows than elsewhere, and a higher Threshold setting could be used with somewhat greater impunity.

- George Machen
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Fri Dec 12, 2008 3:34 pm (PST)

Dan Margulis wrote:

[...] sharpening is a stalking horse for other types of operations [...]

Agreed. And thinking about it has somewhat changed/focused my conception of photography more generally.

Figuring out a generalized sharpening method faces several obstacles.

*Unlike other areas of color correction, there isn't a general
agreement on what looks good. By-the-numbers color correction is easy
to analyze because certain moves appeal to everyone. A sharpen that's
appealing to one person, however, may offend another.

Every choice to expand or shift contrast one place involves a trade-off in contrast somewhere else. So yes, there will be no general agreement: it depends on particular aesthetic judgement and intent.

However, I have a hunch that the same intended effect to most current sharpening can be achieved without many of the undesirable side-effects, and that given an easy choice, many current practices would be seen as inartful or even unacceptable.

*Also, unlike other areas, it's very difficult for us to evaluate
what we've done. All sharpening depends on inserting halos or other
artifacts and hoping that the viewer doesn't sense the artificiality.
That we know for a fact that the halos are there, but our target
audience does not, makes us overly sensitive to them, so we are
biased observers.

I expect it is possible to in many cases have the best of both worlds, where even sophisticated viewers, unless they think specifically/intellectually about it while peering closely, will be "fooled" about the image, without sacrificing impact. But my hunch about this will need explicit demonstration. Either way, since I mostly make photographs for myself, and care about my own enjoyment of them more than how they appear to an arbitrary viewer, I'm happy to evaluate photographs based on my personal judgment.

It's easy to sharpen an image pleasingly but hard to envision how it
could have been done better.

Hmm. This sort of statement implies a lack of scientific understanding of the phenomenon involved. Hopefully through study, this mismatch can be reduced.

*For all these reasons, testing ideas is extremely difficult. I've
often been fooled by a series of misleading results, where as many as
four or five trials suggest that a certain way is right or wrong, but
the fifth or sixth try suggests the opposite. Also, a large number of
alternatives need to be tested.

I think the main problem is that the tools make testing various alternatives tedious. If it were easier to move parameters around in real time in some algorithm which took into account the need for differing treatments at different scales, different color ranges, and different amounts of contrast, and see the result live on the image, much better choices for each image could be found than are currently settled for.

The more I think about this, the more I am convinced that I can build myself a set of tools within Photoshop which get much closer than anything otherwise available to what I want.

*The point of diminishing returns is easily reached. There are many
credible sharpening methods out there. Any variation in quality
between them is dwarfed by the impact of other corrections.

I guess correcting an awful cast, or similar, can make an image "wrong" from the perspective of most viewers. But I think that creative control of local contrast makes a quite substantial difference.

Any form of sharpening is an artificial attempt to add focus. [...]
To say that because Gblur-based sharpening can produce
nasty diffuse halos, another way has to be better, is to say that
because Clinton couldn't keep his pants on in the Oval Office, Bush
is the better president.

Poetic levity is to be encouraged, but I don't think this is right. In my (admittedly limited) testing, shapes which lack the Gaussian function's characteristic "shoulder" work better pretty much all the time. But even so, the problem is that this cannot be easily adjusted by users, not that it's a possibility: I see no problem with letting users make Gaussian halos if that is their desire. It's the difficulty involved in doing anything *else* that's the problem for me.

Quibbling about what terms should be used [...] is
generally a waste of time [...]

Consider my quibbles retracted. :-) I think the current terminology is too limited to express some of the things I want to express, but that's not the words' fault.

The two operations [sharpening at small scale and medium scale]
have major differences and should not be considered
as two sides of the same coin.

*One depends on its artifacts (halos) being visible, but mistaken by
the viewer as being something else; the other depends on not having
the halos visible.

I don't mean to seem overly pedantic here, but both depend on their artifacts (i.e. altered local contrast) being *visible*, and suffer when that visibility pushes toward an "un-natural" look.

*Noise avoidance is a major concern in one and not the other.

I think there's relatively more concern for what would commonly be called "noise" in one than the other, but I think both can benefit from limiting effect in low- and high-contrast areas.

*One fails when the Radius is too large, making the halos clunky;
the other fails when the Amount is too large, making them visible.

I think both fail when the "halos" have a "clunky" shoulder to them.

But medium-Radius
sharpening (Radius of maybe 5 times higher than conventional) has no
beneficial effect AFAIK.

I disagree. I'll try to demonstrate my thoughts better by example in the coming weeks.

There are two fundamental ways of proceeding. The elegant way
is with a new algorithm that is designed to evade the problem (but is
likely to introduce others in its stead.) The blunderbuss method is
to apply damage control: if you find the halos too obtrusive, figure
out a sneaky way to defeat them.

Hmm. The mathematician's way is to describe something as a "sneaky trick" the first time it works, and then once it's been generalized and explained, call it a "technique".

or why
"sharpen", "sharpen more", "sharpen edges", "blur", or "blur more"
even exist (they're utterly pointless).

Because some people are used to them, and as the Photoshop
engineering team has no vendetta against those who employ them, it
does not threaten to delete them.

Maybe so. I guess it's just a design choice I'd make differently if it were my product: I'd prefer to ship "actions" with specific settings dialed into tools, instead of taking entire new menu items. Similarly for "Auto color", etc.

Suppose we sharpen an image hiraloam as usual with Gblur methodology,
but also sharpen a second image, trying to mimic the radius effect,
using a different blur. To make sure we don't lose any opportunity,
these are good, stiff sharpens, more than we would like. If we then
blend the two 50-50, place the result on a layer on top of the
original, and reduce opacity to taste, the result will be better than
by using either parent. It happens because while both methods add
certain positive effects, their negative effects largely cancel one
another. The unpleasant soft Gblur halos that you complain about are
reduced.

Of course, if we make the split not between two different blurs but
four, the effect gets better. Plus, we can add various kinds of
interference, or operate at different geometry, prior to a Gblur to
make the result less predictable.

I'm very skeptical of this.

In both
conventional and hiraloam, there's an optimal range for each image--a
cascade of different Radii is often counterproductive.

This contradicts my experience, but I would like to explore further.

But there's a
price: it also masks some of the positive effects of choosing the
right Radius.

I think framing this as a "choice of the right radius" is fundamentally limiting the creative possibilities.

Gernot Hoffmann has an excellent paper on Gaussian functionality,
including a good discussion of high and low pass, at

http://www.fho-emden.de/~hoffmann/gauss25092001.pdf

Thanks for the link. It doesn't describe what Photoshop's specific high pass tool does, but is otherwise quite an nice explanation of Gaussian blurring/sharpening.

But more importantly, this
linear effect is bad because it undesirably excessively accentuates
already strikingly contrasting shapes. That is, because the
multiplication of contrast is linear, two strongly contrasting regions
are spread apart with *even more* distinction than two less
contrasting regions.

An excellent point. This explains why double-conventional sharpening
is usually a bad idea and there are plenty of other images where it
gets in the way, also. So, what may be needed is a reverse threshold:
something that places a limit as to how big a move will be tolerated.

Yes, I think this is definitely needed. In my testing, it makes for dramatic improvements.

1) The light and dark haloing are computed independently, both as to
Amount and Radius.

2) Each side (light and dark) is a weighted average of four different
blur methods at approximately the same radius.

3) The Threshold routine is updated to try to recognize noise as
opposed to actual detail.

4) A counter-Threshold permits us to limit the amount of sharpening
of very high-contrast edges.

5) Shadow and highlight limiters as described above.

6) In addition, an Avoid Shadow Noise slider.

7) An Avoid Blues/Cyans slider.

8) A separate Avoid Saturated Colors slider.

All these are worthy attributes to have available, and all could be
made more complex. But suppose that we hypothetically throw it into
Photoshop CS5 in the above "simple" form?

Even granting that computers will be faster by that time, apply this
filter to a 100mb file and we'll have time to step out for a beer
while it runs.

I don't personally want to see (2) as such, and (3) as you're describing is some sort of complicated adaptive algorithm. The rest of these though can be very quickly computed, because beyond the initial Gaussian convolution step they can be done for each pixel independently of the rest of the pixels in the image.

* * *

Thank you for the detailed responses: it's exactly the sort of thing I was hoping for when writing to the list.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Ric Cohn"
Sun Dec 14, 2008 5:03 pm (PST)

I've found this discussion of Sharpening introduced by Jacob very interesting.

One observation:

On Dec 12, 2008, at 10:49 AM, Dan Margulis wrote:

But medium-Radius
sharpening (Radius of maybe 5 times higher than conventional) has no
beneficial effect AFAIK.

I actually find the 5 to 8 pixel radius useful along with less than conventional radius sharpening on images destined for the web (say 500 to 600 pixels on the long end). I have an Action for my website images that includes two rounds of Unsharp Mask.

I frequently find pleasing a round at this mid-radius followed by a sharpening at less than 1 pixel radius with the addition of Blend-If to keep sharpening out of the extreme's.

Keep in mind that this is for a resizing and resharpening of print sized images (usually about 11"x14" @ 300dpi).

Ric Cohn
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Sun Dec 14, 2008 8:17 pm (PST)

George Machen wrote:
I think that much of the problem in real-life images
with USM's Threshold might be mitigated if the
slider could be split (like Option/Alt-dragging
the sliders in Blend-if), to "feather" the transition
point. [...] Right now, about the
only workaround on images where the problem is
visible is to do otherwise same USM on two layers
with different Thresholds, then adjust Opacity to taste.

I have what I think is a better alternative, but it requires creating a few layers via action. I'll try to describe it fully, complete w/ diagrams, etc., as soon as I get the chance.

But briefly, the idea is that, when used as part of a layer set in linear light mode, an exclusion mode layer (does anyone ever use exclusion mode for anything?) can be used as a sort of mask: anything black will be left as the layer below, and anything middle gray will be turned middle gray, effectively neutralizing its effect because the whole set is in linear light mode. So we can set a layer with whatever content we like to exclusion mode in our overall linear light set, and then add a clipped curves adjustment layer on top, set initially to a flat curve black all the way across. Then we can drag that curve towards middle gray for any areas we want to reduce the original effect, or even beyond, if we want to reverse it. In this way, the sharpening effect can be reduced at particular levels of contrast (make the exclusion layer just the same as the sharpening mask), or at particular lightness levels (make the exclusion layer the grayscale image content), or in, for instance, the colorful blues (per Dan's request, by making the exclusion layer the b* channel), etc.

This unfortunately does not work in CIELAB mode, as Adobe has arbitrarily eliminated the difference & exclusion blend modes for that color mode (this is a real tragedy, I think--previously I had no use for exclusion mode, but I'm beginning to think it's one of the most useful blend modes). So it takes doing the sharpening in grayscale in a separate document or smart object. [digression: It would be neat if Adobe built in a way to add "custom" blend modes, defined by simple arithmetic on the pixel values of source and target values]

The above explanation is almost certainly too condensed to make much sense (it doesn't make sense to me and I wrote it!); I'll try to explain fully as soon as I get the chance.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "merlot3000"
Tue Dec 16, 2008 8:01 am (PST)

Not too poo poo the discussion, but where is the practical and commercial value in all of this? I usually find that Dan's standard move of USM in LAB on the luminosity layer does it and in fact has to be toned down (using apply image in darkness mode).

David Barrack
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Michael Jahn
Tue Dec 16, 2008 12:22 pm (PST)

Hi David,

That is a perfectly fair question !

Photoshop sometimes is the actual tool that is used and sometimes it is used to prototype or test approaches, even entire products.

In the world of imaging (face recognition, license plate image enhancement, satellite and arial photography, document scan, microfiche recovery) - well, there are all sorts of very practical and marketable commecial uses.

As I am sure everyone knows - Photoshop is just not for wedding photographers and weekend shooters - you would be amazed what people are doung with CUDA and Nvidia -
http: //www.nvidia.com/object/photoshop_dds_plugins.html

Some of us get asked to do all sorts of crazy things with our customers...

http: //michaelejahn.blogspot.com/2008/05/i-was-at-us-department-of-state-in-our.html

--
Michael Jahn
Jahn & Associates
PDF Color Conversion Specialist
1824 North Garvin Avenue
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Jacob Rus
Tue Dec 16, 2008 5:43 pm (PST)

David Barrack
Not too poo poo the discussion, but where is the practical and
commercial value in all of this? I usually find that Dan's standard
move of USM in LAB on the luminosity layer does it and in fact has to
be toned down (using apply image in darkness mode).

The practical use (I don't particularly worry about commercial use since I'm dealing with my own images for myself or as gifts, etc., but I imagine that quality has commercial value), is that I can do more extensive sharpening (i.e. make things look sharper) than "USM in LAB on the luminosity layer", while at the same time avoiding halos or other undesirable artifacts. In the end, the final product better matches my artistic intent. But my current method is tedious and involves some amount of guesswork, so I've been trying to figure out ways to automate and simplify.

Quick summary of my original email's gripes w/ gaussian sharpening (essentially gripes with the technique you describe, except without the darken mode bit):

* gaussian function is not ideal for sharpening as it creates very noticeable halos while also not sharpening details in some scale ranges we care about
* no way to distinguish lightening from darkening changes
* no way to have effect depend on average lightness at a particular spot
* threshold is too simplistic as only a cut-off
* no high-end cut-off or fall-off -- the effect is excessive in already high-contrast areas.

The method you describe deals with the second of these points only. I contend that the other four also negatively impact the quality of sharpening achieved.

Cheers,
Jacob Rus
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "merlot3000"
Tue Dec 16, 2008 5:43 pm (PST)

Hi Michael,

I can understand and appreciate that. I was just under the impression that this group was primarily focused on the use of PS for correcting and improving photographic imagery but not including graphic arts and such.

As you mention, PS is not just for wedding shooters, etc. which highlights some of the previous discussion about Lightroom which is much better in general when volume is a challenge.

david barrack
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: George Machen
Thu Dec 18, 2008 12:13 pm (PST)

Here is a nice tutorial with which one can follow along oneself in Photoshop, that may assist in getting one's head around some of the issues raised in this thread:
http://tinyurl.com/48lv2t

By the way, there are a lot of other useful tutorials on this site:
http://tinyurl.com/43vuqy

More:
http://tinyurl.com/358sgw
(Click on the little blue triangle in each of the five section headings to see the full list of tutorials for that section.)

- George Machen
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Stephen Marsh
Thu Dec 18, 2008 3:14 pm (PST)

What I presume David is commenting on here, is that for all the talk of various sharpening options and tricks - when it comes to ink hitting the paper many of these sharpening subtleties may be lost and one method may look very much like another (this is obviously image and printer dependent, not to mention highly variable with different observers).

So when discussing sharpening, what sharpening are we talking of?

* A subtle sharpen before/after resampling a large image down in pixel size (or would a blur before resampling down, then a sharpen suit some other content better)?

* A subtle acquisition/capture sharpen to account for scanning or photography? How will this affect later sharpening, if applied?

* Creative sharpening of some description?

* Sharpening for print output (stochastic, halftone etc.)?

Sincerely,

Stephen Marsh
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "John Ruttenberg"
Fri Dec 19, 2008 7:41 am (PST)

Stephen Marsh:

What I presume David is commenting on here, is that for all the talk
of various sharpening options and tricks - when it comes to ink
hitting the paper many of these sharpening subtleties may be lost and
one method may look very much like another (this is obviously image
and printer dependent, not to mention highly variable with different
observers).
 
I see Jacob's ideas pointing in the direction of easier, more effective sharpening. I don't mean that ultimately it will result in a better looking print for any given image than an expert, say Dan, could do with a few minutes work. I mean that a photoshop could develop a real *smart* sharpen which would do a good job with some sort of default settings more than 99% of the time and which would allow further tuning for creative purposes.

As things stand, it's really easy to over/under sharpen because:

1. The risk of visible halos, especially from HIRALOAM sharpening is very real, and

2. Fear of 1. may well limit the amount of sharpening one does, thus limiting its effectiveness.

3. Worries about the output size of the image make one revisit the sharpening decisions for each separate use of the image.

The holy grail that I see behind Jacob's thoughts is a one-size-fits-all sharpening process, something that is effective no matter what the output size and no matter what kinds of detail the image has.

--John Ruttenberg
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Cathryn McLeod"
Sat Dec 20, 2008 5:02 am (PST)

Dear John,

While I've appreciated all the mathematical conversation on the subject of sharpening, I haven't seen mention of what generates such need for it in the first place. Does a well-lit photo take care of the whole thing? Maybe I missed a fundamental.

Cathryn McLeod
Asheville, NC
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Francis Corvin"
Sat Dec 20, 2008 9:56 am (PST)

Cathryn,

The summary in this post
(http: //tech.groups.yahoo.com/group/colortheory/message/20747) may be of help, although it is not illustrated with a picture.

Francis Corvin
___________________________________________________________________________ .

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Michael Demyan"
Sat Dec 20, 2008 9:56 am (PST)

When referring to digital camera capture - the image is focused on a chip that does not capture each photon in its visible color. Instead it has to capture distinct portions of each color R, G, B, on separate photosites. The computer in the camera then reassembles the individual color photosites into a "full color" image. Therefore the image is not as "sharp" (loosely defined) as it would be if captured on fine grain large format film. Film scanners are similar.

The resulting image is therefore somewhat diffuse or blurred. Digital sharpening enhances the visual appearance of the image to make it look "sharper".

If you use a large format digital back with a top grade lens then maybe you will not need to "sharpen" your image.

As a photographer - the final rendering if the image is in the eye of the artist. The need for "sharpening" is your decision. Some people prefer more diffuse images, others need to see every pore in a face. You decide.

Mike Demyan
www.mikedemyan.com
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Michael Jahn
Sat Dec 20, 2008 1:28 pm (PST)

Hi Cathryn,

Well, in a word, no.

Even a well-lit photo - and EVEN with film - that is - even studio captures of pots and pans for the JCPenneys catalog - well, when they are printed on paper, they are converted to small little halftone dots
- as this process creates a small amount of 'blur' visually - (never mind if there is a small amount of miss-registration, slur - or some other printing press related issue) - well, the images need a little 'help'.

The 'unsharp masking" trick has been around LONG before adobe photoshop - the amount was actually applied (during my drum scanner operator days, back when I still had hair) by actually switching out apertures (there literally were small physical things we would remove and insert to change how much we need to enlarge)

http://www.answers.com/topic/drum-scanner

now, introduce something like a Bayer filter array (that CCD chip in your digital camera) - and you need even MORE help (via image processing) to correct for the inherting problem of capturing detail)

http://en.wikipedia.org/wiki/Bayer_filter

hope that helps you better understand why even if you do not thing USM is being applied, it already has been when you capture a picture with a digital camera !

--
Michael Jahn
Jahn & Associates
PDF Color Conversion Specialist
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "merlot3000"
Sat Dec 20, 2008 1:28 pm (PST)

About 1/3 of the time when I shoot there is little sharpening needed and when running one of the variations of USM not a lot of change will appear. This of course takes decent conditions. Shooting with pro glass and a full frame camera helps.

david barrack
___________________________________________________________________________

The reverse threshold method (was proper "sharpening" at all scales)
Posted by: Dan Margulis
Sun Dec 21, 2008 4:52 am (PST)

John Ruttenberg writes,

I see Jacob's ideas pointing in the direction of easier, more effective
sharpening. I don't mean that ultimately it will result in a better looking
print for any given image than an expert, say Dan, could do with a few minutes
work. I mean that a photoshop could develop a real *smart* sharpen which
would do a good job with some sort of default settings more than 99% of the
time and which would allow further tuning for creative purposes.

Let me throw out an idea that I've used for specific purposes but, in light of this thread, I realize might be more generally applicable. I've tried it out today on some images and think that in a certain number of situations it makes a difference for the better that's more than just academic. Not, to be sure, an enormous difference, and it's extra steps. Maybe somebody will expand upon it and make it even better. I think this only applies to conventional (low-Radius) sharpening but it's conceivable that hiraloam might be impacted as well. In this post, I'm assuming conventional only.

Sharpening identifies transition areas (usually called "edges") and forces them apart by lightening the light edge and darkening the darker one. In Photoshop's algorithm, the further apart the two are originally, the more violent the move.

As pointed out by Jacob, this can sometimes be a drawback. There are edges, and then there are edges. The picture I'm looking at now is one of boats in a harbor, similar to one that I illustrate conventional sharpening with in PP5E. The masts and supporting wires are strongly defined against background water. mountains, and clouds. These are big-time edges, and applying the USM filter will greatly enhance them.

OTOH, sharpening is also beneficial where there's not so much an edge as a *texture*, as in the water, the sides of the hulls, or the hazy background mountains. Since the "edges" in these areas are not nearly as pronounced as masts vs. background, they'll only be sharpened a little, but believability will be enhanced.

If a picture looks oversharpened when we're done, possibly it's because we were incompetent enough to choose too low a Threshold, resulting in unacceptable enhancement of noise. Otherwise, it's going to be because of the already pronounced edges, not the "textured" areas. The edge halos can get real clunky real fast. It's therefore possible that we might want to sharpen the textured areas more and the strong edges less. That's why I suggested in my response to Jacob that perhaps what's needed in the algorithm is a reverse threshold--a limit on how big of a change is permitted. Such a limit would affect only the big-time edges, because in a textured area, the changes are always small.

If we are talking about conventional, one-pass USM, this reverse threshold might sometimes be mildly useful. But it's not a big deal--with one enormous exception.

An urban legend promoted by various camera and raw module developers is that images should get some sort of light conventional sharpen before entering Photoshop. It' a bad idea. The image looks better temporarily, but it handcuffs later sharpening. I recommend that people turn all sharpening OFF in raw modules and cameras. Many people don't do that, so the question is, what do we do when one of them hands us a file that they have been helpful enough to presharpen for us?

The problem of not letting the edges get out of hand is now far more severe, because the presharpening has already exaggerated the edges much more than the textures, and now the USM filter will force us to redouble the exaggeration. Consequently, we are not able to get adequate sharpening in the textured areas because any heavy settings will make the halos on big edges obscene.

That's where the reverse threshold is needed--when somebody's already tried to sharpen the picture and we need to sharpen it more. Some method like the following is needed, and I've had success with it on presharpened images. But in light of this thread, I can now see where we might wish to provoke the situation ourselves by doing the unthinkable: resharpening an image that is already heavily sharpened.

This method is unlikely to get dramatically better results unless you have a picture like what I just described: pronounced edges, but also textured areas. Another of my examples showed a baby pine tree, whose needles provided the strong edges, in a forest, whose floor provided the textured area. Anyhow, here's the procedure. We're assuming here that we would ordinarily do one pass of conventional RGB sharpening, without a mask. Also, we'll assume that for all this sharpening, we want to reduce the intensity of lightening halos by half, while retaining the darkening halos at full intensity.

1) Pretend that you have never heard of this procedure. Open the USM filter, set it to 500% Amount, and choose what you consider to be the optimal Radius and Threshold. For the sake of argument, you choose 1.2 Radius and 3 Threshold. Don't actually apply it unless you are planning to save a copy for comparison. In that case, in a separate file, duplicate the unsharpened layer, sharpen, and apply the unsharpened layer to the sharpened one at 50% opacity, Darken mode.

2) Returning to the original unsharpened file, make a duplicate layer and apply sharpening at 500% Amount, but reduce the Radius you chose by 1/3 and add 2 to the Threshold, because in this procedure avoiding noise is important. Given the optimal values in #1, the new settings should be 500%, .8, 5.

3) Apply the unsharpened layer to the sharpened one at 50% opacity, Darken mode, to reduce the lightening halos.

4) Make a duplicate of the top, sharpened layer. Re-sharpen it, with a Threshold three points higher than last time and a Radius 1.5 times optimal. In this case, 500%, 1.8, 8, followed by once again applying the bottom (unsharpened) layer at 50% opacity, Darken mode.

5) This will result in the most bycracky coyote ugly thing that ever was seen, and should convince the most heretical of the evils of double-sharpening at low Radii. However, we haven't yet applied the reverse threshold. To do so, make a duplicate of this three-layer file.

6) Working in this duplicate file, change mode of the top layer to Difference.

7) Flatten image.

8) Convert to grayscale.

9) Auto levels.

10) Return to the working file (with three layers) and add a layer mask to the top, resharpened layer. Load as the layer mask an INVERTED copy of the grayscale file of Step 9.

11) Reduce opacity of the top layer to taste, usually 40-60%.

12) Reduce opacity of the middle layer to taste, if necessary. Flatten and compare the final result to the single-pass version you may have saved in Step 1, if you care.

EXPLANATION: Steps 6-10 create a mask based on the difference between the sharpened and the resharpened versions. The bigger the difference, the darker the mask is and the more the resharpening is disallowed. Sharpening of strong edges is limited while sharpening of lightly textured areas is permitted. Overt haloing is less than in one-pass conventional sharpening but the focusing effect is just as powerful.

Granted, this adds several steps for a limited gain, on the assumption that the alternative is a single pass as in #1. OTOH, if somebody has given you a presharpened file, then #1 is no longer an option. And in that case this method can pay real dividends.

This is by no means a final recommendation. Suggestions for improvements are welcome.

Dan Margulis
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: "Bill Morse"
Sun Dec 21, 2008 6:10 am (PST)

Wow! I haven't had the chance to work with this yet, but I wonder if this or a similar move could help with one of my frequent challenges, the accentuation of grain, expecially from B&W negs, when sharpening. I often find that conventional sharpening can't be used at all with these files. If I could enhance the texture, without popping the grain, that would be a huge advantage.

Thanks again, Dan, for your continuing pushing of the envelope!

Regards,

Bill Morse
Wm. Morse Editions

http://www.MorseEditions.com/
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: George Machen
Sun Dec 21, 2008 1:36 pm (PST)

Dan, I also liked your early rough workaround for the poor unsung heros in prepress who receive pre-sharpened client images. This procedure might serve as an adjunct to your present maneuver.

- George Machen

--
From: Dan Margulis
Date: Mon, Oct 8, 2001, 11:31 PM
RE: [colortheory] Smooth Skin?

Hector Davila writes,

What's the best way to smooth skin on photos? I've seen *those*
web sites where the girls skin looks real smooth. How do you do that?
Is it bluring AB channels?

A method that I illustrated at Seybold is similar to the ones
mentioned previously by Lee Varis and John Opitz, but I think is a
little better in avoiding the overly airbrushed look.

1) Make four identical layers. Layer 1 remains untouched.

2) On Layer 2, Gaussian blur, Radius 2.0 (for starters, may adjust).

3) Having blurred Layer 2, apply a curve that lightens the midtone
very slightly.

4) Change layering mode on Layer 2 to Darken. This will disallow
most of the layer because of Step 3, and will only fill in small white
blotches.

5) On Layer 3, apply Gaussian blur at double the radius of Step 2.
(Reason: darker spots on the skin tend to be larger than white spots).

6) Having blurred Layer 3, apply a curve that darkens the midtone
very slightly.

7) Change layering mode on Layer three to Lighten. This will
disallow most of the layer because of Step 6, and will only correct
age spots and other dark blemishes.

8) Compare Layer 3 to Layer 4 (an untouched original) and merge
the two as desired with a layer mask.

This, incidentally, is how one "unsharpens" a picture, when a
client has been so helpful as to supply something that's been
oversharpened, without giving us access to the original.

Dan Margulis

http: //www.ledet.com/margulis/ACT_postings/ColorCorrection/ACT-Smooth-Skin.html
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: George Machen
Sun Dec 21, 2008 1:36 pm (PST)

Here is something I discovered that may help with noise reduction early in post, and serve as a pre-sharpening setup. It also seems to help get rid of those JPEG artifact "squares" as well as the "fringing clutter" around thin edges.

- Using Lens Blur, observe that at a clearly too-large value of Radius for a particular image, such as 1.0 pixel, the noise & artifacts become worse when the More Accurate checkbox is enabled. Makes sense, considering that doing so applies the "deconvolution" twice. (Which is "pulling-in" or shrinking the artifacts by the Radius' amount of the estimated "point spread function" distance.)

- But decrease the Radius value in 0.1 pixel increments, each time toggling the More Accurate checkbox, and suddenly at one point something very interesting happens: Below a certain Radius, the More Accurate setting drastically *reduces* the artifacts, yet the image still looks more focused.

I suspect that at this Radius point, the image's native point spread function has been reached by empirical manual iteration!

How about some of you folk try this out and get back to us here.

- George Machen
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Cathryn McLeod"
Sun Dec 21, 2008 8:53 pm (PST)

Does anyone look at photos at greater than 100% to see where the pixels change? Would that tell you something about blur?

Cathryn
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: Dan Margulis
Mon Dec 22, 2008 6:25 am (PST)

George writes,

Dan, I also liked your early rough
workaround for the poor unsung heros
in prepress who receive pre-sharpened
client images. This procedure might serve
as an adjunct to your present maneuver.

I suppose they are adjuncts but they really address different problems. What I was just posting dealt with images that are presharpened but we would like to sharpen more. In that case, we wish that the person had not been so helpful as to presharpen, but we take the jobs the way we get them.

The procedure you referred to was where the presharpening was too much, and we want to reduce it. Alternatively, it's a good procedure for faces where smoothness is desired. In such cases even an unsharpened version may strike the viewer as being too sharp, particularly if the viewer happens to be the subject.

Dan Margulis
___________________________________________________________________________
.
Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: Dan Margulis
Mon Dec 22, 2008 8:19 am (PST)

On Dec 21, 2008, at 8:10 AM, Bill Morse wrote:

Wow! I haven't had the chance to work with this yet, but I wonder if this or
a similar move could help with one of my frequent challenges, the
accentuation of grain, expecially from B&W negs, when sharpening. I often
find that conventional sharpening can't be used at all with these files. If
I could enhance the texture, without popping the grain, that would
be a huge advantage.

The method I suggested would not work here, at least not the way I described it, because it depends on keeping noise out of the original sharpen. If you have exaggerated noise or grain by sharpening, it means that the original Threshold setting is too low. OTOH, if your Threshold setting is too high, you will lose the sharpening in areas where you may want it.

If you're having trouble with finding the USM Threshold, here's a possible aid. Before sharpening, locate an area where the grain is fairly pronounced. Blow it up to 300% on screen so that you can see what's happening. Open the Surface Blur filter and preview using Radius 2, Threshold 20. This very high setting will definitely blur out the grain. With the preview still open, reduce the Threshold until the grain starts to reappear. The objective is to find the minimum Threshold that obliterates the grain. Once you know that number, cancel the Surface Blur and apply USM using that Threshold.

After sharpening in this manner, it's conceivable that my resharpening method will work, although I am skeptical. Give it a try and let us know.

Dan Margulis
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: "Davide Barranca"
Mon Dec 22, 2008 9:16 am (PST)

Dear group,

the recent thoughts about sharpening raised a lot of engaging questions; I'd like to focus this contribute more to the practical side, namely the use of current Photoshop tools, even if I'm liking all the theory behind the discussion. I don't know whether my contribute could be applied to a production environement, but at least it's food for thoughts and I'll be glad to see it developed.

The whole thing is about the need to differentiate and modulate sharpening in textured area versus edges (Dan cited one recently with his reverse threshold method).

Traditional USM is based on Gaussian Blur (GB) that has the drawbacks Jacob's pointed out and we all now know about. Some months ago I suggested here the use of SurfaceBlur (SB), as useful tool to obtain a no-halo Shadows/Highlights-like filter - it's good for sharpening as well.

A bit of background:
GB hits both edges and texture, so it could be used easily to sharpen... both edges and textures; SB hits texture only, and does it's best to keep edges alone. Even if it's not perfect (large radii are problematic), it can be used to sharpen texture only. The difference between SB and GB hits edges only.

Let's call O = Original, T = Texture component, E = Edges; being
GB = O - (T + E);
SB = O - T;

we have:

T = O - SB;
T + E = O - GB;
E = SB - GB;

The subtraction is quickly done in Calculation: let's pick a grayscale image (for the sake of simplicity, you can easily derive the RGB processing), duplicate the channel and blur it. Then Calculation: source 1 Channel: Blurred, source 2 Channel: Original, Blending: Subtract, Offset: 127. The result is used in Overly (or other similar flavours like Linear light Opacity 50%) to get the sharpening effect. This gives us all the needed instrument to modulate the sharpening in edges only, texture only or both using SB-GB, SB or GB respectively as blurring kernels.

A more interesting implementation uses pyramid decomposition into detail layers (KPT Equalizer used similar processing, for instance).

Keeping to 2 the number of the decomposition levels, the theory says that, being:
U(0) the original image,
U(1) = U(0) filtered with GB and/or SB;
U(2) = U(0) "more" filtered (higher radius) with GB and/or SB;

and called the difference D:
D(1) = U(0) - U(1);
D(2) = U(1) - U(2);

we can recompose the original:
Original = U(2) + D(1) + D(2)
(substitute D(n) to demonstrate it)

Calculation can be used as previously described to have the Difference images, that should be put on the top of the "more" filtered image, both LinearLight, 50% to get the original picture. If you use simply GB as blurring kernel, the result is a two sliders setup (the opacity of the difference layers) that can be modulated to increase the standard sharpening effect of two distinct radii at the same time. This avoids the necessity to give the picture 2 or more consecutive rounds of USM - depending on the levels of the decomposition, we can vary as many radii as we like (just the same as KPT Equalizer plugin - for those who's never seen it, you have something like a stereo equalizer with sliders and you can add or subtract sharpening to several frequency bandes at the same time - for instance 1px, 3px 10px, 20px, so traditional USM and HIRALOAM à la fois!). OTOH using SB gives you an equalizer more focused on texture detail, leaving edges alone.

This isn't something new in the digital image processing field, and it could have been alreay implemented in Photoshop: my personal idea is to mix GB *and* SB to have sliders that modify different frequencies of edges *and* texture detail separately, let's call this a double equalizer. Not very intuitive maybe, but something that can be easily automatized.
I'll post some more examples if you want me to; but I would like to hear comments or further developing ideas from those who'd like to expand the topic as well.

Kind regards,

Davide Barranca
Bologna, Italy
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: George Machen
Mon Dec 22, 2008 1:30 pm (PST)

Sorry, I'm reposting this with amendments because my original post left the impression that I was using the Lens Blur filter. I meant to say that the Lens Blur option within the Smart Sharpen filter should be used. I've also tried to elaborate some points to be more clear.

 "Bill Morse" wrote:

... one of my frequent challenges, the
accentuation of grain, expecially from B&W negs,
when sharpening. I often find that conventional
sharpening can't be used at all with these files.
If I could enhance the texture, without popping
the grain, that would be a huge advantage. ...

Here is something I discovered that may help with noise reduction early in post, and serve as a pre-sharpening setup. It also seems to help get rid of those JPEG artifact "squares" as well as the "fringing clutter" around thin edges.

In this illustrative example, for purposes of clarity, choose a low-res, low-quality JPEG, from which sharpening will bring out ugly artifacts. Moreover, choose the max 500% Amount, which of course can be dialed-back later. Also, to accentuate the visibility of the effects, zoom-in to, say, 200% or more.

- In the Smart Sharpen dialog, choose Lens Blur from the Remove popup menu.

- Observe that at a clearly too-large value of Radius for a particular image, such as 1.0 pixel (I was doing this on a 72 dpi image), the noise & artifacts become worse when the More Accurate checkbox is enabled. Makes sense, considering that doing so applies the "deconvolution" twice. (Which is trying to "pull-in" or shrink the artifacts by the Radius' amount of the estimated "point spread function" distance. But at this Radius the distance is too long, which actually increases the absolute value of the correction, overshooting too far in the opposite direction.)

- But repeatedly decrease the Radius value in 0.1 pixel increments, each time toggling the More Accurate checkbox, and suddenly at one point something very interesting happens: Below a certain Radius, the More Accurate setting drastically *reduces* the artifacts, yet the image still looks more focused.

I suspect that at this critical Radius point, the image's native point spread function empirically has been reached by brute-force manual iteration!

Yes, some of the texture (at the same scale) that we're trying to target gets harmed along with the improvements, but after playing with it, it seems clear to me that the trade-off in doing it makes the image look better than not doing it.

How about some of you folk try this out and get back to us here.

- George Machen
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: Michael Jahn
Mon Dec 22, 2008 6:26 am (PST)

On Sun, Dec 21, 2008 at 7:45 PM, Cathryn McLeod wrote:

Does anyone look at photos at greater than 100% to see where the
pixels change? Would that tell you something about blur?

Hi Cathryn,

in 14 words, "not unless you happen to be really old like me and need reading glasses"

So, perhaps I am at a loss here - do you shoot things that end up appearing in a catalog, magazine or newspaper ?

Are you that person who works in prepress who prepares files for the guys in the press room ?

Or are you a photographer and / or a retoucher, wondering just why everyone seems to be worried about something that you can only see to see on your 96 pixel per inch monitor at enlargements of over 100%, and even when you print on your inkjet printing device, have a hard time actually seeing the difference between one image that has USM applied and another image that has none ?

"something about blur " -- not sure what you are asking - are you asking (again) why would someone ever want to use blur on an image ?

or, is the "blur" you are asking about - is it a blur related to USM ?

--
Michael Jahn
Jahn & Associates
PDF Color Conversion Specialist
___________________________________________________________________________

Re: proper "sharpening" at all scales, ideas (and rants) about the u
Posted by: "Cathryn (Shaffer) McLeod"
Mon Dec 22, 2008 9:16 am (PST)

Michael, I learned a lot from your post. Everyone who wrote back: thanks, that was a big help!
I appreciate the education, links and comments.

Cathryn
___________________________________________________________________________

New Smarter Sharpen Technique, Post 1 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 2:48 pm (PST)

Dear Group,

Holiday greetings to you all. When Jacob Rus recently brought up the subject of sharpening at different scales (post #20697), I mentioned that his post was timely and that I had been working on this area recently too. I promised that I would report back to the list when I had something worth saying.

I have been putting this personal research into a web page article, however in light of the recent posts from George Machen (post #20777) and Davide Barranca (post #20776) - I feel that I should make my findings known as it may help others exploring similar territory.

These posts are too long for one email read, so I will break them up into threee separate posts. The first post will contain an overview of the Smart Sharpen filter. The second post will go into detail on the Smarter Sharpen technique that I am proposing. The third, final introductory post will contain further workflow options for use with Smarter Sharpen and contain a review and conclusion.

I am posting this article at my website with some images, however that will take a little bit longer, until tonight this link will be dead, I hope to get the link and pictures up ASAP.

http: //members.ozemail.com.au/~binaryfx/smartersharpen.html

I will also shortly have an action available to download, which will be available at the same page.

_____

This post will introduce a new approach for sharpening with the Smart Sharpen filter, which does not use masks or selections and minimises excessive noise amplification and distracting halos. The method outlined below makes use of a 25+ year old image processing technique that may be unknown to many Photoshop users, in order to facilitate the application and improve the results of the Smart Sharpen filter. Although the sharpening properties of this approach are best suited for acquisition/capture and monitor viewing sharpening, it is also possible to exaggerate the effect to produce wider, less subtle halos which are suitable for output sharpening for halftone or stochastic based print.

Introduction:

Sharpening is one of the most popular and subjective topics in modern digital image processing, with many people developing a wide range of competing sharpening workflows; actions and other tools. Sharpening results and the various options that can be employed in a sharpening workflow are often discussed and debated with great enthusiasm in online forums and email lists. In Photoshop CS2, Adobe introduced the "Smart Sharpen" filter, which was a major addition to the existing sharpening options which had not seen any updates with new version releases over the years. Smart Sharpen uses an undisclosed "Deconvolution" algorithm to remove blur in a mathematical attempt to restore focus to an image, rather than simply adding edge contrast to blurred pixels to simulate focus.

Smart Sharpen was initially met with interest, however many Photoshop users reverted to using their older, trusted Unsharp Mask, Band Pass or Difference of Gaussians based sharpening techniques. The lack of a "Threshold" or other noise avoidance option in Smart Sharpen is often viewed from two extreme opposite viewpoints from users familiar with traditional sharpening methods. One camp considers Smart Sharpen to be smart as it does not have a Threshold type command, while the other camp views the lack of a Threshold type command to be a serious design flaw - as noise and sharp, fine detail is often overly amplified. Even with further modifications such as masks or various blending options, Smart Sharpen may not be employed to it's full potential when used with common editing approaches.

Smart Sharpen - Basics:

Unlike the Unsharp Mask filter, Smart Sharpen requires viewing at 100% (1:1 pixel) magnification. Giving the Smart Sharpen filter a cursory view, there are familiar Amount and Radius sliders, without a Threshold option. There is the added choice of three different blur types, with optional tonal blending options similar to those found in the Shadow/Highlight command. With simple application, one may conclude that results are the same as Unsharp Mask. This is true when Smart Sharpen is set to Basic mode, Gaussian Blur with the "More Accurate" option disabled. Results are identical to USM of the same values with zero Threshold.

When the More Accurate checkbox is enabled, the Smart Sharpen filter becomes smart, using a processor intensive iterative deconvolution process to remove blur to improve acutance. Of note, when run in More Accurate mode, visible artifacts may be introduced with some images when the filter is applied to 8 bpc data. It is strongly recommended that filtering be performed in 16 bpc mode, even if the image was in 8 bpc mode prior to running Smart Sharpen (even more so if the image is grayscale or has had JPEG compression applied).

Deconvolution and the Point Spread Function (PSF):

The Point Spread Function describes the convolution (blur) in the image and is critical to successful deconvolution. The closer that the PSF describes the image blur, the more accurate the final result. In astronomy, a blurred star or other point light source provides an ideal measure of the image blur, however in regular photography it may be much harder to assess the image blur. Smart Sharpen offers three simple blur types with fixed parameters: Gaussian Blur, Lens Blur and directional Motion Blur.

Gaussian Blur is the "Swiss Army Knife" of the Smart Sharpen filter. Simple blur in natural images will likely be different to the Gaussian weighting, however the Gaussian function can often be successfully used as a generic substitute with the knowledge that better results could be obtained with a more accurate PSF description.

Lens Blur differs from Gaussian Blur and only provides accurate results when the image blur matches the Lens Blur PSF description. Once the appropriate Amount and Radius settings are found, Lens Blur results should be compared against the Gaussian Blur results. One may find that the Gaussian PSF will provide more pleasing results, even if the blur is truly lens related.

Motion Blur removal is controlled via an interface similar to the Blur/Motion Blur filter, with a choice of directional blur angle. Selecting the correct blur angle is critical, otherwise noticeable artifacts may be generated with little appreciable restoration of focus.

Smart Sharpen - Review:

* View the image at 100% magnification

* Process in 16 bpc mode where possible

* Process with the More Accurate option enabled

* Accurate blur description is critical to the deconvolution process

* Radius - start slightly smaller than the estimated blur radius and adjust higher in small steps (0.1, 0.2)

* Amount - a larger radius blur requires minor amount values, while a smaller radius blur can accommodate high/maximum values

End 1 of 3

My next post will introduce and detail the actual method of the Smarter Sharpen technique.

______

Regards,

Stephen Marsh
___________________________________________________________________________ ly

New Smarter Sharpen Technique, Post 2 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 3:00 pm (PST)

Smarter Sharpen Technique - Introduction:

As previously noted, without a Threshold type command, Smart Sharpen using the More Accurate option can be very unforgiving when it comes to image noise, lossy compression damage and high spatial frequency detail. When the More Accurate option is disabled, results are the same as USM, which defeats the purpose of using Smart Sharpen over traditional methods. Traditional approaches to using the Smart Sharpen filter often process both low and high frequencies using the same settings. I believe that successful use of the Smart Sharpen filter requires the targeting of various ranges of spatial frequency, with different Amount and Radius values appropriate to each frequency range.

In the spirit of the Adobe naming convention, I have named this technique Smarter Sharpen. More descriptive terms may include "Bi-Frequency Decomposition & Deconvolution" or "Iterative Multi-Scale Focus Restoration". To my knowledge, this method has not been publicly proposed for dedicated use with the Smart Sharpen filter prior to the publication of this article in December 2008.

The Smarter Sharpen technique targets the various image spatial frequencies by "decomposing" or splitting the original image data into a layer stack of two images, with the low frequency (Gaussian) data in the lower layer and the high frequency (Laplacian) data in the upper layer. This bi-frequency decomposition forms part of a classic image processing technique known as "Gaussian & Laplacian Pyramid Processing" (however the Smarter Sharpen technique does not use a decreasing resolution pyramid structure). Once the image has been decomposed into separate high and low frequency layers, Smart Sharpening can be applied with greater success than when processing regular image data.

Smarter Sharpen, Basic Technique - Gaussian & Laplacian Decomposition:

Stage 1: Bi-Frequency Decomposition -

Creating the Gaussian and Laplacian bi-frequency data layers is a fairly simple process. When performed in 16 bpc mode, the decomposition is lossless, resulting in no change to the original image when it is recombined. This is critical, as even the "negligible" 0.5 standard deviation error in 8 bpc mode processing is enough to generate artifacts when iterative decomposition is performed.

Presuming that one is working on a flattened duplicate image or history snapshot in 16 bpc mode:

1. Duplicate the background image into a second layer

2. Target the original lower background image and Gaussian blur (example, 2 pixel radius)

3. Target the upper layer containing the duplicated original data

4. Apply Image command: source background layer, subtract blending mode, 100% opacity, offset 128, scale 2

5. Change the upper layer to Linear Light blending mode retaining the default 100% opacity

The two layer set of high and low band passed frequencies can be flattened and compared in difference blending mode to the original image at this point to verify that this technique is lossless. The (refreshed) Histogram statistics or Equalize command can be used to assess any potential errors in the frequency splitting process.

Note: Step 4 does not create errors or artifacts, unlike High Pass filtering (2 pixel radius, blended at 50% opacity, Linear Light blending mode). Conclusion - Although similar, the Photoshop High Pass filter is not the true inverse of Gaussian Blur. High Pass filtering should be avoided due to the high standard deviation errors affecting high frequency detail.

Stage 2: Low Frequency Deconvolution & Supplemental Sharpening -

In a basic single decomposition Smarter Sharpen workflow, the low frequency data layer is deconvolved with the Smart Sharpen filter using the Gaussian + More Accurate option, with appropriate Amount and Radius settings for the image. If the low frequency layer was created with a 2 pixel radius blur, then an appropriate initial radius for the Smart Sharpen Gaussian removal filter could be around 1.7 pixels. Next, gradually increase the radius value by steps of 0.1 or 0.2 pixels until the low frequency layer "pops" into better focus, without amplifying noise or adding objectionable halos. For a 2 pixel Gaussian Blur, the radius "sweet spot" setting may be around 1.8 to 2.2 pixels (dependent on the sharpness and noise levels of the original image). This is a general guide only, depending on image variables one may need to select lower or higher values. When in doubt, a lower Radius and Amount setting may be appropriate.

The following options further enhance the image sharpness over the initial application of the Smart Sharpen filter to the low frequency data.

Option 1: After Smart Sharpening, with the low frequency (LF) layer as the target layer, the Apply Image command is used to blend the high frequency data into the low frequency layer. Appropriate blending modes include: Soft Light, Overlay, Hard Light, Vivid Light and Linear Light using an appropriate reduced opacity level to further control intensity.

Option 2: Finally, the high frequency (HF) data layer is targeted and sharpened. As the HF data has very different characteristics, the sharpening radius will require a smaller value with an appropriate intensity for the image content. Simple Unsharp Mask filtering may be used in order to take advantage of the Threshold command, however one may also choose to use Smart Sharpen or minor noise reduction and High Pass filtering, using the fade command to a suitable blending mode and opacity.

Stage 3: Flattening and Blending -

The final stage is to "collapse" or Flatten the sharpened low and high frequency layers into a regular composite image. The sharpened layer is then blended over the original colour image in Luminosity layer blending mode. Opacity may be globally reduced, or the Layer Option Blend If sliders and or layer masks may be incorporated to further control the blended results of the Smarter Sharpen technique.

Smarter Sharpen, Advanced Technique - Iterative Multi-scale Deconvolution:

The basic Smarter Sharpen technique makes use of a single decomposition to the user defined Gaussian low frequency level. Taking the technique to the next obvious step, one may perform multiple serial decompositions from coarser to finer Gaussian Blur levels (or vice versa). Appropriate subtle deconvolution sharpening of the LF data is performed at each Gaussian level, with HF data at each level mostly being ignored.

For example, one may choose to use a five pass approach, using Gaussian blur steps of 3, 2, 1, 0.6 and 0.3 pixel radius. Results from each manual deconvolution iteration are compounded to some extent, therefore a higher blur requires lesser amount settings, while a smaller blur can use higher intensities. Appropriate Radius selection at each LF level is critical. Sharpening of the HF data should commonly be performed in the later finer scale decompositions, in order to reduce the influence of HF data on the next finer scale level low frequency decomposition deconvolution.

End 2 of 3

______

Stephen Marsh
___________________________________________________________________________
.
New Smarter Sharpen Technique, Post 3 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 3:06 pm (PST)

New Smarter Sharpen Technique, Post 3 of 3

______

Smarter Sharpen - Processing Variables:

Colour Modes & Processing Speed -

Smarter Sharpen can be used to process colour data in RGB, Lab and CMYK colour modes, or single channel mode data such as Grayscale mode. Using channel blends in lieu of layer blends, Multichannel mode images can also be directly processed using this technique. As this technique relies on the accuracy of 16 bpc processing, performance may become an issue. Additionally, the slower More Accurate Smart Sharpen option compounds the need for high bit data processing which also adds to the processing time.

One may speed Smarter Sharpening of RGB images by only processing the single RGB Luminosity "channel" data instead of all three channels. Unlike the lossy conversion to Lab mode for L* channel processing, the extraction of the RGB Luminosity data is a lossless move. To create this Luminosity data, simply fill a duped RGB image with a flat neutral white/black/gray tone in Saturation or Colour blending mode. Next, target a single channel and use the mode/grayscale command (do not use the Convert to Profile command in this case). Finally one manually assigns a grayscale ICC profile of the same gamma as the RGB original.

Once this Grayscale mode faux RGB Luminosity "channel" has been sharpened using the Smarter Sharpen technique, it can be blended into the original RGB image in Luminosity blending mode. When this technique is correctly performed, the original RGB image will not change in overall luminosity (even in 8 bpc mode, Luminosity extraction and blending is a lossless process). The net result should be very similar to RGB mode sharpening, using only one third of the resources as regular RGB processing.

Linear Deconvolution -

Linear gamma sharpening may be preferred for some image content. The simplest way to access linear RGB processing in Photoshop is to convert to 32 bpc mode. As linear gamma involves major gamma transforms from/to standard 1.8 or 2.2 gamma RGB working spaces, this move is not recommended for underexposed or noisy originals, which may suffer visual degradation from the conversion in and out of linear 32 bpc mode. The results of linear sharpening are similar to standard gamma sharpening, however linear processing results in less obvious light halos, with more obvious dark halos.

Note: when converting from 32 bpc to a lower bit depth, the image will be converted to the RGB working space instead of the original ICC profile of the document (this is by design, as Photoshop can't keep track of the document profile). One should either change their RGB working space in Colour Settings to match the image, or convert the image to working RGB.

Smarter Sharpen Technique - Review:

Deconvolution requires an accurate Point Spread Function description to provide pleasing results. If the PSF is incorrect, results may be poor or unwanted artifacts may be introduced. The Smart Sharpen filter provides three simple PSF choices, with lens blur and motion blur added to the traditional USM (Gaussian blur) based edge sharpening. A PSF can be idealised or based on an actual real world image sample.

The Smarter Sharpen technique uses an idealised Gaussian Blur PSF, which is not a part of a natural image. By decomposing an image into separate Gaussian low and high frequency data, one can then deconvolve the known Gaussian low frequency data with the matching idealised Gaussian PSF. This idealised PSF will often result in more accurate deconvolution than when using the unknown Lens Blur PSF, which likely differs from the blur found in the image. A variation of this technique would be to decompose the image into Lens Blur based bi-frequency layers, instead of using the simpler Gaussian Blur command. Lens Blur offers many controls, therefore I have not had the time to explore the different combinations to create optimal results with the unknown fixed variables used to describe the Lens Blur PSF in Smart Sharpen.

Decomposing an image into separate Gaussian low frequency and high frequency layers provides targeted processing, allowing one to take into account the separate and unique properties and requirements of each opposing image frequency. This approach reduces noise amplification or distracting halos, while providing the appropriate selection of Radius and Amount for the targeted image frequency. Smarter Sharpen in it's simplest form uses a single bi-frequency decomposition with deconvolution of the LF data, additionally incorporating HF data blending and sharpening. Optionally, one may perform multiple decomposition and sharpening steps at various blur scales in order to fine tune additional frequency ranges.

Conclusion:

The Smart Sharpen filter is ignored by many Photoshop users, as processing multiple frequencies using a single "one size fits all" radius and amount setting often provides unpredictable and/or unpleasant results. Using the Smarter Sharpen technique, deconvolution results in predictable sharpening at multiple spatial frequencies while minimising noise amplification and sharpening halos. It is my opinion that the Smarter Sharpen technique is a significant step forward in using the Smart Sharpen filter in Photoshop.

End 3 of 3

______

Regards,

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: "Davide Barranca"
Mon Dec 22, 2008 4:20 pm (PST)

Dear Stephen,

great job!! I'm glad to see that there's room to make improovements in image enhancement with Laplacian pyramid decomposition. I've never thought about sharpening the base layer before, and its effectivity (that comes from the matching to its PSF) is a very smart intuition indeed. Now it seems a quite obvious idea, as usually happens with this kind of things :-) I'll test your sharpening routine as soon as I can and I'll provide you some feedback. It really seems that multiscale decomposition is a good starting point in image processing; (http: //www.cs.huji.ac.il/~danix/epd/ is a link about a better bilateral filter and its detail enhancing possibilities I'd like to repost for those who had missed it) I'm currently involved in refining my "new equalizer", but I'm looking forward to find a way to implement some of your ideas in it. Let's see what this great amount of new thoughts about sharpening will produce in 2009... Thanks and kind regards,

Davide Barranca
Bologna, Italy

___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: "Ron Kelly"
Mon Dec 22, 2008 6:47 pm (PST)

Stephen:

Fascinating explanation but I really can't follow it.

I'm sure everyone will want to see some examples; that I can understand.

Thanks for your efforts and willingness to share,

Ron Kelly
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 7:35 pm (PST)

Davide Barranca wrote:

Dear Stephen, great job!! I'm glad to see that there's room to make
improovements in image enhancement with Laplacian pyramid
decomposition. I've never thought about sharpening the base layer
before, and its effectivity (that comes from the matching to its PSF)
is a very smart intuition indeed. Now it seems a quite obvious idea,
as usually happens with this kind of things :-)

Thank you Davide, yes, Laplacian/Gaussian separation appears to be used under the hood in many recent image processing tasks.

As you say, most focus on the HF data layer, however this Smarter Sharpen technique demonstrates that there is gold in the LF data layer too, beyond large scale tonal shifts it can also be used for sharpening, once one starts to look into the subject of deconvolution. It may not be initially obvious or perhaps it is counter intuititive at first glance...why would one blur data and then "sharpen" it again, hoping for a better job than simply sharpening the original data? We do not wish to sharpen, but deconvolve this low frequency data. This is not the same thing.

I'll test your sharpening routine as soon as I can and I'll provide
you some feedback.

Thanks, I have found it to be a huge step forward in using the Smart Sharpen filter. Whether or not this method is better than other USM or similar non deconvolution based methods remains to be seen.

It really seems that multiscale decomposition is a good starting
point in image processing;
(http://www.cs.huji.ac.il/~danix/epd/ is a link about a better
bilateral filter and its detail enhancing possibilities I'd like to
repost for those who had missed it)

Thanks for the link repost Davide, when you posted it months ago, it started the process that led me to devoloping the Smarter Sharpen technique.

I'm currently involved in refining my "new equalizer", but I'm
looking forward to find a way to implement some of your ideas in it.
Let's see what this great amount of new thoughts about sharpening will
produce in 2009... Thanks and kind regards

Please do share! BTW, I will be looking into your recent post when I have some free time after the Christmas period.

I remember the KPT Equalizer and there is a similar tool to be found in a software package for Astronomers titled "Astra Image", it offers wavelet based multi-frequency sliders, while it also contains separate filters for deconvolution which are not related to the frequency sharpening (MS Win only).

Sincerely,

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 7:39 pm (PST)

Thank you for the feedback Ron.

As this is an email based list, I had to break up a web page article and I could not include images. This is not so much a step by step tutorial, although all the information is there in sequence if one wishes to go and play.

I have uploaded the inital draft of the article to my website, perhaps the formatting and or inline images and image swaps will help.

http: //members.ozemail.com.au/~binaryfx/smartersharpen.html

At the end of the article, one can find links to articles on Gaussian & Laplacian Decomposition and Deconvolution. I hope that these are of help or spark further ideas in other people.

I have not uploaded an action yet, which I will attempt to do later (the action has not been tested on multiple plaforms or systems, however it should make the article easier to follow if these concepts are new to you).

Sincerely,

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: George Machen
Mon Dec 22, 2008 9:17 pm (PST)

Bravo, Stephen!

Here is something to mull over; use it if it turns out to be useful:

The Focus Magic commercial Photoshop plug-in at least partially uses a deconvolution algorithm. Its vendor Acclaim Software suggests a procedure of examining a point specular highlight in an image, determining the diameter of the blur circle in pixels, then using that number for the Focus Magic point spread function value.

So couldn't one zoom-in on a found small specular in an image, count the number of visually apparent bokeh pixels emerging radially around it, and insert that value in Smart Sharpen > Lens Blur's Radius field? In other words, isn't Smart Sharpen's roughly-judged point spread function value supposed to be entered into the Radius field?

- George Machen
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: Stephen Marsh
Mon Dec 22, 2008 11:26 pm (PST)

George Machen wrote:

Bravo, Stephen!

Thanks George, I hope this helps with some of your explorations of Smart Sharpen.

Here is something to mull over; use it if it
turns out to be useful:

The Focus Magic commercial Photoshop plug-in at
least partially uses a deconvolution algorithm.
Its vendor Acclaim Software suggests a procedure
of examining a point specular highlight in an
image, determining the diameter of the blur
circle in pixels, then using that number for the
Focus Magic point spread function value.

A similar approach has been recommended here at Forensic Photoshop:
http: //forensicphotoshop.blogspot.com/2008/10/unlocking-secrets-of-smart-sharpen.html

By all means, please test this theory and compare the Smarter Sharpen technique using the same blur radius (I have been there, done that, passed on buying the T-Shirt).

This does not take into account correct matching of the PSF to the image, only the radius of the PSF. This is why Gaussian and Lens Blur deconvolution can sometimes result in very similar and at other times different results.

By performing a Gaussian and Laplacian Decomposition as recommended in the Smarter Sharpen technique, we know the exact Gaussian PSF information used in the image, both radius and exact type of blur.

So couldn't one zoom-in on a found small specular
in an image, count the number of visually apparent
bokeh pixels emerging radially around it, and
insert that value in Smart Sharpen > Lens Blur's
Radius field? In other words, isn't Smart Sharpen's
roughly-judged point spread function value
supposed to be entered into the Radius field?

Yes it could and I think that it is does work this way. That being said, one is processing all image frequencies with the same radius and amount. Again, the natural image blur may not match the Lens or Gaussian PSF function. In the Smarter Sharpen technique, one isolates the various workable image frequencies and applies appropriate deconvolution to each unique frequency. One knows the approximate correct radius and the idealised PSF is also known.

Sincerely,

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 3 of 3
Posted by: "IC1313"
Tue Dec 23, 2008 6:48 am (PST)

I found the wavelet implementation in PixInsight LE very helpful -

http://pixinsight.com/download/LE/index.html

Found under - Process > Wavelets
You can turn on and off and enhance the different levels and it also has a preview mode where you can actually see the various scales. It also allows much more control over the number of levels and what you can do to them. Unfortunately it is an awkward program to use as it does not follow a lot of the conventions.

--

Clear Skies

Mick McCullagh
___________________________________________________________________________
.
Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: "John Ruttenberg"
Tue Dec 23, 2008 7:18 am (PST)

I would love to see examples.

-- John Ruttenberg

I'll post some more examples if you want me to; but I would like to
hear comments or further developing ideas from those who'd like to
expand the topic as well.
Kind regards,

Davide Barranca
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: George Machen
Tue Dec 23, 2008 12:18 pm (PST)

On further reflection, I believe that I mixed-up some of the concepts in my Message # 20777:
http://tinyurl.com/7jj8nk

- My iterative technique did not converge upon the natural point spread function of the image (the lens bokeh radius). Rather, it approaches the width of the JPEG artifact squares and (some of) the noise specks sizes.

- But it is a technique for determining at least partially the natural point spread function of the image (the lens bokeh radius) if you instead watch something out of focus in the image as you do my exercise. (It's merely a poor man's technique, however!)

- Consequently, to compensate for lens blur as well as noise/artifact reduction, multiple separate Smart Sharpen steps or layers would have to be taken at different parameters.

- But as we all know by now, Stephen Marsh's Smarter Sharpen technique, in no small part because of its separation of high & low frequency aspects of an image, does a profoundly more
effective job.

- But its possible use for an effective noise reduction function remains. This (to me, ironic) method of noise mitigation with a "sharpening" filter strikes me as novel. (Other conventional sharpening methods such as USM always aggravate noise.) It is akin to Dan's false profiles and false separations in that it represents an "abuse" of a procedure to accomplish other goals for which it never was intended.

- As I said previously, it does wipe-out a limited range of texture detail of comparable dimensions along with the noise & other artifacts. But then again, so does the highly-effective Fast Fourier Transform technique when removing periodic patterns such as preprinted material halftone dots. Both are like reducing hiss in music with your treble knob or the highest equalizer slider: the drummer's cymbals at the same frequency get diminished, too. But the upshot is that's it's often still better to do it than not, all things considered.

- George Machen
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Dan Margulis
Tue Dec 23, 2008 1:46 pm (PST)

Stephen Marsh writes,

As previously noted, without a Threshold type command, Smart Sharpen
using the More Accurate option can be very unforgiving when it comes to
image noise, lossy compression damage and high spatial frequency detail.
When the More Accurate option is disabled, results are the same as USM,
which defeats the purpose of using Smart Sharpen over traditional
methods. Traditional approaches to using the Smart Sharpen filter often
process both low and high frequencies using the same settings. I believe
that successful use of the Smart Sharpen filter requires the targeting
of various ranges of spatial frequency, with different Amount and
Radius values appropriate to each frequency range.

This set of interlocking threads is certainly yielding a lot of gems for the inveterate sharpening miner. A lot of work clearly went into this document and you deserve the thanks of everyone on the list.

I was planning on introducing a more flexible sharpening method in my super-advanced classes in March, one with certain similarities to yours minus the Smart Sharpen. Revisiting the More Accurate option of Smart Sharpen suggests a way of giving it even more punch (as always, at the cost of extra steps, which can nevertheless be reduced to Actions). But before talking about it, I need to clarify one aspect of *your* procedure because I may be misunderstanding one of your points.

1. Duplicate the background image into a second layer

2. Target the original lower background image and Gaussian blur
(example, 2 pixel radius)

3. Target the upper layer containing the duplicated original data

4. Apply Image command: source background layer, subtract blending mode,
100% opacity, offset 128, scale 2

5. Change the upper layer to Linear Light blending mode retaining the
default 100% opacity

All this is clear and puts us well on the way to a flexible sharpening approach. I agree that this is superior to running the High Pass filter, and also that the layered image is visually identical to the original.

Stage 2: Low Frequency Deconvolution & Supplemental Sharpening -

In a basic single decomposition Smarter Sharpen workflow, the low
frequency data layer is deconvolved with the Smart Sharpen filter using
the Gaussian + More Accurate option, with appropriate Amount and Radius
settings for the image. If the low frequency layer was created with a 2
pixel radius blur, then an appropriate initial radius for the Smart
Sharpen Gaussian removal filter could be around 1.7 pixels. Next,
gradually increase the radius value by steps of 0.1 or 0.2 pixels until
the low frequency layer "pops" into better focus, without amplifying
noise or adding objectionable halos. For a 2 pixel Gaussian Blur, the
radius "sweet spot" setting may be around 1.8 to 2.2 pixels (dependent
on the sharpness and noise levels of the original image). This is a
general guide only, depending on image variables one may need to select
lower or higher values. When in doubt, a lower Radius and Amount setting
may be appropriate.

Here is where I am getting lost. If I understand this correctly, having blurred the original on the bottom, you propose to un-blur it by careful use of the Smart Sharpen filter. If that interpretation is correct, I am flummoxed as to why one should chase his tail in this fashion rather than simply replace the bottom layer with a copy of the original. I don't see any step later for which the original would not be just as suitable a bottom layer as a blurred and unblurred version. And if that's so, then the entire method has nothing to do with Smart Sharpen as such.

When Smart Sharpen first came out I saw no use for it, for the reasons you stated. If More Accurate is not checked the function is identical to standard USM but it is rendered worthless by the incomprehensible lack of a Threshold field. If More Accurate *is* checked the function is very different and the sharpening is in some ways superior. It is, however, hidden by so much other detritus that again I felt that the lack of a Threshold was fatal.

Your post has caused me to rethink that position. I can show how to get the benefits that I think you are looking for (a combination of the Gaussian Blur method and the Smart Sharpen Accurate method minus the garbage) in an exceedingly flexible package. But before going off on that tangent, I want to be sure I haven't misunderstood your proposed procedure. So, I ask you to confirm that in the above- mentioned step, your workflow still functions if I substitute a copy of the original as the bottom layer rather than Smart Sharpening something that has been blurred.

Thanks for posting this thought-provoking procedure.

Dan Margulis
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Stephen Marsh
Tue Dec 23, 2008 4:00 pm (PST)

Dan Margulis wrote:

This set of interlocking threads is certainly yielding a lot of gems
for the inveterate sharpening miner. A lot of work clearly went into
this document and you deserve the thanks of everyone on the list.

Thanks Dan. I am probably like some others on the list, at any point in time I am "working" on researching three or four pet areas of image processing (either related or not). I jump around from one subject to the next as I run out of ideas or find a new source of information that takes me off to a new tangent.

I was not ready to publish my findings, technique or action - however the recent posts by Jacob, Davide and George indicated that we were exploring similar areas and that the separate projects may be enhanced by sharing what is curently known. The article was rushed and it does not serve well as a point by point walkthrough (although all the information is there), it is basically my half formed thoughts on the last few months of research.

I have been investigating bi-frequency decomposition or splitting an image into frequencies more in relation to retouching than in sharpening, which came later. Using regular sharpening approaches, I would have put the focus on splitting the image to various frequencies and processing the obvious high frequency detail, perhaps without even touching the low frequency base layer.

As I explored the topic of deconvolution, it became apparent that if one has a Gaussian/Laplacian decomposition, then the Gaussian base layer can be made sharp too, in addition to the standard sharpening and blending that would usually be done on only the HF data.

I was planning on introducing a more flexible sharpening method in
my super-advanced classes in March, one with certain similarities to
yours minus the Smart Sharpen. Revisiting the More Accurate option of
Smart Sharpen suggests a way of giving it even more punch (as always,
at the cost of extra steps, which can nevertheless be reduced to
Actions. But before talking about it, I need to clarify one aspect of
*your* procedure because I may be misunderstanding one of your points.

I initally used multiple serial bi-frequency decompositions with regular sharpening type moves, one can achive success with this method. Is it better, or worth the effort over other means? I have not answered that yet, I think it is a job for a wider group of testers than one. Then as Davide noted, the "obvious" became clear to me and I realised that this could be used to make Smart Sharpen work better than it does by default.

[Dan's comments regarding stage 1, Bi-Frequency Decomposition]

All this is clear and puts us well on the way to a flexible
sharpening approach. I agree that this is superior to running the
High Pass filter, and also that the layered image is visually
identical to the original.

Not to open this can of worms again, but...

It is not just a case of being visually identical, when the 16 bpc separated image is recombined it is pixel perfect, no data loss. This is very important, as my explorations of this method found that:

* Even using the "best practice" method outlined in my article to create the HF data instead of using High Pass, there is a minor amount of error when this decomposition is performed on 8 bpc data (0.5 standard deviation). When the decomposition is performed in 16 bpc, there is zero standard deviation error in difference tests to the original image. I wasted a lot of time thinking that this small amount of 8 bpc error would not create any difference or problems. I was wrong. Simply using 16 bpc for key steps removes the errors introduced by frequency separation/recombining.

* Smart Sharpen + More Accurate filtering can produce artifacts when run on 8 bpc data, even if the data was originally 8 bpc, one can gain visually better results when the filtering is performed in 16 bpc.

Stages of the bi-frequency decomposition and More Accurate mode filtering both require 16 bpc processing for best results, even more so if the input image is grayscale mode or has been JPEG compressed.

[Dan's comments on Stage 2: Low Frequency Deconvolution & Supplemental Sharpening]
Here is where I am getting lost. If I understand this correctly,
having blurred the original on the bottom, you propose to un-blur it
by careful use of the Smart Sharpen filter. If that interpretation
is correct, I am flummoxed as to why one should chase his tail in this
fashion rather than simply replace the bottom layer with a copy of the
original. I don't see any step later for which the original would not
be just as suitable a bottom layer as a blurred and unblurred version.
And if that's so, then the entire method has nothing to do with Smart
Sharpen as such.

Something that I had to keep in mind during this research was that Deconvolution was not the same thing as traditional sharpening, although the end result looks similar (both result in a sharper image than the softer original image).
 
An original image contains a mixture of different frequency scales. Smart Sharpen will affect all these scales. By decomposing an image into HF and LF layers, one can apply the appropriate Radius and Amount setting for each separate frequency range. Why just play with the treble, when you can also enrich the bass?

If the Smart Sharpening is subtle, then indeed, it will be softer or the same as the original image, however when the Smart Sharpening uses slightly less subtle Radius or Amount settings the result is not the same as simply blending the HF data into the original image.

Taking this further, one may use manual rounds of serial decomposition and deconvolution at decreasing blur scales, which allows for the fine tuning of intermediate frequency ranges.

I am not saying that I have made a better sharpening method, I just think that I have discovered a way to "tame" some of the issues with Smart Sharpen.

I will go back and do some more testing Dan, as I don't think that I have a good answer for you at this point.

Until then, the page is up with illustrations, at the foot of the page one can compare 7 images via radio buttons, which may help illustrate the concepts being discussed.

http: //members.ozemail.com.au/~binaryfx/smartersharpen.html

There is also an action, which may help illustrate the basic process.

http: //members.ozemail.com.au/~binaryfx/smarter_sharpen_v1.zip

When Smart Sharpen first came out I saw no use for it, for the
reasons you stated. If More Accurate is not checked the function is
identical to standard USM but it is rendered worthless by the
incomprehensible lack of a Threshold field. If More Accurate *is*
checked the function is very different and the sharpening is in some
ways superior. It is, however, hidden by so much other detritus that
again I felt that the lack of a Threshold was fatal.

I agree Dan, this is why I was excited by running the command on blurred data - rather than on regular data that may contain "detritus".

It all depends on the size of the blur, I have seen no real need to go beyond 3 pixels, and the best results are in the range from 0.2-1.5 pixels.

Your post has caused me to rethink that position. I can show how to
get the benefits that I think you are looking for (a combination of
the Gaussian Blur method and the Smart Sharpen Accurate method minus
the garbage) in an exceedingly flexible package. But before going off
on that tangent, I want to be sure I haven't misunderstood your
proposed procedure. So, I ask you to confirm that in the above-
mentioned step, your workflow still functions if I substitute a copy
of the original as the bottom layer rather than Smart Sharpening
something that has been blurred.

I think that you do understand this correctly Dan, however it all depends on the blur radius, the Smarter Sharpen Radius and Amount and how many times one decomposes/sharpens/recombines the image at different ranges.

Again, I am trying to make Smart Sharpen more useable and provide better results than by default. If this approach is better than regular sharpening or can create a better standard sharpening tool then that is fantastic.

Thanks for posting this thought-provoking procedure.

My pleasure Dan, I will be sure to get back with any later findings.

Regards,

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Stephen Marsh
Wed Dec 24, 2008 5:57 am (PST)

Dan Margulis wrote:

Here is where I am getting lost. If I understand this correctly,
having blurred the original on the bottom, you propose to un-blur it
by careful use of the Smart Sharpen filter. If that interpretation is
correct, I am flummoxed as to why one should chase his tail in this
fashion rather than simply replace the bottom layer with a copy of
the original. I don't see any step later for which the original would
not be just as suitable a bottom layer as a blurred and unblurred
version. And if that's so, then the entire method has nothing to do
with Smart Sharpen as such.

Dan, in reply to your question on why one would perform a Gaussian/Laplacian Decomposition - and then deconvolve the low frequency (Gaussian blurred) data, I have uploaded an image.

In the group's Photos section, I have created a directory titled "Smarter Sharpen Technique". Inside is a JPEG named "dans-question.jpg". This is a crop from the old Photodisc Test Image.

This file is cropped, it is 1:1 size, however it is a JPEG copy of a JPEG original (which was likely a TIFF from the original scanning back camera).

* On the left is the original cactus.

* In the centre is the result of an intermediate stage of the Smarter Sharpen technique, deconvolving the LF data with *no moves* applied to the HF data, except blending into the LF data to restore the original HF data. The centre image is sharper than the original, even though the only move was to Smart Sharpen the blurred LF data.

* On the right, is what happens when I replaced the Guassian LF data layer with a copy of the original, as you asked in your question.

All edits were performed using 16 bpc.

Both images have been sharpened with the same Smart Sharpen settings, however the result is very different between the centre (Smarter Sharpen) and the right (Smart Sharpen to orig data blended with HF data).

The Smarter Sharpen Technique relies upon Gaussian/Laplacian Decomposition. Instead of masking out high frequencies and deconvolving lower frequencies, this method does similar things by splitting frequency into separate components. Just as separating colour from tone is an important concept in colour work, isolating different frequencies for sharpening or deconvolution is also an important concept in sharpening.

If we simply create a HF data layer and blend it over the original "sharp" image in Linear Light blending mode at 100%, all that we have done is a band pass/high pass type layer blend - which is not new.

If we further decide to sharpen or deconvolve the lower original layer, then this compounds the previous Linear Light layer blend. This becomes a double sharpen move of all the image frequencies. This is not usually very pretty, as there is no threshold command.

Bi-Frequency Decomposition and Multi-Scale Bi-Frequency Decomposition acts like a threshold command and provides a known idealised PSF ready for deconvolution using the appropriate matching idealised PSF.

The Smarter Sharpen Technique is all about the LF data and the Smart Sharpen deconvolution, without the Gaussian/Laplacian Decomposition and without targeting the LF data for Decomposition, there would be less compelling reasons to use this method. The decomposed bi-frequency image is in a "neutral/null state", the changes that one makes to both the LF and the HF data decide the sharpness.

If we only decompose an image using a 0.3 pixel blur, the HF data has very fine detail, while the LF data also has fine detail...just not as fine as in the HF data layer. As we increase the blur scale, the LF data becomes less sharp, which starts to affect the overall tone more so than apparent edge sharpness.

Perhaps run my action, then cancel the action at the first Smart Sharpen step - then explore with variations of edits on the separated LF and HF data layers.

Regards,

Stephen Marsh.
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Dan Margulis
Fri Dec 26, 2008 1:26 pm (PST)

Stephen Marsh writes,

In the group's Photos section, I have created a directory titled
"Smarter Sharpen Technique". Inside is a JPEG named
"dans-question.jpg". This is a crop from the old Photodisc Test Image.

* On the left is the original cactus.

* In the centre is the result of an intermediate stage of the Smarter
Sharpen technique, deconvolving the LF data with *no moves* applied to
the HF data, except blending into the LF data to restore the original
HF data. The centre image is sharper than the original, even though
the only move was to Smart Sharpen the blurred LF data.

* On the right, is what happens when I replaced the Guassian LF data
layer with a copy of the original, as you asked in your question.

All edits were performed using 16 bpc.

Both images have been sharpened with the same Smart Sharpen settings,
however the result is very different between the centre (Smarter
Sharpen) and the right (Smart Sharpen to orig data blended with HF
data).

The second one (Smart Sharpening/More Accurate a previously blurred image, plus supplemental blending) definitely looks better than either of the other two. However, we have previously agreed that just applying SSMA to an unblurred image is better described as Lunatic Sharpening/Less Accurate, owing to the amount of garbage it introduces that the pre-blur avoids. So, what this comparison shows is that blurring followed by SSMA can achieve results 1) better than the original, and 2) better than how a crazy person would sharpen it.

The question instead needs to be whether the middle result can be exceeded by a sane person starting with an unblurred original. I've taken a look and have some tentative opinions.

The Smarter Sharpen Technique relies upon Gaussian/Laplacian
Decomposition. Instead of masking out high frequencies and
deconvolving lower frequencies, this method does similar things by
splitting frequency into separate components. Just as separating
colour from tone is an important concept in colour work, isolating
different frequencies for sharpening or deconvolution is also an
important concept in sharpening.

I am glad to know this, as otherwise I might have supposed that you were simply trying to treat fine detail differently from coarser stuff. ;-)

If we simply create a HF data layer and blend it over the original
"sharp" image in Linear Light blending mode at 100%, all that we have
done is a band pass/high pass type layer blend - which is not new.

Right. This is the traditional way of doing things. By starting your procedure in this fashion you are trying to have the best of both worlds. The halos that this layer will eventually produce have been shown by experience to be highly effective at bringing out certain types of detail. Your contention is that they can also destroy finer detail, or, alternatively, that the finer detail could be brought out in a less clunky fashion. The plain-English overview of what you propose is therefore as follows:

1) This Linear Light layer or something similar will be used, in ways yet to be determined, to emulate conventional sharpening.

2) In addition, a method will be developed, in ways yet to be determined, of getting a better sharpen of fine detail.

3) The two methods are to be brought together, in ways yet to be determined, to highlight the best features of both and create a more natural look.

The question I asked was about Step 2. I don't know what the right answer is, although I have some ideas. I am pretty clear, however, that what you are currently proposing is *not* the correct way of proceeding, in that at least one alternative would be clearly better in almost all circumstances. I believe that the problem may be that you are insisting on logical symmetry in an area where it is not required.

The specific implementation you are advocating is relatively new, but the idea of sharpening differently in areas with different characteristics is not. Generating light and dark halos with different characteristics dates from the early 1980s. Having sharpening vary with image darkness, or in areas where there are many areas of strong edges, are ideas I introduced in the mid-1990s. All these practices are now well established. I've also suggested discriminating in sharpening based on how colorful and area is. Others have previously suggested discriminating in small detail between relatively coarse and fine, as this method does. In a message to Jacob recently I suggested discriminating in sharpening based on the amount of sharpening being done, that is, by emphasizing areas that would ordinarily be sharpened moderately as opposed to strongly. None of these last three concepts is fully established yet.

None of these two-step ideas require any kind of symmetry. For example, if we have decided to treat lightening halos differently from darkening ones we don't have to base them on the same blur, or even the same sharpening method. It may be *convenient* to do so because it saves an extra step, but it is probably not optimal.

Similarly, here your first step is to blur the bottom layer and use it to generate a Linear Light layer, whereupon efforts will be made to improve each independently. You are at pains to point out that, prior to these additional steps, although the two layers are very different, summing them yields something pixel-for-pixel identical to the original image--you've divided it into two halves, as it were.

For those wishing to understand how sharpening works it's useful to know why this is occurring, however, it is not necessary, or even relevant, to what comes next. The idea is to use these two layers to make a distinct improvement in the picture--not to match what we had originally. Provided the two layers serve their purposes, it doesn't matter whether they're a matched pair. Here, in fact, I think it's clear that they should *not* be.

When sharpening once for coarse and once for fine detail, the Radii should not be the same--the coarse detail wants a significantly higher Radius, maybe even twice as much, but half again as much certainly. The best of the three methods you show involves using SSMA on a blurred version, but the blur was at the Radius needed to make the coarse halos that will be used later. It seems to me that in all circumstances a better alternative would be to discard the blurred version, start with a new original, blur it at a lower Radius, and then resharpen SSMA using the lower Radius.

If you agree that there is a strong case for starting with a new original, then other options need to be compared, in addition to blurring followed by SSMA. The obvious alternative is running the standard USM filter at a low radius, followed by a reduction of lightening halos. If the SSMA method is used, in addition to blur followed by SSMA, we'd also need to consider *partial* blur then SSMA (and if we decide that partial blur is best, whether the Radius should be the high one used originally, or the low one like that being used in SSMA, and if the latter, whether the blur Radius should match the SSMA Radius exactly or whether we are better off if their is a slight mismatch), SSMA *followed* by a blur or partial blur, the use of some blurring method other than Gblur, the use of some type of difference mask, etc.

If we further decide to sharpen or deconvolve the lower original
layer, then this compounds the previous Linear Light layer blend. This
becomes a double sharpen move of all the image frequencies. This is
not usually very pretty, as there is no threshold command.

One can be arranged. After watching several expert sharpeners do their thing in the advanced classes last month, I got tired both of the deficiencies of the USM filter and having to constantly add extra steps, so I wrote an Action that gives a pleasing sharpen without intervention, but also has the flexibility that conventional methods don't, namely: width of light and dark halos computed independently and strength variable by user; threshold operation that allows either Photoshop traditional (increasing Threshold eliminates small sharpens totally but also decreases sharpening everywhere), elimination of weak sharpening without affecting strong sharpening, and a counter-threshold that weakens the strongest sharpens; automatically generated masks (which can be modified or deleted) to keep sharpening away from strongly colored areas such as skies, and hiraloam for both luminosity and color.

I was planning to intro that for comment in the March superadvanced course, but the Action (RGB only, sorry) is ready, if undocumented. Since it has a threshold that can exclude any arbitrary amount of light sharpening without weakening strong sharpening, it might mesh well with what you are proposing. If you are interested I can send it offline or post it in the files section.

Meanwhile, I took a look at some of your possible variants. I was very surprised to hear your view that a previous blur might improve the performance of SSMA, but it seems to be true. I tried several different blurring methods followed by SSMA at Radii of .8-1.0 and found as follows (warning, not enough trials to make these results anything more than tentative):

*I had good results with Gaussian Blur, then Fade>50%, then SSMA at the same Radius, 500% Amount. Substituting Dust & Scratches for Gaussian Blur was very slightly worse, not enough to concern us. Substituting Surface Blur for Gaussian Blur was not successful.

*I did not test using any Gblur Radius other than an exact match to the SSMA.

*I compared Gblur>Fade 50%>SSMA to SSMA>Gblur>Fade 50% and was surprised to find that they were almost identical. No preference for either method.

*Since an advance blur appears to work well with SSMA, I tested whether it might also be beneficial for the conventional USM filter. Result: as far as I can tell a previous blur works only with SSMA and is worse than useless for conventional USM.

*I compared Gblur>Fade 50%>SSMA to conventional USM at a slightly smaller Radius, taking full advantage of the Threshold command, and restricting lightening halos. In most cases there wasn't much difference, but where there were large areas with subtle detail variation the SSMA method was better, with some exceptions.

*One of the images I tested featured a lot of the type of subtle detail one would try to enhance, as well as some that one wouldn't. It contained areas of wood grain in processed boards, evergreen trees with thick foliage, a defocused mountain background, and a sky in which it was easy to bring out unwanted noise. The SSMA method did better in the first three, but badly in the sky. There, the Threshold of conventional USM saved the day. So, in this type of image the SSMA method works better but only with extra steps, otherwise is worse.

*The SSMA method was most successful in dealing with an image of old Quebec city. Ancient lightly-colored stucco buildings featured lots of areas of little tonal variation, as did sidewalks and road, and no sky to cause a problem. Conventional USM looked clunky in comparison.

While I did see the technical superiority with certain images, I have to say that so far it would only be likely to be visible at poster size, which makes it useful enough for some people. I hope you will
be able to find further improvements.

Bi-Frequency Decomposition and Multi-Scale Bi-Frequency Decomposition
acts like a threshold command and provides a known idealised PSF ready
for deconvolution using the appropriate matching idealised PSF.

All well and good if the picture looks better afterward. Otherwise they're a gang of syllables serving a lost cause.

These issues, however, certainly need to be explored and I hope that everyone appreciates the effort that went behind your posting and into developing these innovative suggestions.

Dan Margulis
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: "John Bongiovanni"
Fri Dec 26, 2008 7:48 pm (PST)

Dan Margulis wrote:

Meanwhile, I took a look at some of your possible variants. I was
very surprised to hear your view that a previous blur might improve
the performance of SSMA, but it seems to be true.

I've been brushing up on my real analysis (at amost 40 years distance) to try to understand what's going on here, and I may have stumbled on why this is the case. Stephen probably knows this already.

There are two things going on in Stephen's method, which can be separated. One is the sharpening of the high-frequency component, and the other is sharpening of the low-frequency component and blending the two together. Let's focus on the HF component for a second.

The layer structure at this point is this:

HF layer constructed with a subtraction mode and some scaling parameters in linear light mode
LF layer blurred

Because of the subtraction mode, the composition of the HF layer depends on the blurring of the LF layer (if you didn't do it, you'd be operating on something different). The mathematics of the GB are in fact what creates the HF layer.

None of this implies that the next step needs to be a sharpening of the LF layer and merging with the sharpened HF layer. Some other LF sharpening is certainly possible.

John Bongiovanni
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: Davide Barranca
Sat Dec 27, 2008 4:17 pm (PST)

John Ruttenberg wrote:

I would love to see examples.

Dear John,
I'm currently starting to write my notes on sharpening, I'll put online a webpage with examples and walkthrough - I hope to be able to work on it during the holydays, even though I suspect my wife's plans are very different (in Italy you're supposed to do a lot of cooking and visit large number of relatives)

My best wishes for the holyday season to all the group members,

Davide Barranca
Bologna, Italy
___________________________________________________________________________

Re: The reverse threshold method (was proper "sharpening" at all sca
Posted by: George Machen
Thu Jan 1, 2009 5:24 pm (PST)

I have uploaded to the Files section, "Texture-mostly_USM.zip"

It is a layered TIF file that should serve to illustrate what's been discussed in this thread about sharpening *texture*, that is, seeking a USM "Reverse Threshold" maneuver to target sharpening at weaker edges/detail, while increasingly to avoid sharpening approaching hard edges.

The lowest layer displays an idealized sliding edge, ranging comprehensively from maximum to none. It is just a gradient from black-to-white, then cloned and unfolded upward. It shows a maximum-possible edge on the left, progressively decreasing to no distinction whatsoever on the right. "Texture," or mid-edge-strength detail, occurs from approximately the center of the image rightward until it disappears completely at the zero-contrast right side. This image helps visualize the effects of sharpening, blurring, and various operations upon thereof.

If you look at the Layers palette, you can see what I've done:
- Duplicated the basic sliding-edge layer and sharpened it with large Amount & Radius so it's
easy to see what's happening.
- Temporarily set that dupe sharpened layer's Blending Mode to Difference in order to obtain the absolute value of the subtraction of the original layer from the sharpened layer.
- Merged Visible into a new scratch/working layer (Shift-Option/Alt-Comand/Ctrl-E), then Auto Levels.
- Returned the second, sharpened layer back to Normal mode, added a Layer Mask, then Applied Image: the scratch layer Difference image to that Layer Mask. That's our "Reverse Threshold" mask! (I'd say we don't need to blur the Layer Mask as we customarily do, for you can see that it's already blurred due to USM's underlying Gaussian Blur.)
- Then lastly did the usual duplication of the original layer over the sharpened layer in Darken mode @ 50% Opacity, to reign-in the more objectionable lightening halos.
- Shift-clicking the Layer Mask icon to toggle it on-and-off reveals the gradual reduction of sharpening toward the harder-edge range to the left, with dominating confinement of the sharpening about the texture range from the middle rightward.

I think this procedure captures the crux of Dan's earlier recipe, although mine only helps visualize a one-pass sharpen - Dan's mask kills the multi-pass sharpening at the hardest edges. And I think the number of steps can be reduced by putting-off to last making the Darken layer dealing with the lightening halos; at least I'm presuming it "commutes" and doesn't matter in which order it's performed.

I didn't invert my Difference layer mask like Dan did - I can't figure out whether we're both right.

Memo: I find it interesting in viewing the scratch Difference layer that while the radius of the sharpening increases as the edge becomes more pronounced (leftward) - which is the criticism leveled against Gaussian Blur-based USM ("Why sharpen areas already so distinct?"), ...
nevertheless, the most *visually-apparent-contrasting* amount of sharpening gets maximized in the mid-to-lighter texture area: between the image's middle and right side, precisely where we want it in the first place! (But the very softest, most rightmost edges undesirably get slightly reduced sharpening, too; my guess is that disadvantage must be an artifact of the Gaussian Blur.) So I conclude that the halos we so deplore are more apparent than real (simultaneous contrast).

Obligatory disclaimer: Of course, this idealized model using computer-generated art is conceptual/illustrative only; as with real-life images in other respects, complexities/exceptions to the general rules surely abound, as the appearance of sharpening often changes with an image's individuality, such as:
- the context in which objects occur
- what the image's significant subjectmatter of interest is
- the human perceptual phenomenon of simultaneous contrast

- George Machen
___________________________________________________________________________ .

Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: Dan Margulis
Mon Jan 5, 2009 3:56 pm (PST)

On 26 December, in the middle of a long reply to Stephen Marsh, I mentioned that I had a sharpening Action that allows considerably more flexibility in adjustments than existing filters do. To my surprise, about a dozen people contacted me offline asking for a copy.

This would likely not have done anybody any good, because there was no documentation for what the Action does--the only person who uses it currently is me, and I don't need documentation.

Anyhow, I did write the documentation up and distributed it and the Action to two list members, who suggested some useful clarifications. I've now posted everything to the files section,
http://tech.groups.yahoo.com/group/colortheory/files

Name: Margulis_sharpen_010509.zip

It's self-explanatory, I think, but a couple of hints:

1) I wrote this for flexibility, but also as a batch processor--that is, as a way of sharpening a whole bunch of 15-30 mb images sight unseen. Consequently, you're more likely to want something stronger than the default setting than less.

2) I wanted the Action to run without pause, so certain steps are not user-definable. The one that has the most impact is the Radius setting. As the Action stands, it takes five extra steps to alter the Radius. Fortunately, there's enough other stuff available that it's ordinarily not an issue. When I am working on an image of extreme importance, I don't use this Action. However, it would be easy to make an alternate version that prompted us to enter a Radius each time.

3) Both of the people who tested it discovered that turning on pre-sharpening either in- camera or in an acquisition module is a dubious practice. This Action can in fact cope with presharpened images (see documentation) but one is much better off not presharpening in the first place. Those who have presharpening turned on in their raw module might be interested to test a couple of images both ways, followed by this Action.

I'll leave the Action posted for a couple of weeks for comment. Presumably the documentaition is lacking in certain areas. When the thing is more or less finalized I'll post a new version at ledet.com.

Dan Margulis
Applied Color Theory in Photoshop
___________________________________________________________________________ .

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: "Wai-hong Chung"
Tue Jan 6, 2009 11:39 am (PST)

Hi Dan,

I currently use a Sony A900 DSLR which has a resolution of 24.6 Mega Pixels. Is your Action appropriate for such resolution or do I have to increase the radius ? If I've to increase the radius, by how much do I have to raise?

Thank you very much in advance!

Kindest regards,
Chung Wai Hong from Hong Kong
___________________________________________________________________________ .

Sharpening again [was: Re: Group losing its rudder (was: New Smarter
Posted by: John Ruttenberg
Tue Jan 6, 2009 11:39 am (PST)

George Machen:

Or take new-member Jacob Rus: In his very first post here he candidly
admitted that he hasn't read the first thing of Dan's books. Now this is one
smart young man, whose presence on this list already has broken new ground,
and he shows promise of continuing rapid development among us. But as I
ventured in Message #20698, my (admittedly hair-trigger) "Calibrationalist
radar" went off in connection with, for example, his approach of what
appeared to me a one-size-fits-all procedure of multiple radius sharpening,
without regard for the individuality of an image, where on some, undesirable
emphasis might be brought out. Differently-targeted corrections to images
with separate significant subjectmatters is one of the big things this group
is all about, and with more familiarity of Dan's books, Jacob would gain the
inestimable advantage of not being drawn to "the dark side," as trapped so
many scientifically-minded prodigies, only to end up foisting user-hostile
technologies on people who work for a living and have to use them. (Or not
to mention government economists who hose the financial system!)

There are two really exciting possibilities that promised by Jacob's sharpening ideas:

1. One size fits all would make it much easier to apply to all images (though Jacob is quick to point out that there is an art to choosing the opacity of each radius, one based on the image.)

2. Even within a single image, there are issues. What about the cross country skiers in front of the winter forest. Sharpen for the skiers and the branches of the trees and bushes are way over the top with visible halos. And of course you don't want to sharpen for the background at the expense of the subject. As Dan says, it's selectionville (maybe not the worst solution in this case.) Dig around through the channels to try to find an approriate target or mask? Sometimes that works. But a better underlying sharpening algorithm holds the promise of just plain better results in cases like these.

-- John Ruttenberg
___________________________________________________________________________ .
.
Sharpening again [was: Re: Group losing its rudder (was: New Smarter
Posted by: George Machen
Tue Jan 6, 2009 3:12 pm (PST)

I remain dubious in general about procedures that promise auto-anything, for they all too often turn out to be auto-stupid.

Yes, as Rutt pointed out, Jacob commendably acknowledged the wisdom of taking into account the individuality of an image's significant subjectmatter. But with the particular example cited here, I nevertheless fear that reducing the opacities of all of those multiple-sharpening iterations even to the most minimal levels still would leave a state of presharpening that could pose problems of which we all are only to well aware. (Unduly emphasizing noise & other artifacts, thwarting further corrections, etc.)

We usually perform conventional sharpening before hiraloam, because doing hiraloam first would constitute a presharpening risky for subsequent low-radius USM. (Except when faces are the significant interest subject, when we first do hiraloam, than only afterward USM in the black channel only - possibly with a Luminosity mask for darker skins.) Similarly, all of this multi-pass sharpening, no matter the low opacities & variable radii, seem to me cruisin' for a bruisin'.

The other aspect that concerns me is that we don't always want to maximize sharpening at all scales, just because we can. These multiple-sharpening iterations are tantamount to multi-pass hiraloam. This strikes me as taunting random undesirable emphasis, because of the way we do hiraloam: We temporarily crank up to a ludicrous USM Amount so we can see what we're doing, then adjust the Radius until we visually obtain good shaping and modeling. The operative phrase is "shaping and modeling." Too much or too little harms the effect, and that's what risks being randomly introduced by the uniform sequence of multiple-sharpening iterations.

For example, in faces, allowing more than one radius iteration could close a person's eyes, create plugging in the hair, accentuate bags under the eyes, etc.

Hiraloam thus inherently is one-pass. (Even if it's applied differently to separate masked areas, as Rutt suggests, still within each given area, I'd think that more than one pass would be counterproductive

The upshot is that this one-size-fits-all approach may end up tending to forsake the individuality of an image, despite any good intentions otherwise.

- George Machen
___________________________________________________________________________ .

Re: Sharpening again [was: Re: Group losing its rudder
Posted by: Jacob Rus
Tue Jan 6, 2009 8:13 pm (PST)

George Machen wrote:

I remain dubious in general about procedures that
promise auto-anything, for they all too often turn
out to be auto-stupid.

Hear, hear.

cited here, I nevertheless fear that reducing the
opacities of all of those multiple-sharpening
iterations even to the most minimal levels still
would leave a state of presharpening that could
pose problems of which we all are only to well
aware. (Unduly emphasizing noise & other
artifacts, thwarting further corrections, etc.)

I think I'd suggest finding the difference masks of original - gaussian blurred (or otherwise blurred) versions at different values of ó, and then applying those differences in varying amounts (I'm still experimenting, especially with the surface blur tool), so there's really no problem here of multiple sharpening iterations degrading the image as steps go through.

We usually perform conventional sharpening before
hiraloam, because doing hiraloam first would
constitute a presharpening risky for subsequent
low-radius USM.

Do you have any examples of this having an undesirable impact? The idea of "hiraloam" is that nearby pixels are pushed in approximately the same direction, except at edges of very large shapes, so I'd guess the impact on subsequent sharpening passes, especially if a curve is applied to limit the effect in very-high-contrast areas, would be minimal, perhaps even beneficial.

Similarly, all of this
multi-pass sharpening, no matter the low
opacities & variable radii, seem to me cruisin'
for a bruisin'.

Only if the amounts aren't adjusted to take it into account, and if the difference layers aren't carefully adjusted.

The other aspect that concerns me is that we
don't always want to maximize sharpening at all
scales, just because we can.

Who said we did?

we do hiraloam: We temporarily crank up to a
ludicrous USM Amount so we can see what we're
doing, then adjust the Radius until we visually
obtain good shaping and modeling. The operative
phrase is "shaping and modeling." Too much or too
little harms the effect, and that's what risks
being randomly introduced by the uniform sequence
of multiple-sharpening iterations.

It can't just be a uniform sequence. That's far too inflexible.

Cheers,
Jacob Rus
___________________________________________________________________________ .

Notes on sharpening
Posted by: "Davide Barranca"
Tue Jan 6, 2009 3:11 pm (PST)

Dear group,

I've finally managed to put together some webpages with theory and applications (and quite a lot of examples, pictures and screenshots) on most of my recent findings on the subject of sharpening. For those interested in the topic, the main features are:

Sharpening with Gaussian and edge-aware blurring kernels. A new experimental approach on High-Radius Low-Amount sharpening. How to separately target edges and texture (in the same high frequency range). Gaussian, Bilateral and Mixed pyramid decompositions: efficient platforms on the top of which new sharpening strategies can be developed.

It's a work in progress, so chances are I'll be refining the content depending on the feedbacks (always welcome). You can find it at:

http: //www.bigano.com/index.php/consulting/40-davide-barranca/90-davide-barranca-notes-on-sharpening.html?lang= en

I hope it could add something to the already interesting discussion about sharpening.

A quick note for the italian readers: although the entire website that hosts the article comes in two languages (english and italian), you'll find english version of "Notes on sharpening" in the italian side also. I've first written in english, and now I'm translating (tougher job than expected - in a couple of weeks it should be online the italian version as well). Kind regards,

Davide Barranca
Bologna, Italy
___________________________________________________________________________ .

Re: Notes on sharpening
Posted by: "Jim Mantock"
Wed Jan 7, 2009 4:01 am (PST)

Davide,

A patent was granted in the radiology area that has several of the elements in your and others discussions

http: //www.patentstorm.us/patents/6035071/fulltext.html

Someone thought enough of this approach to go through the hassle and expense of a patent.

Regards,
Jim Mantock
___________________________________________________________________________ .

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: Dan Margulis
Wed Jan 7, 2009 6:22 am (PST)

On Jan 6, 2009, at 1:11 AM, Wai-hong Chung wrote:

I currently use a Sony A900 DSLR which has a resolution of 24.6
Mega Pixels. Is your Action appropriate for such resolution or do I
have to increase the radius ? If I've to increase the radius, by
how much do I have to raise?

If you would like to be able to pick the Radius on a per-image basis, you can program a Stop into the Action.

If, like me, you would prefer to give up that flexibility in favor of an Action that requires no intervention, then I believe you're asking the wrong person. Optimal Radius depends more on the image than it does on the resolution, but we are talking about a single setting that would be used on all images. Judgment of sharpening is very subjective and there are few correct answers. So I would say you should try a few values and choose the one that looks good to you, rather than one that looks good to me, because we may not agree.

If you wish to test alternate Radii within this Action, here is the procedure. When you are satisfied as to what the Radius should be, you can edit the Action to insert it.

1. Place two copies of the original background layer between the background and the dark halos layer. I will call these Layer 1 (background) 2 and 3 (copies) and 4 (Dark Halos).

2) On Layer 2, Gaussian Blur, your desired Radius.

3) On Layer 3, Apply Image, source=Layer 2, Channel= RGB, mode=Subtract, Opacity=100%, Scale=1, Offset=128.

3) Still on Layer 3, Apply Image, source=Layer 3, Channel=RGB, mode=Overlay, Opacity=100%

4) Repeat step 3 two more times.

5) On Layer 4, Apply Image, source=Layer 3, Channel= RGB, mode=Normal, Opacity=100%.

6) Discard Layers 2 and 3.

The above takes care of dark halos. If you want the light halos at a smaller Radius, which I think is recommendable, repeat the procedure substituting Layer 5 for Layer 4. When satisfied with your new Radii you can edit the Action to insert them.

Dan Margulis
___________________________________________________________________________ .

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: "Iliah Borg"
Wed Jan 7, 2009 8:05 am (PST)

Dear Wai-hong Chung,

I currently use a Sony A900 DSLR which has a resolution of 24.6 Mega
Pixels.

No, it is pixel count only. Pixel count does not equal resolution. Not only the anti-alias filter found in front of your sensor decrease resolution, but it also depends on the aperture you are shooting with (including diffraction effect), tripod, remote, lens, filter on your lens, micro-lenses on the sensor, etc. It also highly depends on the raw converter you use.

The sharpening is set depending on how sharp is particular shot, not on megapixel count, which is rather meaningless theoretical number that gives you nothing more but Nyquist frequency.

The best you can do IMHO is to sort through the shots, group them based on sharpness and other criteria, and set parameters separately for each group.

--
Best regards,
Iliah Borg
___________________________________________________________________________ .
.
Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: "Wai-hong Chung"
Wed Jan 7, 2009 8:06 am (PST)

Its really too difficult for me. Give me some times to understand this! Anyway, thanks very much indeed! I may ask you again later. Please put up with me.

Wai-hong Chung
___________________________________________________________________________ .
.
Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: "d.butscher"
Wed Jan 7, 2009 12:57 pm (PST)

is it right step 5 mode=normal? i think it is overlay.

dieter butscher
___________________________________________________________________________ .

Sharpening again [was: Re: Group losing its rudder (was: New Smarter
Posted by: George Machen
Wed Jan 7, 2009 8:08 am (PST)

Jacob Rus:

I think I'd suggest finding the difference masks
of original - gaussian blurred (or otherwise
blurred) versions at different values of ó, and
then applying those differences in varying
amounts (I'm still experimenting, especially with
the surface blur tool), so there's really no
problem here of multiple sharpening iterations
degrading the image as steps go through.

Your suggestion operationally appears to me just essentially a restatement of the original procedure of applying multiple passes of USM at various Amounts & Radii. But my point was not that doing so *itself* was what necessarily introduces degradation (although I still think it often would), but rather that the end-product constitutes a presharpening that throws a monkey wrench into subsequent corrections.

Do you have any examples of this having an
undesirable impact?

Jacob, please don't take this the wrong way, but I might gently (and with affection) suggest that this is an example of where you may be at a disadvantage on this list without first being conversant in Dan's _Professional Photoshop Fifth Edition_, where this issue is discussed extensively with numerous examples. (Maybe you should make it a priority over his Lab book, which you mentioned that you finally have perused and for which you are preparing a review.) Most color correction professionals here are well-aware of the perils of correcting presharpened images and really don't need any examples. So I guess I'll leave it as an exercise to yourself.

Similarly, all of this multi-pass sharpening, no
matter the low opacities & variable radii, seem
to me cruisin' for a bruisin'.

Only if the amounts aren't adjusted to take it
into account, and if the difference layers aren't
carefully adjusted.

The point made in Dan's books and by others over the years on this list is that even the slight presharpening posed even by your claimed compensating adjustments - including "capture sharpening" - prove problematic for many of the high-stress moves we do around here, e.g., the Picture Postcard workflow.

The other aspect that concerns me is that we
don't always want to maximize sharpening at all
scales, just because we can.

Who said we did?

Unless I'm misconstruing something, seems to me that you largely did in your Message #20711 with the Dorothea Lange "Migrant Mother" image, no?

It can't just be a uniform sequence. That's far too inflexible.

Just to be clear, my concern is that uniform or not, I don't see how all the "careful adjustments" in the world - of amounts, difference layers or anything else - don't leave a residue of presharpening to reduce our options for further corrections.

Please let me convey, Jacob, that your participation on the list has proven profitable surely for us all and is appreciated by myself at least.

- George Machen
___________________________________________________________________________

Re: Sharpening again [was: Re: Group losing its rudder (was: New Sma
Posted by: Jacob Rus
Wed Jan 7, 2009 12:56 pm (PST)

Hi George (and list),

I hope I don't come off as defensive: that's not the tone I'm going for. I'm just trying to clarify my goals, which I don't think are as at-odds with yours as you might think.

Your suggestion operationally appears to me just
essentially a restatement of the original
procedure of applying multiple passes of USM at
various Amounts & Radii.

No. Instead, separate unsharp masks are created for each scale, on their own separate linear-light-mode layers, meaning that the effect is summed, but there is no interaction between them. I.e. the second unsharp mask step is not affected by the first, though ultimately both are applied to the image. This is different from using the unsharp mask tool several times in succession on a single layer.

the end-product constitutes a presharpening that
throws a monkey wrench into subsequent
corrections.

Well, that really depends.

Jacob, please don't take this the wrong way,
but [...] you may be at a
disadvantage on this list without first being
conversant in Dan's _Professional Photoshop Fifth
Edition_, where this issue is discussed
extensively with numerous examples.

Examples of "hiraloam" sharpening first causing problems with subsequent "conventional" sharpening afterwards? Okay, I'll try to track down a copy and take a look. (I did read the "sharpening with a stiletto" chapter which is available as an example chapter online. But there is another chapter or two on the subject later in the book, I think.)

The point made in Dan's books and by others over
the years on this list is that even the slight
presharpening posed even by your claimed
compensating adjustments - including "capture
sharpening" - prove problematic for many of the
high-stress moves we do around here, e.g., the
Picture Postcard workflow.

In that case, put the unsharp masks on top and leave them out of said "high-stress moves". (I personally do most global corrections first before dealing with local-contrast adjustment, but since the two are on separate layers, I can alter the two independently without much trouble.)

The other aspect that concerns me is that we
don't always want to maximize sharpening at all
scales, just because we can.

Who said we did?

Unless I'm misconstruing something, seems to me
that you largely did in your Message #20711 with
the Dorothea Lange "Migrant Mother" image, no?

No. I said we want to have control over the amount of local contrast at each scale, so that we can decide which we would like to "sharpen" and which we would like to "blur", without choosing only a particular gaussian function per image. Every image demands different treatment, and different artists have different photographic visualizations even of the same physical scene. It's highly subjective and personal.

Just to be clear, my concern is that uniform or
not, I don't see how all the "careful adjustments"
in the world - of amounts, difference layers or
anything else - don't leave a residue of
presharpening to reduce our options for further
corrections.

So either (a) put the changes on a separate layer, or (b) do your other corrections first.

Cheers,
Jacob Rus
___________________________________________________________________________ .

Re: Sharpening again [was: Re: Group losing its rudder (was: New Sma
Posted by: Dan Margulis
Wed Jan 7, 2009 4:08 pm (PST)

George Machen writes,

I remain dubious in general about procedures that
promise auto-anything, for they all too often turn
out to be auto-stupid.

As a general rule that's true, OTOH there are a couple of major exceptions.

1) Not every image is worth spending a lot of time on. If you can't afford to spend 15 seconds to correct an image, Auto Levels is a useful command. If you can't afford to spend a minute optimizing sharpening, you need a one-size-fits-all method. Or, while admitting that handwork would technically be better, you could just conclude that the auto method is good enough. I use a single setting for Shadow/Highlight, for example, not because I couldn't find a better one on an image-by-image basis, but because the gain in doing so is small.

2) Admitting that auto-something commands are probably not going to be as good as hand adjustments, it can be extremely useful to figure out why they work even as well as they do. In a parallel thread the question has come up about setting light and dark points. A lot of light can be cast on that by asking the question, "Why does Auto Levels generally work, and under what circumstances does it *not* work?"

We usually perform conventional sharpening before
hiraloam, because doing hiraloam first would
constitute a presharpening risky for subsequent
low-radius USM. (Except when faces are the
significant interest subject, when we first do
USM in the black channel only - possibly with a
Luminosity mask for darker skins - then only
afterward any hiraloam.) Similarly, all of this
multi-pass sharpening, no matter the low
opacities & variable radii, seem to me cruisin'
for a bruisin'.

That is true when there is actually double-sharpening going on. I think, however, that none of the methods being discussed here do that. My Action, and I think everybody else's suggestions as well, involves merging separate sharpens of unsharpened images. That's very different from presharpening in camera or an acquisition module, and then trying to sharpen again in Photoshop.

The other aspect that concerns me is that we
don't always want to maximize sharpening at all
scales, just because we can. These
multiple-sharpening iterations are tantamount to
multi-pass hiraloam. This strikes me as taunting
random undesirable emphasis, because of the way
we do hiraloam: We temporarily crank up to a
ludicrous USM Amount so we can see what we're
doing, then adjust the Radius until we visually
obtain good shaping and modeling. The operative
phrase is "shaping and modeling." Too much or too
little harms the effect, and that's what risks
being randomly introduced by the uniform sequence
of multiple-sharpening iterations.

I believe that's probably correct, but there would be one way to find out: set up one of those auto-somethings that apply it to a whole lot of images sight unseen, and then compare it to an auto-something on the same images using a single Radius. Having tried out a lot of similar things that I thought would improve hiraloam, about the only ones that made a significant difference were doing it through a luminosity mask and also reducing light halos. Different methods of blurring have, for me, gotten a result that's infinitesimally better at the cost of a great deal of time.

Dan Margulis
___________________________________________________________________________

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: "Jim Mantock"
Thu Jan 8, 2009 1:56 am (PST)

Dan,

In creating the batch mode action, at the end of the sharpening process what was your printing intent, e.g. high quality ink jets, magazines, newspaper...?

Regards,
Jim Mantock
___________________________________________________________________________

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: Dan Margulis
Thu Jan 8, 2009 5:03 am (PST)

Dieter writes,

If you wish to test alternate Radii within this Action, here is the
procedure. When you are satisfied as to what the Radius should be,
you can edit the Action to insert it.

1. Place two copies of the original background layer between the
background and the dark halos layer. I will call these Layer 1
(background) 2 and 3 (copies) and 4 (Dark Halos).

2) On Layer 2, Gaussian Blur, your desired Radius.

3) On Layer 3, Apply Image, source=Layer 2, Channel= RGB,
mode=Subtract, Opacity=100%, Scale=1, Offset=128.

3) Still on Layer 3, Apply Image, source=Layer 3, Channel=RGB,
mode=Overlay, Opacity=100%

4) Repeat step 3 two more times.

5) On Layer 4, Apply Image, source=Layer 3, Channel= RGB, mode=Normal,
Opacity=100%.

6) Discard Layers 2 and 3.

The above takes care of dark halos. If you want the light halos at a
smaller Radius, which I think is recommendable, repeat the procedure
substituting Layer 5 for Layer 4. When satisfied with your new Radii
you can edit the Action to insert them.

dear dan

is it right step 5 mode=normal? i think it is overlay.

Mode=Normal is correct. Layer 4's mode is already overlay, but that doesn't change when we replace the layer.

Using overlay on the blend would result in two sets of halos, one at the original Radius of my Action and the other at the new Radius. The objective, instead, is to have only the new set.

Dan Margulis
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Stephen Marsh
Thu Jan 8, 2009 2:03 am (PST)

Reply to message #20799

Dear Dan and Group Members, a Happy New Year to you all! Sorry for the delay in reply Dan, I have been on end of year holiday, however I am now back to my regular schedule. Thank you for the long replies Dan, it is appreciated.

Regarding the initial cactus sample upload to the ACT list, Dan wrote:

The question instead needs to be whether the middle result can be
exceeded by a sane person starting with an unblurred original. I've
taken a look and have some tentative opinions.

Agreed Dan, that image was just to show the effect of the blur vs. not blurring with the same SS settings – as you state, a different example would be standard/default use of the Smart Sharpen filter vs. the Smarter Sharpen frequency decomposition technique that I am exploring. This would be more subjective although not impossible to demonstrate, as different SS settings would be required.

Again, I was looking at ways to make SS more usable than in the default form, I was not saying that one could not get better results using other different methods with SS or that USM was inferior at sharpening an image. Deconvolution and sharpening are two very different things – however it all depends on the “focus” of the original image on whether one will actually see these differences.

I wrote:
The Smarter Sharpen Technique relies upon Gaussian/Laplacian
Decomposition. Instead of masking out high frequencies and
deconvolving lower frequencies, this method does similar things by
splitting frequency into separate components. Just as separating
colour from tone is an important concept in colour work, isolating
different frequencies for sharpening or deconvolution is also an
important concept in sharpening.

Dan replied:
I am glad to know this, as otherwise I might have supposed that you
were simply trying to treat fine detail differently from coarser stuff. ;-)

Haha, thanks for the chuckle Dan! That was more for other list members that may have been lost.

That is of course what is taking place. Most would do this with a mask or selection. I think that separating/decomposing an image is a viable method to do similar things as what most would do with a mask. Perhaps I am just enamoured with a method that is more trivial when used in Photoshop (image decomposition).

Decomposing an image has existed for decades in other areas of image processing and this concept has found successful use in exposure blending, panorama stitching, HDR tone mapping and multi-scale sharpening/tone manipulation. These are not trivial issues, so the concept does seem to work in other applications. How well it works in Photoshop is another matter.

I am not sure how wavelet based frequency USM tools work, however I would not be surprised if something similar to Guassian/Laplacian Decomposition is used. I am not an IP student or anythying, just a prepress operator.

Meanwhile, I took a look at some of your possible variants. I was
very surprised to hear your view that a previous blur might improve
the performance of SSMA, but it seems to be true. I tried several
different blurring methods followed by SSMA at Radii of .8-1.0 and
found as follows (warning, not enough trials to make these results
anything more than tentative):

*I had good results with Gaussian Blur, then Fade>50%, then SSMA at
the same Radius, 500% Amount. Substituting Dust & Scratches for
Gaussian Blur was very slightly worse, not enough to concern us.
Substituting Surface Blur for Gaussian Blur was not successful.

Agreed, as I originally stated, this is to do with the Point Spread Function (PSF), which is critical for successful deconvolution. If the PSF model does not match the image blur, then it will not do a good job and may introduce artifacts. This means that the PSF type and other variables should be as close as possible to the image blur. This is far from trivial in the real world, where the image blur may be far from ideal or the model used in the chosen algorithm.

*I compared Gblur>Fade 50%>SSMA to conventional USM at a slightly
smaller Radius, taking full advantage of the Threshold command, and
restricting lightening halos. In most cases there wasn't much
difference, but where there were large areas with subtle detail
variation the SSMA method was better, with some exceptions.

The USM filter is good, I am not sure if SSMA is better for an image which is in focus. For an image that is not tack sharp, the case for deconvolution is stronger.

*One of the images I tested featured a lot of the type of subtle
detail one would try to enhance, as well as some that one wouldn't.
It contained areas of wood grain in processed boards, evergreen trees
with thick foliage, a defocused mountain background, and a sky in
which it was easy to bring out unwanted noise. The SSMA method did
better in the first three, but badly in the sky. There, the Threshold
of conventional USM saved the day. So, in this type of image the SSMA
method works better but only with extra steps, otherwise is worse.

This is perhaps why other developers use a threshold in their
deconvolution tools.

While I did see the technical superiority with certain images, I have
to say that so far it would only be likely to be visible at poster
size, which makes it useful enough for some people. I hope you will
be able to find further improvements.

As I have tried to make clear, this has not been about making a better sharpener than USM, it is about seeing if Smart Sharpen can be put to more use than it commonly is. This may indeed have limited use to good photographers – however one should not discount all the other people generating photos.

Thank you, yes, it is very early days, I hope that with feedback and with more time that I can improve the technique and explanation.

Sincerely,

Stephen Marsh
___________________________________________________________________________

Re: Dan's sharpening action (was: New Smarter Sharpen Technique)
Posted by: Dan Margulis
Fri Jan 9, 2009 5:41 am (PST)

Jim Mantock writes,

In creating the batch mode action, at the end of the sharpening
process what was your printing intent, e.g. high quality ink jets,
magazines, newspaper...?

It's not for a specific output condition. It's a one-size-fits-all solution that should work reasonably well for most images in the 15-30 mb range. Sight-unseen sharpening is by definition not going to produce the greatest quality, but if the operator has time to intervene, the characteristics of the file are much more important than the particular method of output.

Dan Margulis
___________________________________________________________________________
.
Re: Notes on sharpening
Posted by: "Jim Mantock"
Fri Jan 9, 2009 5:41 am (PST)

I wrote:

Davide,

A patent was granted in the radiology area that has several of the
elements in your and others discussions

http: //www.patentstorm.us/patents/6035071/fulltext.html

Someone thought enough of this approach to go through the hassle and
expense of a patent.

In light of a direct response to me, I want to be certain this post was not misinterpreted. IMHO, there may well be value in exploring multi-band approaches and wanted to encourage it. I did not want to put a damper on exploration because someone has a patent that appears similar. Note the patent is for use in B/W radiology. If one of the folks on this list is planning to make $100 Million from a similar idea for general imagery, perhaps concern may be appropriate. Otherwise, I suspect the patent holder has enough to worry about making money on their own...
___________________________________________________________________________

Re: Notes on sharpening
Posted by: "Davide Barranca"
Fri Jan 9, 2009 9:32 am (PST)

Hello Jim,

well, thanks for the clarification, I wasn't sure whether to feel proud or guilty!

I've got a quick read to the paper you pointed out, and I can reassure Mr. Yamada from Fujifilm that my math knowledge is far from being sufficient to steal his ideas and make millions on it.

Actually, I'm having hard time understanding his: "nonlinear processing for forming a plurality of band limited image signals, each of which represents one of signals falling within a plurality of different frequency bands of the original image signal, from the original image signal and the plurality of the unsharp mask image signals, or from the plurality of the unsharp mask image signals."

Nevertheless, as someone else have already highlighted, image decomposition is a really efficient startpoint for picture elaboration; going deeper in that matter, I've found that what we're used to call "standard" unsharp masking and local contrast or general contrast correction are very close relatives - that's something evident in the Difference of Gaussian segment of my Notes.

Kind regards,

Davide Barranca
Bologna, Italy
___________________________________________________________________________

Recreating the High Pass filter via ChOps
Posted by: Stephen Marsh
Sat Jan 10, 2009 7:40 pm (PST)

This post is to correct an earlier statement that I made in a discussion with Jacob Rus. My sincere thanks to Jacob for exploring and following up on this topic.

Re: proper "sharpening" at all scales, ideas (and rants) about the unsharp mask tool and proper use thereof

I wrote:

* High Pass is a [secret sauce] band pass filter, passing through
frequencies that are high, while discarding lower frequencies.

* Subtracting a Gaussian blur from the original, normalised via a mid
gray offset superficially resembles the Photoshop High Pass filter,
however as you note it is not exactly the same, which is why I believe
that there is some secret sauce in the Adobe High Pass filter, as it
is not as simple as subtracting an inverse Gaussian of the same value.

It appears that I was incorrect in thinking that High Pass uses some sort of secret sauce.

When using the Subtract blend mode in Apply Image or Calculations, one applies a scale factor as well as an offset. When creating a High Pass filter using Channel Operations, I use a scale of 2 (subtracting a Gaussian Blurred dupe from the original sharp image). This results in a less intense "high pass" than the default Adobe filter.

If one subtracts using a scale of 1, then the result should be exactly the same as the High Pass filter in intensity. As I don't usually use a scale of 1 when using Add/Subtract modes, this was not obvious in my testing and I did not think to compare it!

Davide Barranca briefly mentions this scale issue in his notes on sharpening - at the foot of the following page on Gaussian Sharpening (Fig. 2.7):

http: //www.bigano.com/index.php/consulting/40-davide-barranca/90-davide-barranca-notes-on-sharpening.html?start= 1

My sincere aplologies if this has misled anybody.

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Stephen Marsh
Sat Jan 10, 2009 7:40 pm (PST)

I have another correction to make (it seems that today is a day for me to eat some humble pie!).

I wrote in regards to creating a Gaussian/Laplacian decomposition:

It is not just a case of being visually identical, when the 16 bpc
separated image is recombined it is pixel perfect, no data loss. This
is very important, as my explorations of this method found that:

When I tested this, I was getting zero difference in blend tests on multiple images. Since then I have found with other images that the decomposition is not a lossless process, however it is visually lossless (so far). Depending on the degree of loss, this may or may not visually affect further image operations.

I am not sure why I am getting mixed results, however I thought it best to correct my previous statement.

Stephen Marsh
___________________________________________________________________________

Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Jacob Rus
Sat Jan 10, 2009 9:36 pm (PST)

Stephen Marsh wrote:
When I tested this, I was getting zero difference in blend tests on
multiple images. Since then I have found with other images that the
decomposition is not a lossless process, however it is visually
lossless (so far). Depending on the degree of loss, this may or may
not visually affect further image operations.

I am not sure why I am getting mixed results, however I thought it
best to correct my previous statement.

To the best of my knowledge, the action linked immediately below should allow the creation of a pixel-perfect "zero difference" decomposition (which in practice means the difference might be 1 value out of 2^15, but usually is 0). Just put the blurred copy of the image in the topmost layer, select it, and run the action, and it will create a "difference mask" representing the difference between original and copy. Show the copy layer again (the action hides it) and invert the difference layer, and you'll have the original.

http: //www.hcs.harvard.edu/~jrus/colortheory/difference-mask.atn

Cheers,
Jacob Rus
___________________________________________________________________________
.
Re: New Smarter Sharpen Technique, Post 2 of 3
Posted by: Jacob Rus
Sat Jan 10, 2009 9:36 pm (PST)

To the best of my knowledge, the action linked immediately below
should allow the creation of a pixel-perfect "zero difference"
decomposition [...]

http: //www.hcs.harvard.edu/~jrus/colortheory/difference-mask.atn

Note that it needs to jump through some hoops to achieve the requisite "127.5 offset" which cannot be directly input into an apply image dialog set to subtract mode. Also note that this will work for images in CIELAB space, EVEN THOUGH the subtract blend mode is not available in the apply image dialog normally. Apparently this is due to a happy "bug" in the action code which is willing to treat L*, a*, and b* channels just as if they belonged to any other space.

--Jacob Rus
___________________________________________________________________________

A threshold and halo reducing tool for use after sharpening.
Posted by: "Jeremy Stephenson"
Wed Jan 14, 2009 9:09 am (PST)

Hi Group.

I have watched the recent posts concerning sharpening with interest, though I haven't had time to go over them in detail until now.

I thought I would add a process I have developed which acts as a variable threshold setting and halo reducer after sharpening has been applied.

I'm not sure if this is similar, or produces the same result as Jacob Rus' exclusion mode method (briefly mentioned on Dec 14) as I don't think he fully completed explaining it (please correct me if I missed a later post explaining in more detail), but it seems a similar concept.

1) create a duplicate layer of the original image and sharpen it (however you like - ignore threshold though, as you can deal with this more precisely later)

2)duplicate the sharpened image, and apply the original layer using lighten mode (this allows the process to be done in Lab mode as opposed to simply using a lighten layer mode)

3)apply the original image to the sharpened image using darken mode - now you have the light and dark component of the sharpened image in two separate layers.

4)Apply the original image to the lightened image using subtract mode (scale 1, offset 0)

5)apply the original to the darkened image using subtract mode (scale 1, offset 255). You now have two layers containing only the difference between the original and the lightened and darkened sharpening respectively.

6)set the blending mode of the darken layer to linear burn, and the lighten layer to linear dodge (add). You should now have onscreen an identical image to your first sharpened layer. (In Lab mode, you will have to desaturate the lightened and darkened layers, or place it all in a luminosity group to avoid color shifts)

7)Now apply clipping curve layers to both the lightening and darkening layers. This gives you complete control of the effect of the sharpening layers.

With the lightening layer, reducing the white point's brightness will lessen the lightening halos uniformly across the range. However, shift the white point diagonally in the curves graph (say for example to input/output of 50%/50%) and you will see the brightest halos decreasing, while the less intense sharpening artifacts elsewhere in the image are unaffected. To adjust the threshold effect slowly start clipping the black point by shifting the black point horizontally.

For the darkening layer, the procedure is reversed - shift the black point diagonally to get rid of any extremely dark halos, and shift the white point horizontally to adjust the threshold of the dark layer.

Play around with the curves for other options.

As I understand it, the threshold slider in USM holds back sharpening on the lowest variations within a radius setting, only sharpening more obvious edge detail. Using curves layers as clipping masks allows us to hold back the sharpening on the lowest variations in the same way - which now provides us with a threshold tool to use with the smart sharpen filter, for example. It also allows us to use different curve shapes to allow a more gentle onset of the threshold effect if we wish.

Excessive sharpening halos are caused when edge contrast is very high, which makes those halos the strongest. We can now reduce the strongest halos, and even bring up the level of lesser, non-damaging halos to strengthen the sharpening effect in those areas if we wish using different curves.

The whole process may be better applied in 16 bit than 8 bit, as it deals with small variations - I haven't done too much testing to verify this, and of course it's easy to make an action to do most of the steps here quickly.

I apologize if the explanation is a bit garbled, but if you can work through the steps and experiment, you may find it useful.

Cheers,

Jeremy Stephenson
___________________________________________________________________________

Re: A threshold and halo reducing tool for use after sharpening.
Posted by: Dan Margulis
Sun Jan 18, 2009 12:03 pm (PST)

Jeremy writes,

I'm not sure if this is similar, or produces the same result as Jacob Rus' exclusion
modemethod (briefly mentioned on Dec 14) as I don't think he fully completed
explaining it(please correct me if I missed a later post explaining in more detail),
but it seems a similar concept.

The similarity is to the corresponding layers in the Action that I posted, see

http: //tech.groups.yahoo.com/group/colortheory/message/20814

In each case separate layers are created for lightening and darkening halos. In each case the idea is that Threshold can be set independently for each and certain types of sharpening can be emphasized or toned down, making it possible to resharpen files that have already been sharpened once. My Action has a lot of other stuff going on with masks, variable opacities, and hiraloam, but the concept of the twin editable lighten/darken layers is identical.

Although the basic idea is the same I think that technically your suggestion is better than mine, so I will eventually update the Action to put the lighten/darken channels in this form.

1) create a duplicate layer of the original image and sharpen it
(however you like - ignore
threshold though, as you can deal with this more precisely later)

2)duplicate the sharpened image, and apply the original layer using
lighten mode (this allows the process to be done in Lab mode as opposed to simply
using a lighten layer mode)

3)apply the original image to the sharpened image using darken mode
- now you have the light and dark component of the sharpened image in
two separate layers.

4)Apply the original image to the lightened image using subtract
mode (scale 1, offset 0)

5)apply the original to the darkened image using subtract mode
(scale 1, offset 255). You now have two layers containing only the difference between the
original and the lightened and darkened sharpening respectively.

6)set the blending mode of the darken layer to linear burn, and the
lighten layer to linear dodge (add). You should now have onscreen an identical image to
your first sharpened layer. (In Lab mode, you will have to desaturate the lightened and
darkened layers, or place it all in a luminosity group to avoid color shifts)

My action has the lighten/darken areas being basically 50% gray, with the halos being overlaid into the base files. Blend Ifs prevent the lighten layer from darkening anything, and the darken layer from lightening. The above suggestion has the lighten layer being black other than the halos and the darken layer white. The halos are then stamped into the base file, I suspect that Multiply and Screen modes may give slightly better results than Linear Dodge and Linear Burn.

In principle both methods give the same result but in practice it's better to have white and black backgrounds rather than gray, but in practice I think white and black are probably better, because

1) If, say, we are working on dark halos, with a gray background the curve has to operate between 51%-100%, but with a white background it's 0-100%, which is more tolerant of inaccuracy.

2) Again assuming darkening halos, it's easier to avoid a certain mistake with a white background. When the background is gray, certain types of curve would threaten to make the background darker than 50% , which would inadvertently not just sharpen but darken the underlying image. It's less likely that we would accidentally change white to something else.

3) I recommend using the equivalent of very heavy sharpening Amounts in the Action, feeling that it's easier to cut back on excessive sharpening than to try to put more in. Nevertheless upon occasion we would want to have the halos be even more pronounced than the very powerful defaults. It is slightly easier to accomplish this with the white background method than using 50% gray.

Thanks for offering this suggestion, it appears to improve what I had proposed.

Dan Margulis

Jeremy's light and dark background layers suggestion was incorporated into my next release of a sharpening Action, one that worked in LAB. Meanwhile, the thread took a hiatus of more than two months, resuming with the following. —DM
___________________________________________________________________________

HIRALOAM on LF Smarter Sharpen Layer
Posted by: "williamtheis"
Sun Mar 29, 2009 8:40 pm (PDT)

I have been trying to master the smarter sharpen that Stephen Marsh described in a series of posts (#20778 is the first, followed by #20779 and #20780) where the image is split into a low spatial frequency layer (LF) and a high frequency (HF) layer. Thereafter the "Smart Sharpen" filter of photoshop cs2 is applied to the two layers sequentially with different parameters chosen after which some of the HF is blended back into the LF, among other things.

There has been lots of discussion about having both HiRadiusLoAmount (HiRaLoAm ) and conventional Unsharp Masking (USM) together. Not the least of these are worries about USM artifacts when performed on an layer that has already had sharpening such as HiRaLoAm . It occurs to me that doing HiRaLoAm on the LF should avoid a number of these objections, at least in theory.

So I have been adding an additional layer between the lower LF and upper HF layers that is a copy of the LF which I have used the smart sharpen filter as Stephen suggests. To this layer I do HiRaLoAm after which I adjust opacity to taste and flatten into the LF layer. Effectively, all subtle high frequency detail has migrated into the HF channel. Thus USM on the HF channel can then act on all those edges uncorrupted by HiRaLoAm with no danger of a previous sharpen .

As to masking, the USM HF channel might benefit from Dan's inverted K mask (post #18622) or inverted luminosity but I'm not sure. I liked the sharpening so much that on most images that I didn't mask. I don't think this mask kind of mask would work on the HiRaLoAm-sharpened LF layer but honestly I haven't tried it. Flatten and it looks pretty good after a blend with itself @ 50% Darken.

Stephen talks about doing the sharpening at "multiple spatial frequencies" but it is not clear that he is suggesting HiRaLoAm but rather several separations of LF/HF with USM applied so my apologizes if Stephen is actually talking HiRadLoAm

Bottom line is that I've just started but I haven't tried it on enough images to know that this is not just a technical superiority or whether it really reduces artifacts in problem images. My scitex scans of large format e6 are probably not representative of what the group has to correct. Those more familiar with the Smarter Sharpen method on a variety of captures may have enough experience to settle the issue

Bill Theis
___________________________________________________________________________

Re: HIRALOAM on LF Smarter Sharpen Layer
Posted by: "Davide Barranca"
Mon Mar 30, 2009 8:19 am (PDT)

Multiple spatial frequency adjustments are maybe better achieved via pyramid decomposition, you can get a look here:

http: //www.bigano.com/index.php/en/consulting/40-davide-barranca/90-davide-barranca-notes-on-sharpening.html

Check the page #6 for details (if you're getting troubles with the direct url, follow the link "consulting" then "Notes on sharpening" from the home page).

Kind regards,

Davide Barranca
Bologna, Italy
___________________________________________________________________________

Re: HIRALOAM on LF Smarter Sharpen Layer
Posted by: "George Machen"
Mon Mar 30, 2009 9:30 am (PDT)

Sounds like your procedure would work just fine, Bill. On the other hand, if you want to reduce extra steps, Dan has recommended simply doing the hiraloam *after* conventional sharpening to avoid amplifying artifacts introduced by such hiraloam "pre-sharpening" in the first place.

With the exception of images in which *faces* are important, in which case we do the hiraloam first, then conventional USM, making sure with the latter to sharpen only the black channel, or in RGB a Luminosity blend layer through a layer mask loaded with a blurred inverted Luminosity-based channel (to confine sharpening to dark areas such as eyelids, eyelashes, hair, etc., and to avoid accentuating facial blemishes).

With images in which hiraloam is detrimental (or at least forces use of a lower than desired Amount) in the three-quartertone to shadow range (such as in faces, where the darkest halos can close a person's eyes, create plugging in the hair, accentuate bags under the eyes, etc.), do the hiraloam on a layer using an absurdly high Amount, e.g., 200%, but load a blurred Layer Mask from a luminosity-based channel to reduce impact in darker areas. Finalize the move by reducing layer Opacity.

- George Machen
___________________________________________________________________________

Re: HIRALOAM on LF Smarter Sharpen Layer
Posted by: Stephen Marsh
Tue Mar 31, 2009 3:30 am (PDT)

Bill Theis wrote:

I have been trying to master the smarter sharpen that Stephen Marsh
described in a series of posts (#20778 is the first, followed by #20779
and #20780) where the image is split into a low spatial frequency layer
(LF) and a high frequency (HF) layer. Thereafter the "Smart Sharpen"
filter of photoshop cs2 is applied to the two layers sequentially with
different parameters chosen after which some of the HF is blended back
into the LF, among other things.

I am not sure if there *is* much to "master" Bill, I was not ready to post the method, however at the time it appeared that others were heading down similar paths and that by sharing my findings others could take advantage for the benefit of all.

At this point I think that it is more about trailblazing, rather than mastery. I think mastery would come later!

There has been lots of discussion about having both HiRadiusLoAmount
(HiRaLoAm ) and conventional Unsharp Masking (USM) together. Not the
least of these are worries about USM artifacts when performed on an
layer that has already had sharpening such as HiRaLoAm . It occurs to
me that doing HiRaLoAm on the LF should avoid a number of these
objections, at least in theory.

I originally was exploring the Gaussian/Laplacian decomposition method for retouching, before I moved on to sharpening. Initially I did look at regular USM on both the LF and HF layers. Then it became obvious that the decomposition suited itself to the smart sharpen (more accurate + remove Gaussian option).

I have not explored the method in detail for a few months.

Stephen talks about doing the sharpening at "multiple spatial
frequencies" but it is not clear that he is suggesting HiRaLoAm but
rather several separations of LF/HF with USM applied so my apologizes if
Stephen is actually talking HiRadLoAm

Smart sharpen does not perform as well at a higher Gaussian blur radius as it does at lower values (1 pixel or lower). Using a higher radius, the result is more about large contrast adjustment, rather than local edge contrast enhancement. I originally did note the HiRaLoAm effect, which can be easily applied with regular USM without using smart sharpen. It is also possible to perform multiple separations to different blur sizes, serially on the same file or on separate files before blending over the original.

Bottom line is that I've just started but I haven't tried it on
enough images to know that this is not just a technical superiority or
whether it really reduces artifacts in problem images. My scitex scans
of large format e6 are probably not representative of what the group has
to correct. Those more familiar with the Smarter Sharpen method on a
variety of captures may have enough experience to settle the issue

I was working with clean digital camera captures from raw data when I did my original testing of the Smarter Sharpen method (5-10mp). With wider testing, I found that different raw converters and grainy scans turned out worse with Smarter Sharpen than with regular USM. Originally I thought that the method may be good for early sharpening, however I am now finding it better for images that have been resampled down to a much smaller pixel size, as is often the case for say offset printing in a publication.

Thanks for taking an interest and exploring the method Bill. Image decomposition is a sound image procesing method, however hacking it with native tools in Photoshop may not always be the best approach.

This whole process taught me more about the smart sharpen filter than I expected. USM is still my mainstay, smart sharpen and the Smarter Sharpen method are still a work in progress.

I think that the sharpening controls of ACR warrant further exploration (for raw or rendered data), although they are touted as capture sharpening, they can also perform output sharpening and like smart sharpen, the results for some images make the time spent exploring worth it. In later versions of ACR, the sharpening is working on different spatial frequencies, which sounds similar in vague concept to the Smarter Sharpen method (Adobe have kept the underlying technical workings a trade secret). We often lament that the USM filter in Photoshop is out of date and should be updated. It would seem that the update was in ACR, not in Photoshop. With the ability to sharpen JPEG/TIFF data in ACR, one may prefer to use ACR for sharpening instead of Photoshop (of course still using Photoshop to blend the ACR sharpening over the original).

Regards,

Stephen Marsh
___________________________________________________________________________

Re: HIRALOAM on LF Smarter Sharpen Layer
Posted by: "williamtheis"
Tue Mar 31, 2009 10:07 am (PDT)

Stephen,

Perhaps "master" was the incorrect verb so "trailblaze" works for me. However based on what I have seen I expect that smarter sharpen will be in my new workflow (or at least do it both ways & pick the better). I haven't yet started regularly using the macros you made preferring to work totally manually for now until I get the hang of what to look for. I am now investigating various masking on the layers (or the result) to eliminate artifacts but am finding this not as necessary as with USM since they are not objectionable, IMHO. Also comparing HiRaLoAm on a separate layer to the proposed HiRaLoAm on the LF smarter sharpen layer. Haven't really started looking at multiple radii like you, Davide, and Jacob have suggested. Lots of things to look at there except I need to get to the final print but as I learn more, I'll post it here so that it can gather some comments and suggestions

The things that I'm pretty certain of:
1. I prefer smarter sharpen to conventional unsharp mask filter for USM since the artifacts are fewer and not as crunchy
2. I prefer the unsharp mask filter (or smarter sharpen not set to "accurate") for HiRaLoAm as it gives much better shaping which agrees with your findings
3. I prefer doing the sharpening before reducing the file to the final Image Size for output [this one surprised me]

As I said, I am always downsizing. Should I need to upsize, I intend to evaluate the order of smarter sharpen and downsizing. I expect it likely will be upsize, then sharpen but I haven't tested what I don't really need. Also my plans are not to perform early sharpening at this time (just one more dimension) nor to use ACR (don't have a copy)

Bill Theis
___________________________________________________________________________

Re: HIRALOAM on LF Smarter Sharpen Layer
Posted by: "williamtheis"
Fri Apr 3, 2009 4:57 pm (PDT)

One addition to my previous comments: I actually blend back 50% of the smart-sharpened lower LF layer into the smart-sharpened upper on in darken mode to emphasize dark halo's over light ones. Obvious step, really

So just a bit more "trailblazing". I have been making a variation of Dan's excellent method of making a "skeleton" K plate (70%-85% GCR sharpened and curved) and then putting this as a layer in an RGB image, change to multiply blend in order to add depth and deemphasizing nonsaturated colors. A description of the technique is in PPv5 pages 164-167. By sharpen, I believe Dan has suggested it be low radius USM. But I have been getting rather interesting enhancements by doing HiRaLoAm sharpening to the K plate in addition or instead of low radius USM.

This adds a lot of shape in the lower values of course… exactly where you want to add it. In fact this may be of more benefit than HiRaLoAm to the LF of a smarter sharpen layer since it confines it to these lower values! Sharpening the LF layer effects high values as well as mid- and lo-values. Of course not every image needs a K plate

Bill Theis