What's new

To sharpen or not to sharpen

I picked numbers in unsharp mask that maintained roughly the same ratio of resize:sharp ratio, so that they should be equivalent, except for the order of those two steps

Assuming I understand what you mean here, you have performed this correctly. While you may not have thought through what the "correct amount" is, you arranged to arrive at the same place, by adjusting parameters.

If, on the other hand, you blindly applied unsharp mask with radius X, percentage Y, and threshold 0 to both the original and to a shrunk copy, the results should look different.

The point is that if you're sharpening to accomplish a particular goal, rather than simply as a Cargo Cult "I must always sharpen" ritual, then there is a proper amount to be sharpening for any particular output size/device. Your goal, whatever it is, cannot really be accomplished without reference to the final output size and device.

ETA: The thumbnails of your two pictures, interestingly, DO look different to my eye (although it's possible that it's some bizarro thing like part of my display being slightly dimmer), but I cannot see any difference in the full sized ones. I speculate that there's some non-visible differences that result in different results after resizing and recompressing or something.

You're contradicting yourself (possibly because I haven't been clear about what I was doing."
"You have performed this correctly" and "it cannot be accomplished without reference to the final output size" are incompatible statements, because I literally hadn't even decided what the final output size was going to be yet when I was doing the "sharpen first" image of these two. So there was absolutely no reference to the final output size while sharpening. Thus, you have to choose one: Either I was doing it wrong, or it CAN be acocmplished without reference to final size.

There is a middle ground between "Blindly applying an action" and "Taking into accoutn the final size." I am in that middle ground: I am very much taking into account the particular photo I am sharpening and its spatial frequencies. But I am doing so at whatever size it happens to be when I sharpen it. As long as you do that, you can then go ahead and downrez it to any size you want, and end up with pretty much the exact same output as if you had downrezzed and then sharpened according to its spatial frequency at that point. There's no reason why you have to have a specific downrezzed size in mind while sharpening before, though. It doesn't factor into any of the parameters.

Hence downsampling necessarily removes significant amounts of sharpening.
Yes but this is equivalent to simply using a smaller radius after downrezzing, more or less. "Applying more and then throwing some of the data out" versus "applying less later"
What do I care? It's not like I'm doing the calculations by hand and just wasted 2 months of math or something.

The B image has higher contrast (it is probably over sharpened).
I think you're right. The problem here is that a perfect experiment is almost impossible, since the limits on the increments you can choose on the slider are very difficult to match. At least it would be too difficult to bother with IMO.
In the "sharpen after resizing" situation, the radius that worked was on the order of 0.2-0.3 pixels, and the ideal match would have been about 0.25. I chose 0.3, which perhaps you are actually able to see. If I had chosen 0.2 though, it would have been undersharpened slightly...

Which actually leads me to a disadvantage of sharpening after resizing, simply due to software logistics: You can't fine tune it as well!
 
USM will do different things to an image with more pixels.

That is pretty much exactly my point. I can't actually tell if you you amplifying my point, or disagreeing with it. But we appear to be, in broad strokes, on the same page either way.

The statement that USM boosts higher frequencies is true of Sharpen, across the board. In it's most primative form that is all it does. Smart sharpen tools and others that do edge detection use other ways to mask what areas are operated on are only slightly different.

USM however will amplify some high frequencies, blur others, and ignore some. That is the primative form, and again might be modified by use of various masking techniques.

Sharpen is a precisely reversable algorithm. The same basic algorithm can be either a blur or a sharpen tool by just changing the parameters.

USM cannot be reversed with another algorithm. The data that is left behind does not indicate what it was derived from.

They are very different in those respects. The specific point is that if you apply sharpen to a data set, the resample it to a smaller size there is a specific effect, and that can be recreated exactly by doing them in the reverse order (using appropriate parameters). But that cannot be done with USM. The order makes a significant difference in how the data is changed. It is not possible to use USM first on one copy of an image which is then downsized to get the exact same result (as is possible with Sharpen) that will happen by downsizing first and then using USM (even with adjusted parameters).

But yes, generally we are pushing the same concepts for how and when to sharpen, and we're pretty much on the same page!
 
There is a middle ground between "Blindly applying an action" and "Taking into accoutn the final size."

Perhaps that isn't the right way to take into account the final size! Sharpening is best done by inspection. That is, looking at the results. Because the kind of image detail, as well as the dimensions, is significant it isn't possible to sharpen at one size, calculate the right sharpening parameters for a different size and apply that before reducing the size by the specified amount. On images where that does work it simply isn't efficient, compared to reducing the size and then applying sharpening by inspection.

Hence downsampling necessarily removes significant amounts of sharpening.

Yes but this is equivalent to simply using a smaller radius after downrezzing, more or less. "Applying more and then throwing some of the data out" versus "applying less later"

That isn't the same! It can be rather difficult to get an exact match for the effects of "radius" as opposed to "amount". Part of the reason for that is very few programs allow you to adjust the "sigma" parameter, which is weighting on how the "radius" is applied. Specifically sigma is the standard deviation of the Gaussian, and adjusts the effect that pixels near/far from the center pixel will have on how much that center pixel is adjusted. If sigma is small then an increased radius has no effect. If sigma is large then all pixels withing the radius have the same effect.


What do I care? It's not like I'm doing the calculations by hand and just wasted 2 months of math or something.
And that is what it would take to get it right! It's just a lot easier to be able to make the right adjustment by observing the effect, and then get exactly that effect when it is applied.

The B image has higher contrast (it is probably over sharpened).
I think you're right. The problem here is that a perfect experiment is almost impossible, since the limits on the increments you can choose on the slider are very difficult to match. At least it would be too difficult to bother with IMO.
In the "sharpen after resizing" situation, the radius that worked was on the order of 0.2-0.3 pixels, and the ideal match would have been about 0.25. I chose 0.3, which perhaps you are actually able to see. If I had chosen 0.2 though, it would have been undersharpened slightly...

Which actually leads me to a disadvantage of sharpening after resizing, simply due to software logistics: You can't fine tune it as well!

I don't think finer than tenths is significant, and at least with the tool I use the amount parameter can be adjusted by hundreths. I definitely agree that implementation makes a huge difference! I've looked at maybe dozens of sharpening plugins for GIMP, and have compared them to ImageMagick tools as an example. ImageMagick has perhaps some of the best tools available for many purposes, but for sharpening it is just too difficult to observe the differences when making fine tuning adjustments; hence good or not, I don't use it.
 
(I assume you're talking about this when you say sigma, usually called a "sigmoid"?):
$sigmoic_half1.webp
The parameters that photoshop, for instance, gives you are radius and "amount" which i assume is magnitude. Radius (or rather diameter) is going to be the distance between that center point in the above image and the other center point in the mirror image curve on the other side of the kernel. Amount is just going to be how stretched this whole thing is vertically.

But in practice, changing the amount and then going in and changing your curves to be less contrasty = the exact same thing at the end of the day as what you would get if you were able to just change the sigmoid directly. So it's not really necessary as a tool. Although it would be convenient, it would be redundant.

And none of it is really pertinent to before resizing vs. after. As long as you scale your radius to the current size, it is identical either way, mostly. The only reason it isn't perfectly identical is simply because we are working in a pixelated space, not a continuous mathematical one, and so there are tiny rounding errors. That's it. But rounding errors are virtually never going to be noticeable, unless like me, your program gets down to the point of not having enough precision to choose from (thus magnifying rounding errors).

I can't imagine any situation where it would ever make any important difference, though, even with the rounding errors you get with 1/10th pixel precision. The scale of such rounding errors is simply too small to give a hoot about, even if you may technically be able to see them if you stare hard enough. Unless of course you keep doing the filters over and over, which you should generally never do with ANY edit.
 
Last edited:
I am going to leave the two of you to enjoy yourselves. This is the kind of thing you guys like, and I don't.
 
I do actually sort of do sigmoid math for a living as it turns out! Although nothing to do with photography, it still is the same principle (I use sigmoids and kernels to simulate fields of organized neurons communicating in pattern, which as it turns out is extraordinarily similar to sharpening algorithms) =)
 
I sharpen every image, as much as is needed for each one -- basically to the point where increasing the sharpening no longer makes it looks better. Using high quality glass though like the 70-200 f/2.8, I don't feel like I need to sharpen nearly as much as I used to.

It is also good practice to selectively sharpen, especially images with a shallow depth of field. There's no point sharpening something that is supposed to be out of focus. It just adds noise and harshes up your bokeh.
 
(I assume you're talking about this when you say sigma, usually called a "sigmoid"?):

That's close enough. The parameter is referred to as "sigma", it is used in a sigmoid function that weights how much the "amount" parameter is applied over the distance of the radius.

The parameters that photoshop, for instance, gives you are radius and "amount" which i assume is magnitude. Radius (or rather diameter) is going to be the distance between that center point in the above image and the other center point in the mirror image curve on the other side of the kernel. Amount is just going to be how stretched this whole thing is vertically.

But in practice, changing the amount and then going in and changing your curves to be less contrasty = the exact same thing at the end of the day as what you would get if you were able to just change the sigmoid directly. So it's not really necessary as a tool. Although it would be convenient, it would be redundant.

Not quite. The effect on the center pixel from pixels out to the radius distance is weighted by the value of sigma. If sigma is as larger or larger than the radius then all pixels within radius distance have equal effect. If the sigma value matches half the radius then the most distant pixels have less effect and the closest ones have maximum effect. As the value of sigma becomes small in comparison to the radius it is very much the same as making the radius very small instead. But the curve of, for example, a specific radius and equal sigma cannot be matched with any smaller value for sigma no matter what the radius is.

Hence sigma is not redundant in theory. In practice that much control is obviously beyond the needs or understanding of the vast majority of users. So while not redundant it does have questionable value compared to the added complexity.

And none of it is really pertinent to before resizing vs. after. As long as you scale your radius to the current size, it is identical either way, mostly.
That is true of Sharpen, but not for Unsharp Mask, in terms of the effect it has on the image data.

But that doesn't reduce the distinction between using just some random "that will be good enough" amount of sharpening, which is all that can be done with sharpen first and resize second, compared to resize first and then sharpen by inspection to get a precisely correct adjustment.
 
Hence sigma is not redundant in theory. In practice that much control is obviously beyond the needs or understanding of the vast majority of users. So while not redundant it does have questionable value compared to the added complexity.
Sigma is not redundant with (radius + amplitude).
Sigma is redundant with (radius + amplitude + the curves tool). Ctrl-M in photoshop

Changing the amplitude of sharpening changes both what would be the sigma + the contrast at the same time. But then by using curves, you can negate the effect on contrast, thus leaving you with just a change to sigma.
So having sigma be an actual slider would be more convenient, but not actually more control than you have already.

You even said it in the first response that the main noticeable thing that seemed wrong was "too high of contrast," intuitively picking out that exact relationship.

$Untitled-1.webp
(roughly)

Perhaps Unsharp mask doesn't quite do what I am guessing it does, but the empirical evidence pretty much suggests that this is roughly what's going on, as I would expect if it does. Yes, one's a local effect and one's a global effect, and doesn't actually look just like that diagram, but it still pretty much works if you go in that order. Probably not the other order.
 
Last edited:
Hence sigma is not redundant in theory. In practice that much control is obviously beyond the needs or understanding of the vast majority of users. So while not redundant it does have questionable value compared to the added complexity.
Sigma is not redundant with (radius + amplitude).
Sigma is redundant with (radius + amplitude + the curves tool). Ctrl-M in photoshop

I'm speaking only about the algorithm used to sharpen. With either USM or an HP Sharpen there are actually three at least three parameters: radius, sigma, and amount. Commonly there is a threshold parameter too, and less often there can be a bias parameter to shift convolution.

Commonly a Sharpen tool might only present the user with selection of a single parameter. USM usually has radius, amount and threshold.
 
The curves tool is one algorithm for sharpening. It's just a simple way to do one of the most fundamentally basic sharpening algorithms: contrast masking (rather than making an actual mask layer blah blah you can just mess with the curves and do the same thing, and if you actually use curved curves it works better than a basic mask anyway)

It affects some of the same variables as USM does, and the two influence each other in complementary ways, such that if you have curves + USM (with not all of its parameters), you can still achieve the same end result as if you had a better tool with more parameters given to you. Not perfectly down to the pixel identical, but almost / might as well be.
 
The way I see it, in developing photos, we are attempting to do what every p&s does does to its images. They all have done (a lot of) sharpening done. Now much less is needed when using a good lens, of course.

Also, a soft image can be made sharp, but details remain lacking.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Back
Top Bottom