{"id":609,"date":"2009-01-26T10:00:52","date_gmt":"2009-01-26T10:00:52","guid":{"rendered":"http:\/\/www.knowhowtransfer.com\/?p=609"},"modified":"2016-03-28T09:22:41","modified_gmt":"2016-03-28T09:22:41","slug":"notes-on-sharpening","status":"publish","type":"post","link":"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/","title":{"rendered":"Notes on Sharpening"},"content":{"rendered":"<blockquote>\n<p><em>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.<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><em>By Davide Barranca<\/em><\/p>\n<\/blockquote>\n<h3><img decoding=\"async\" class=\"alignleft wp-image-1557\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/Davide_Barranca_350.jpg\" alt=\"davide_barranca\" width=\"120\" height=\"120\" \/>1. Introduction<\/h3>\n<p>This article is a work in progress collection of personal notes on the subject of sharpening; I\u2019m no digital image processing scientist so, even though I like to play with theoretical problems, I try to \ufb01nd my answers within Photoshop (as I suppose they all do in Dan Margulis\u2019 Color Theory Yahoo group, to which attention I \ufb01rst would like to turn this one). Chances are that I won\u2019t be rigorous too, my aim is to better understand the subject and share my \ufb01ndings with people who would like to integrate them, or simply give a feedback on the techniques exposed. If you\u2019re not interested in all the (very trivial indeed) math and graphs, feel free to skip to the how-to sections: nevertheless, I hope everything will be food for thoughts.<\/p>\n<p>What I&#8217;m suggesting with this article is, among the rest, the possibility to target with appropriate sharpening different image features, even if they belongs to the same spatial frequency range (plus an experimental approach to high-radius low-amount sharpening). Then I&#8217;m showing how to use bilateral and mixed pyramid decompositions to modulate the sharpening within all the image frequencies.<\/p>\n<div id=\"attachment_6043\" style=\"width: 815px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6043\" class=\"wp-image-6043 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/01-01.jpg\" alt=\"01-01\" width=\"805\" height=\"299\" \/><p id=\"caption-attachment-6043\" class=\"wp-caption-text\">(Fig. 1.1) Before and after version, applying some of the tecniques exposed in this article.<\/p><\/div>\n<h3>2. Gaussian sharpening<\/h3>\n<p>There\u2019s plenty of resources on the web about the subject so I skip much of the basics of Photoshop USM (UnSharpMasking) and its use, why we need it, how to build masks, etc. Let me only stress again that it\u2019s called UnSharp because it assumes the subtraction from the original picture of a blurred (unsharp) version. I\u2019ll use a lot the \u201csubtraction\u201d, so here it goes a quick reminder on it, and why sharpening and blurring are close relatives inside Filter \u2192 Sharpen \u2192 Unsharp Mask&#8230;<\/p>\n<p>A quick note for the reader: Grayscale images will be used throughout the article, to help us keeping the focus on tonal transitions. To mimic the effects with color pictures, use L of Lab or apply a solid white layer Color mode to have what Photoshop would consider a grayscale Luminosity version of your original. First picture (courtesy of my friend the photographer Roberto Bigano) is the starting point; then goes the blurred version and the subtraction:<\/p>\n<div id=\"attachment_6044\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6044\" class=\"wp-image-6044 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-01.jpg\" alt=\"notes_on_sharpening_02-01\" width=\"870\" height=\"645\" \/><p id=\"caption-attachment-6044\" class=\"wp-caption-text\">(Fig. 2.1) Original picture: BW version of the painting by Paolo de Matteis \u201cLe sante Maria, Maddalena e Dorotea\u201d (detail) National Gallery of Cosenza, Italy (Photography \u00a9 Roberto Bigano).<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6048\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6048\" class=\"wp-image-6048 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-02.jpg\" alt=\"notes_on_sharpening_02-02\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6048\" class=\"wp-caption-text\">(Fig. 2.2) Original pictures, Blurred version and their subtraction.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Adding the subtraction to the original makes the sharpened version:<\/p>\n<div id=\"attachment_6049\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6049\" class=\"wp-image-6049 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-03.jpg\" alt=\"notes_on_sharpening_02-03\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6049\" class=\"wp-caption-text\">(Fig. 2.3) Original pictures plus the difference on Fig. 2.2 gives the sharpened picture.<\/p><\/div>\n<p>To do this in Photoshop, I may use offset and scaling, which makes the difference channel look more familiar:<\/p>\n<div id=\"attachment_6050\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6050\" class=\"wp-image-6050 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-04.jpg\" alt=\"notes_on_sharpening_02-04\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6050\" class=\"wp-caption-text\">(Fig 2.4) Using a scaled version of the difference in Photoshop.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6051\" style=\"width: 873px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6051\" class=\"wp-image-6051 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-05.jpg\" alt=\"notes_on_sharpening_02-05\" width=\"863\" height=\"385\" \/><p id=\"caption-attachment-6051\" class=\"wp-caption-text\">(Fig 2.5) Detail of the sharpened version using a Gaussian Blur with Radius 4.0.<\/p><\/div>\n<p>A more abstract way to visualize the effect of Gaussian Sharpening, that I personally \ufb01nd useful for comparison purposes, is to plot the signal intensity transition (black) and its blurred version (red), their difference (green), and the original plus the difference (thicker black):<\/p>\n<div id=\"attachment_6052\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6052\" class=\"wp-image-6052 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-06.jpg\" alt=\"notes_on_sharpening_02-06\" width=\"870\" height=\"326\" \/><p id=\"caption-attachment-6052\" class=\"wp-caption-text\">(Fig 2.6) Intensity transition and Gaussian Sharpening.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>The key concept of Gaussian Sharpening is that the difference between original and blurred version is exactly what will be enhanced. If it\u2019s used a blurring kernel (Gaussian Blur, GB, for instance) which softens edges and texture, then edges and texture will be more prominent when the difference layer will be applied to the original. Depending on the algorithm used and the processing of the blurred picture, we may end with a sharpening that affects separately different image features.<br \/> Before going any further, let me review Photoshop\u2019s Calculations and how to use it to sharpen. Open a picture, convert to the grayscale \ufb02avor you like the most and:<\/p>\n<ul>\n<li>duplicate the Gray channel twice;<\/li>\n<li>call the \ufb01rst ORIG and the second BLUR;<\/li>\n<li>apply a GB to BLUR<\/li>\n<li>go to the menu Image, Calculation; if you want to perform a simple subtraction: ORIG &#8211; BLUR; (Eq. 2.1)<\/li>\n<\/ul>\n<p>You should setup the Calculations window as follows:<\/p>\n<div id=\"attachment_6053\" style=\"width: 497px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6053\" class=\"wp-image-6053 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-07.jpg\" alt=\"notes_on_sharpening_02-07\" width=\"487\" height=\"354\" \/><p id=\"caption-attachment-6053\" class=\"wp-caption-text\">(Fig 2.7) Image &#8211; Calculations window<\/p><\/div>\n<p>Pay attention that the first term of the subtraction is Source #2, and the second is Source #1 (little confusing, I know). The result you have is not scaled, and for it to be applied with the appropriate blending mode (Linear Light, LL from now on) there are two slightly different ways. Let\u2019s baptize SS1 the Subtraction with Scale = 1 which implies a later LL blend 50% opacity, and SS2 the Subtraction with Scale = 2 which implies a later LL blend 100% opacity. Both ways are useful as we\u2019ll see soon.<\/p>\n<div id=\"attachment_6054\" style=\"width: 497px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6054\" class=\"wp-image-6054 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_02-08.jpg\" alt=\"notes_on_sharpening_02-08\" width=\"487\" height=\"210\" \/><p id=\"caption-attachment-6054\" class=\"wp-caption-text\">(Fig 2.8) Scaling or not the subtraction (when you perform subtraction, the result is divided by the Scale factor and added to the Offset value)<\/p><\/div>\n<p>Having tested a bit more the subject, I can now affirm that SS1 (LL 50%) and SS2 (LL 100%) are not exactly the same thing, so for the sake of precision, I&#8217;m suggesting you to use SS2 only. The issues in SS1 reveals in pyramid decomposition, i.e. blacks not really black (something you can easily test); nevertheless, if you&#8217;re not in the middle of a decomposition (an image one, of course \ud83d\ude09 you can pick either SS1 or SS2.<\/p>\n<h3>3. Difference of Gaussians<\/h3>\n<p>Let\u2019s shift a bit our point of view; what if, instead of subtracting a blurred version from the untouched original, the subtraction is between two differently blurred originals? Have a look to the graph before we investigate the why of such a move with GBs:<\/p>\n<div id=\"attachment_6056\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6056\" class=\"wp-image-6056 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_03-01.jpg\" alt=\"notes_on_sharpening_03-01\" width=\"870\" height=\"417\" \/><p id=\"caption-attachment-6056\" class=\"wp-caption-text\">(Fig 3.1) Intensity transition and Difference of Gaussians.<\/p><\/div>\n<p class=\"size-full wp-image-580\">The concept behind the Difference of Gaussians (DoG) is quite simple: noise is usually high frequency spatial information, and it\u2019s blown away in both blurred version, so won\u2019t be boosted; on the other hand the two versions keep detail in different frequency ranges. So their subtraction is a way to enhance, precisely, that frequency window:<\/p>\n<div id=\"attachment_6055\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6055\" class=\"wp-image-6055 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_03_02.jpg\" alt=\"notes_on_sharpening_03_02\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6055\" class=\"wp-caption-text\">(Fig 3.2) The subtraction between two versions of the original blurred with different radii<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6057\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_03-03\/\" rel=\"attachment wp-att-6057\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6057\" class=\"wp-image-6057 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_03-03.jpg\" alt=\"notes_on_sharpening_03-03\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6057\" class=\"wp-caption-text\">Fig 3.3) The original plus the difference equals the sharpened version: high frequency has not been affected by DoG (to have a gentler effect it could be suggested a lower opacity LL blend or an inverse S-shaped curve to reduce the contrast of the difference layer).<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6058\" style=\"width: 873px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_03-04\/\" rel=\"attachment wp-att-6058\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6058\" class=\"wp-image-6058 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_03-04.jpg\" alt=\"notes_on_sharpening_03-04\" width=\"863\" height=\"385\" \/><\/a><p id=\"caption-attachment-6058\" class=\"wp-caption-text\">(Fig 3.4) DoG with R1=4.0 and R2=20.0 and SS2, applied LL with an extra opacity lowering at 50%.<\/p><\/div>\n<p>I\u2019m recalling here the DoG because it represent a \ufb01rst step off the traditional sharpening track: I can report that it\u2019s usually applied using a blur ratio ranging from 4:1 to 5:1, while a ratio of 1.6 mimics the Laplacian of Gaussian (LoG: an operator that calculates the second derivative of signal intensity, so it\u2019s good for instance in \ufb01nding edges. I plan to add more on LoG here later on).<\/p>\n<p>I still have to test it extensively: nevertheless an important feature that should be noted is its resemblance to HiRaLoAm (as Dan Margulis uses to call USM with High Radius Low Amount). But there\u2019s a remarkable difference: namely, that edges are less or not sharpened at all, because they belong to the high frequency detail window that\u2019s untouched by DoG (less or no difference between edges in GB1 and GB2, so less or no boosting at all).This could be a bene\ufb01t in work\ufb02ows where different sharpening rounds are planned and an extra step is worth its time.<\/p>\n<h3>4. Other blurring kernels<\/h3>\n<p>Since it\u2019s clear that subtraction and blurring are the core of this kind of sharpening, I started wondering what if other kernels are used instead of, or at the same time with, GB.<\/p>\n<p>Let\u2019s take Surface Blur (SB), aka Bilateral Filter, a well known edge preserving blurring algorithm. If it keeps edges and wipes the rest out it should lead us to think: SB equal something to enhance everything but the edges. Let\u2019s see:<\/p>\n<div id=\"attachment_6059\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_04-01\/\" rel=\"attachment wp-att-6059\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6059\" class=\"wp-image-6059 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_04-01.jpg\" alt=\"notes_on_sharpening_04-01\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6059\" class=\"wp-caption-text\">(Fig 4.1) Subtraction using the edge-aware SB instead of GB.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6060\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6060\" class=\"wp-image-6060 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_04-02.jpg\" alt=\"notes_on_sharpening_04-02\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6060\" class=\"wp-caption-text\">(Fig 4.2) Affecting less the edges, the texture is more enhanced.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6061\" style=\"width: 873px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6061\" class=\"wp-image-6061 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_04-03.jpg\" alt=\"notes_on_sharpening_04-03\" width=\"863\" height=\"385\" \/><p id=\"caption-attachment-6061\" class=\"wp-caption-text\">(Fig 4.3) The result using SB Radius = 6 and Threshold = 15.<\/p><\/div>\n<p>It works as it\u2019s supposed to do. Besides the fact that SB isn\u2019t the fastest \ufb01lter ever in the Photoshop arsenal, there are more annoying things. It\u2019s required a bit of experience to \ufb01nd the correct radius\/threshold couple; due to the algorithm itself, at large radii a reversion starts to appear and instead of more blurring we get more edges coming back:<\/p>\n<div id=\"attachment_6062\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_04-04\/\" rel=\"attachment wp-att-6062\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6062\" class=\"wp-image-6062 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_04-04.jpg\" alt=\"notes_on_sharpening_04-04\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6062\" class=\"wp-caption-text\">(Fig 4.4) SB with Threashold 15 and radii 6.0 &#8211; 50.0 &#8211; 100.0; SB fails at larger radii and detail appears again.<\/p><\/div>\n<p>A much better edge preserving \ufb01lter is the Weighted Least Squares (WLS) operator. Unless you are an experienced programmer or you \ufb01nd the way to put your hands on a computer with MatLab and Photoshop both installed, to use it is quite a problem.The results are remarkable indeed, check the links at the bottom of the page.<\/p>\n<h3>5. Combined use of different blurring kernels<\/h3>\n<p>Here I would like to suggest the joined use of a GB and SF \ufb01lters (i.e. two kernels which differs in their edge-awareness) in order to modulate the sharpening. I\u2019m going to write some very simple and very unorthodox math; being O the Original picture, T and E respectively the Texture and Edge features of the picture (both belonging to the high frequency spatial range) we\u2019ve seen that:<\/p>\n<p>GB = O &#8211; (T+E); (Eq. 5.1)<\/p>\n<p>SB = O &#8211; T; (Eq. 5.2)<\/p>\n<p>A subtraction gives the Edge only component:<\/p>\n<p>(SB &#8211; GB) = O &#8211; T &#8211; O + T + E = E; (Eq. 5.3)<\/p>\n<p>While, rearranging the second equation, we prove that Texture is boosted by SB:<\/p>\n<p>(O &#8211; SB) = T; (Eq. 5.4)<\/p>\n<p>This should give us all the instruments needed to modulate the sharpening in texture and edges separately, via subtraction layers\/channels to be blended in LL mode. Let\u2019s see. Following images are GB, SB versions and the scaled subtractions we\u2019ve talked about.<\/p>\n<div id=\"attachment_6063\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6063\" class=\"wp-image-6063 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_05-01.jpg\" alt=\"notes_on_sharpening_05-01\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6063\" class=\"wp-caption-text\">(Fig 5.1) Subtraction between SB (Radius=6 Threshold=15) and GB (Radius=4) to get an edge-only enhancement channel.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6064\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_05-02\/\" rel=\"attachment wp-att-6064\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6064\" class=\"wp-image-6064 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_05-02.jpg\" alt=\"notes_on_sharpening_05-02\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6064\" class=\"wp-caption-text\">(Fig 5.2) Edge-enhancing channel applied to the original LL 50% opacity.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6065\" style=\"width: 873px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6065\" class=\"wp-image-6065 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_05-03.jpg\" alt=\"notes_on_sharpening_05-03\" width=\"863\" height=\"385\" \/><p id=\"caption-attachment-6065\" class=\"wp-caption-text\">(Fig. 5.3) The result using SB (Radius = 6 and Threshold = 15) and GB (Radius = 4).<\/p><\/div>\n<p>What we should see is a Edges only sharpening. So we\u2019ve been able to get a Texture and Edges sharpening (with GB), a Texture only sharpening (with SB) and an Edges only sharpening (using SB -GB). More pronounced effect can be obtained by higher opacity of the LL layers (when possible) or a sigmoid (aka S-shaped) curves adjustment layer clipped to it, whose opacity can be tweaked as well. In the ToDo list there are actions\/scripts (and even a Photoshop CS4 panel) to automate the process.<\/p>\n<h3>6. Image decomposition<\/h3>\n<p>Until now we\u2019ve tried to modulate the sharpening into the same, high frequency range (edges, texture). But an image usually contains several different frequencies: higher ones correspond to \ufb01ner detail (hair, for instance), lower ones to large, smoother tonal transitions (like the cheeks in a portrait). Now it&#8217;s time to try to target those different frequency ranges with appropriate, different sharpening. Pyramid decomposition is just&#8230; a way to decompose an image into several frequency ranges, and that makes easier to achieve our end.<\/p>\n<p>Very simple math lies under image decomposition. I\u2019ll use GB \ufb01lter (so I\u2019ll build a Gaussian Pyramid of 3 levels, but you can extend it to as many levels as you like); being O the Original picture, GBn(O) the GB \ufb01lter applied to O with radius increasing with n:<\/p>\n<p>U0 = O; (Eq. 6.1)<\/p>\n<p>U1 = GB1(O); (Eq. 6.2)<\/p>\n<p>U2 = GB2(O); (Eq. 6.3)<\/p>\n<p>U3 = GB3(O); (Eq. 6.4)<\/p>\n<p>We de\ufb01ne differences Dn as follows:<\/p>\n<p>D1 = U0 &#8211; U1; (Eq. 6.5)<\/p>\n<p>D2 = U1 &#8211; U2; (Eq. 6.6)<\/p>\n<p>D3 = U2 &#8211; U3; (Eq. 6.7)<\/p>\n<p>So the image can be decomposed into:<\/p>\n<p>O = U3 + D1 + D2 + D3; (Eq. 6.8)<\/p>\n<p>In fact, substituting all the elements we get:<\/p>\n<p>O = U3 + U0 &#8211; U1 + U1 &#8211; U2 + U2 &#8211; U3 = U0 = O; (Eq. 6.9)<\/p>\n<p>Let\u2019s switch to Photoshop and try to build this pyramid. We only need to perform GB \ufb01ltering and subtractions, something we should be familiar with, by now.<br \/> The three GB radius will de\ufb01ne the frequency range: I\u2019ve chosen small radii (i.e. 1px, 5px, 15px) because the original picture is quite small; depending on the resolution of yours, they may vary. I can suggest you to select the smaller radius as the one you would use when applying conventional USM \ufb01lter, the larger one corresponding to HiRaLoAm radius, and the middle one, guess what, somewhere in between. Here are the three U1, U2, U3 and the D1, D2, D3 as we de\ufb01ned them (I\u2019m using SS2):<\/p>\n<div id=\"attachment_6066\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6066\" class=\"wp-image-6066 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_06-01.jpg\" alt=\"notes_on_sharpening_06-01\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6066\" class=\"wp-caption-text\">(Fig. 6.1) U1, U2 and U3, i.e. GBn(O).<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6067\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_06-02\/\" rel=\"attachment wp-att-6067\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6067\" class=\"wp-image-6067 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_06-02.jpg\" alt=\"notes_on_sharpening_06-02\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6067\" class=\"wp-caption-text\">(Fig 6.2) D1 = U0 &#8211; U1.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6068\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6068\" class=\"wp-image-6068 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_06-03.jpg\" alt=\"notes_on_sharpening_06-03\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6068\" class=\"wp-caption-text\">(Fig 6.3) D2 = U1 &#8211; U2.<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6069\" style=\"width: 880px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.knowhowtransfer.com\/store\/notes-on-sharpening\/notes_on_sharpening_06-04\/\" rel=\"attachment wp-att-6069\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6069\" class=\"wp-image-6069 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_06-04.jpg\" alt=\"notes_on_sharpening_06-04\" width=\"870\" height=\"203\" \/><\/a><p id=\"caption-attachment-6069\" class=\"wp-caption-text\">Fig 6.4) D3 = U2 &#8211; U3.<\/p><\/div>\n<p>Having all the elements, it\u2019s now time to compose the pyramid on the Layers palette.You should make a new Set which contains bottom-up: the most blurred version U3, then D1, D2, D3, all the three LL mode, 100% opacity (remember, I used SS2). Here is how should look like your Channels and Layers palette:<\/p>\n<div id=\"attachment_6078\" style=\"width: 525px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6078\" class=\"wp-image-6078 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/06-05.png\" alt=\"06-05\" width=\"515\" height=\"581\" \/><p id=\"caption-attachment-6078\" class=\"wp-caption-text\">(Fig 6.5) Channels and Layers palettes after \ufb01ltering, subtractions and recomposing.<\/p><\/div>\n<p>Don\u2019t feel afraid by the mess here, it\u2019s possible to automate everything (ToDo list +1) and end up with a nice tidy Channels palette. Switching on and off the Set should make no difference &#8211; and hence the decomposition works: great! So what?<\/p>\n<h3>7. A sharpening equalizer<\/h3>\n<p>Our recently decomposed picture still smells good, and moreover offers the possibility to build a 3-sliders sharpening equalizer very quickly (to add as many sliders as you want, just increase the numbers of the decomposition levels). If you made the subtractions SS1 then LL blend 50% you can already play with opacity sliders to boost high, middle and low frequencies at the same time. Personally, I \ufb01nd more customizable to clip a rough S-shaped curve adjustment layer to each of the Dn layers and drag those opacity sliders:<\/p>\n<div id=\"attachment_6079\" style=\"width: 580px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6079\" class=\"wp-image-6079 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/07-01corr.png\" alt=\"07-01corr\" width=\"570\" height=\"670\" \/><p id=\"caption-attachment-6079\" class=\"wp-caption-text\">(Fig 7.1) The S-Shape curve common to all the three adjustment layers clipped to the Dn ones: their opacity control the sharpening in the High, Middle and Low Frequency range de\ufb01ned by the GB radius (0.5, 2.0, 4.0 for those small thumbnails).The Layers palette in its \ufb01nal con\ufb01guration.<\/p><\/div>\n<p>It reminds me the KPT Equalizer plugin (well, surely it lacks its peculiar looking UI): you can go negative, so not sharpening but smoothing a frequency range, via lowering the opacity under 50% if you used SS1 or lowering the opacity of the Dn layers in SS2. Let\u2019s make a version:<\/p>\n<div id=\"attachment_6070\" style=\"width: 873px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6070\" class=\"wp-image-6070 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_07-02.jpg\" alt=\"notes_on_sharpening_07-02\" width=\"863\" height=\"385\" \/><p id=\"caption-attachment-6070\" class=\"wp-caption-text\">(Fig 7.2) One of the several possibilities obtained playing with frequency sharpening sliders.<\/p><\/div>\n<h3>8. Bilateral and WLS Pyramids<\/h3>\n<p>We are allowed to use different blurring kernels, the equations of pyramid decomposition still work. Get a look, for instance, to the better SB:<\/p>\n<div id=\"attachment_6071\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6071\" class=\"wp-image-6071 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_08-01.jpg\" alt=\"notes_on_sharpening_08-01\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6071\" class=\"wp-caption-text\">(Fig 8.1) SB1(O) (Radius=2;Threshold=6), SB2(O) (R=3,T=10), SB3(O) (R=7,T=15)<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6072\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6072\" class=\"wp-image-6072 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_08-02.jpg\" alt=\"notes_on_sharpening_08-02\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6072\" class=\"wp-caption-text\">(Fig 8.2) Difference layers D1, D2, D3 (I used SS1 to make them more evident).<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6073\" style=\"width: 873px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6073\" class=\"wp-image-6073 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_08-03.jpg\" alt=\"notes_on_sharpening_08-03\" width=\"863\" height=\"385\" \/><p id=\"caption-attachment-6073\" class=\"wp-caption-text\">(Fig 8.3) Result with Bilateral Pyramid decomposition for sharpening.<\/p><\/div>\n<p>Can you spot the difference between Bilateral (read: which uses SB) and Gaussian pyramid equalizers? Maybe not that much here, but if you\u2019ll use one of your (high res, maybe high bit-depth) pictures, you\u2019ll \ufb01nd that being edge-aware, the Bilateral pyramid shows little or no halos, which is quite a remarkable feature in my opinion. Shadow\/Highlights with SB (instead of GB) in its \u201cengine\u201d gives the same halo-free look by the way.<\/p>\n<p>As I\u2019ve said before,WLS \ufb01lter is a much better edge-aware smoothing operator, therefore it can be used for even better enhancements (have a look to the website of WLS\u2019 creators for examples). Adobe, anyone listening?<\/p>\n<h3>9. Mixed Pyramids<\/h3>\n<p>Strangely enough if you will, we\u2019re allowed to mix blurring kernels and still the equations work. If you remember: 5. Combined use of different blurring kernels, I\u2019ve found out that:<\/p>\n<p>(SB &#8211; GB) = E; (Eq. 9.1)<\/p>\n<p>If we modify the assumptions of the Pyramid decomposition as follows:<\/p>\n<p>U0 = O; (Eq. 9.2)<\/p>\n<p>U1 = SB1(O); (Eq. 9.3)<\/p>\n<p>U2 = GB1(O); (Eq. 9.4)<\/p>\n<p>we end up with a 2 level decomposition with:<\/p>\n<p>D1 = U0 &#8211; U1 =O &#8211; SB1(O) = T; (Eq. 9.5)<\/p>\n<p>Like we know from eq. 5.4.We then have:<\/p>\n<p>D2 = U1 &#8211; U2 =SB1(O) &#8211; GB1(O) = E; (Eq. 9.6)<\/p>\n<p>which comes from eq. 5.3. So, D1 is a frequency layer of a mixed decomposition which contains, and hence will be able to enhance,Texture alone; and D2 is a frequency layer of a mixed decomposition which contains, and hence will be able to enhance, Edges alone.<\/p>\n<p>Here are the difference layers:<\/p>\n<div id=\"attachment_6074\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6074\" class=\"wp-image-6074 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_09-01.jpg\" alt=\"notes_on_sharpening_09-01\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6074\" class=\"wp-caption-text\">(Fig 9.1) O &#8211; SB1(O) = D1, the texture only detail layer (SB Radius=3,Threshold=16).<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6075\" style=\"width: 880px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6075\" class=\"wp-image-6075 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_09-02.jpg\" alt=\"notes_on_sharpening_09-02\" width=\"870\" height=\"203\" \/><p id=\"caption-attachment-6075\" class=\"wp-caption-text\">(Fig 9.2) SB1(O) &#8211; GB1(O) = D2, the edge only detail layer (GB Radius=2).<\/p><\/div>\n<p>I\u2019ll show you the full Channels and Layers palettes:<\/p>\n<div id=\"attachment_6080\" style=\"width: 533px\" class=\"wp-caption alignnone\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6080\" class=\"wp-image-6080 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/09-03.png\" alt=\"09-03\" width=\"523\" height=\"449\" \/><p id=\"caption-attachment-6080\" class=\"wp-caption-text\">(Fig 9.3) Channels and Layers palettes of a Mixed Pyramid.<\/p><\/div>\n<p>Then I\u2019ll add the same curve adjustments layer clipped to the Dn and play with sliders. Here is an example version:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-6076\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2014\/05\/notes_on_sharpening_09-04.jpg\" alt=\"notes_on_sharpening_09-04\" width=\"863\" height=\"385\" \/><\/p>\n<h3>10. (temporary) Conclusions<\/h3>\n<p>I\u2019ve tried to collect here material coming from various sources and my own \ufb01ndings around the (very personal indeed) subject of sharpening. I was particularly interested in showing how to mix blurring kernels and why pyramid decomposition is a platform on the top of which many sharpening strategies can be developed successfully. Finding new ways to use old tools in order to accomplish even slightly sophisticated tasks pays for the time spent on the project. I still have many open questions, for instance how to simulate the USM\u2019s threshold slider via channel blending (or masks, even though I\u2019d prefer to do the masking with calculations).<\/p>\n<p>Nevertheless I\u2019m pretty happy with the results by now: using those work\ufb02ows means adding a lot of extra steps, even when I\u2019ll \ufb01nd the time to put together actions\/scripts to automatize the monkey work; I don\u2019t know whether someone but me would ever try to use them in production environments (it depends on the kind of production, by the way). But, again, it\u2019s food for thoughts: I\u2019ve always believed in knowledge sharing and plural researches, so I\u2019m waiting for suggestions, corrections, and smarter work\ufb02ows to sharpen. I plan to keep the article updated, so check for revision number at the top of the page &#8211; I have a big fat to-do list (actions, scripts, etc). Drop me an email if you like to be warned when something new appears or just want to give feedback.<\/p>\n<p><a href=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2009\/01\/notes_on_sharpening_10-011.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-10179 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2009\/01\/notes_on_sharpening_10-011.jpg\" alt=\"notes_on_sharpening_10-01\" width=\"863\" height=\"645\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Related Topics<\/h3>\n<div class=\"et_pb_promo et_pb_bg_layout_light et_pb_text_align_left green_button no_offset\" style=\"text-align: left;\"><a class=\"et_pb_promo_button\" href=\"https:\/\/www.knowhowtransfer.com\/store\/apps-photoshop-extension-filter-plugin\/wow-tonal-equalizer\/\">Read more about Frequency Separation with Wow!<\/a><\/div>\n<hr \/>\n<p><a href=\"www.knowhowtransfer.com\/apps-photoshop-extension-filter-plugin\/wow-tonal-equalizer\/\"><img decoding=\"async\" class=\"aligncenter wp-image-10187 size-full\" src=\"https:\/\/www.knowhowtransfer.com\/store\/wp-content\/uploads\/2009\/01\/Wow_frequency_comparison_positive_780.jpg\" alt=\"Wow_frequency_comparison_positive_780\" width=\"780\" height=\"613\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>Davide Barranca<\/h3>\n<p>Lives and works near Bologna, Italy.<br \/> He&#8217;s the developer of ALCE, VitaminBW, Double USM, PS Projects and Floating Adjustments.<br \/> Davide is also a color-management aware photo-retoucher, focused in color-correction and image enhancement in fine-art photography, art reproduction photography and fine-art digital printing. Interested in academic research around digital imaging, stitching, HDRI, custom filters writing.<br \/> Specialties: Pre-press, broad experience in working side by side with photographers trying to convert from artist to technical language.<br \/> <a href=\"http:\/\/www.davidebarranca.com\" target=\"_blank\">You can visit his site here &gt;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[5,67,14],"tags":[],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-5","category-resource-full","category-resources"],"_links":{"self":[{"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":0,"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowhowtransfer.com\/store\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}