How is contrast and sharpening achieved?

Discussion in 'Graphics Programs and Photo Gallery' started by merol, Nov 25, 2017.

  1. merol

    merol TPF Noob!

    Joined:
    Nov 25, 2017
    Messages:
    1
    Likes Received:
    0
    Can others edit my Photos:
    Photos OK to edit
    Hi,

    I've been googling around for how LR or PS performs contrast enhancement and sharpening, but the web is conspicuously scarce when it comes to details about this.

    Just based on the available sliders in LR, it's tempting to draw the following (very broad) conclusion:
    1. Sharpening: When holding the ⌥-key and dragging the radius slider one is presented with what looks like a high frequency version of the image. It's therefore tempting to assume that sharpening is done by performing frequency analysis, adjusting how many pixels "away" from the high frequencies one wants to affect (the radius), and then specify the luminosity adjustments for those pixels (amount).
    2. Contrast: Based on the various descriptions on how contrast and sharpening works, it seems like they target pixels with different luminosity values. So maybe they increase contrast by adjusting the luminosity relative to the average luminosity? Or maybe relative to the average luminosity of the lower frequencies?
    Can anyone provide some details here? Am I totally on a wrong track here?


     
  2. Ysarex

    Ysarex Been spending a lot of time on here!

    Joined:
    Nov 27, 2011
    Messages:
    5,332
    Likes Received:
    2,347
    Location:
    St. Louis
    Can others edit my Photos:
    Photos OK to edit
    This can become an involved topic.

    Yes your Internet searches can be frustrating. Proprietary software vendors tend to be reluctant to share their methods. So asking for details about how something is accomplished is only going to encourage an Adobe or Serif or Nikon to post another guard at the door to the room where the vault is located.

    You started your question by mentioning LR and PS but then went on to only note the apparent behavior of LR sliders. LR and PS are different in this regard and so different answers will apply. Very simply LR provides fairly limited adjustment access for sharpening (Detail panel and output sharpening choices on export) and contrast (Contrast slider in Basic panel, Curves and Clarity (micro contrast) slider). Whereas PS will allow you to do whatever you want. If you don't want to use one of PS's many tools devoted to sharpening and contrast you can use PS to create your own. For example I do all of my output sharpening for screen display in PS using actions I created myself that apply a frequency separation technique. To make an analogy, LR is a very nice two bladed pocket knife, PS is a 25 blade Swiss Army survivalist tool with 16 gigs of memory in a USB flash drive thrown in.

    LR was designed to function as a raw converter and its toolset still reflects that fundamental design bias even though it's frequently used to edit JPEG images. Using LR as it was designed to convert raw files sharpening should be applied in stages. The first sharpening stage occurs as the file is demosaiced. LR doesn't acknowledge this or provide any user control access, other raw converters do. The next stage then is what we call input sharpening. In LR this is done using the Detail panel where the user controls are Amount, Radius, Detail, and Masking. This appears to be a conventional unsharp mask algorithm except for the Detail slider which suggests Adobe may be using a combination unsharp mask algorithm with a little RL thrown in especially at high detail values. Adobe is not going to tell us. So we all look at the results and you can like it or lump it.

    Input sharpening should be done with a light hand because at that stage in the process the image may be used in different ways. Final output sharpening should be done when the use for the image is clear. Acknowledging this LR provides the rather crude option to select output sharpening during export as either for print or screen. And good luck googling precisely what it is they do.

    The overall contrast of your image is adjusted by pulling or pushing the dark and light ends of your image apart or together. Contrast is the difference between dark and light -- more difference = more contrast and vice versa. Watch the histogram of your image as you move a typical contrast adjustment slider. As you raise contrast the histogram is stretched -- the dark end is pulled darker while the light end is pulled lighter. A crude algorithm will do that proportionately without regard to the starting and ending positions of the two extremes. More sophisticated algorithms will begin to pull apart or push together with regard to clipping at th extremes and may have disproportional clipping protections built in. Curves is a control that allows you to manually reset dark and light positions and as a result alter contrast.

    Given the way you worded the question I suspect you may have been asking more about micro contrast as opposed to contrast. Micro contrast is a somewhat different critter. It recent years it's been complicated by confusion over what to call it. LR's Clarity slider adjusts micro contrast. In other vendors software products it's called micro-contrast and/or clarity and/or structure and/or.... This is a tricky subject because it's related to micro contrast in the lens as well as in the demosaicing algorithm. I noted above that sharpening in it's first stage takes place in the demosaicing algorithm. At that stage sharpening and micro contrast are the same thing. Micro contrast is still contrast; the difference between dark and light, but in this case we're not talking about the tonal range over the whole image but rather the difference between closely adjacent midtones. You seem to be looking for very specific "how to" answers to micro contrast implementation. A radius value is used to establish a grid over the image. Within the grid cells contrast between the darker and lighter pixels is increased. Thom Hogan's blog on this topic is pretty good: What is Micro Contrast? | DSLRBodies | Thom Hogan

    Back to LR, Adobe provides the Clarity slider as a micro contrast adjustment. There are lots of subtleties in the algorithms that implement micro contrast. Algorithms that enhance micro contrast create a lot of artifacts starting right at the demosaicing beginning. So using them is a juggling act between perceived gain and damage to the image. Comparing the different micro-contrast tools between vendors it's instructive to see the differences.

    Joe
     
  3. KmH

    KmH Helping photographers learn to fish Supporting Member

    Joined:
    Apr 9, 2009
    Messages:
    40,330
    Likes Received:
    5,506
    Location:
    Iowa
    Can others edit my Photos:
    Photos OK to edit


    Math.
    As Joe mentions Lr and Ps are different animals.

    Edits in LR, a parametric (image pixels are not altered in any way) editing application are XML line commands that alter Lr's Raw conversion algorithms.
    Both Lr Develop module and Ps Camera Raw are the parametric Adobe Camera Raw, or ACR.

    Ps is a raster graphics application that also has a few vector graphics capabilities.
     

Share This Page