#1 (permalink)  
Old 07-16-2009, 01:37 PM
New Member
 
Join Date: Jan 2008
Posts: 12
Default "Smart" Sharpening (in Gimp)

I'll show you how to do smart sharpening of your images. Applying an unsharp mask to an entire image is not always appropriate. A really good example of this is when you have an image with a lot of high ISO noise or film grain; applying across-the-board sharpening will enhance the noise/grain and make it even more visible, especially in large prints. Often there will be large areas of the image that you know you don't want to sharpen (e.g. a blue sky--the blue channel tends to get a lot of noise).

This technique does two "smart" things to avoid sharpening noise:

1. sharpen only the luminosity channel, and
2. create a channel mask that contains only the edges in the image. Then you can load the channel mask as a selection and apply the unsharp mask to just the edges.

Duplicate the image by pressing Ctrl+D or right-click and select Image -> Duplicate. It might be wise to minimize the original image window now. You can open it later to compare to the result.

Right-click on the duplicate image and select Image -> Mode -> Decompose. In the decompose dialog box, select LAB (or HSV; see Note 1). Check the "As layers" checkbox (see Note 2) and click OK.

This will create a new window with the image decomposed into the Luminosity ("brightness"), A and B channels as 3 layers. This will allow us to isolate and sharpen the luninosity channel which is a) the most important, and b) should be the cleanest in terms of noise.

At this point I usually turn off visibility of the A and B layers in the Layers dialog by clicking on the "eyes".

Note 1: if you happen to have an older version of the compose/decompose plug-in it may not have the LAB option. In that case use HSV (hue/saturation/value) instead. For any reference to the "LAB" image or "luminosity" channel below, substitute the "HSV" image/"value" window. The LAB option was not in my initial version of GIMP (ver 1.2.1), but I got the newer version of the plug-in at the GIMP Plug-in Registry and compiled it myself. Don't worry if you don't have it; HSV works great too.

Note 2: in the older version of the decompose plug-in there is no "As layers" checkbox; instead it will create the three channels as separate windows rather than three layers in one window. It really doesn't matter if you do it this way; the layers way just reduces the clutter on your screen. If you don't have the "As layers" option, I suggest you minimize (but not close) the hue and saturation (or A and B) windows. We'll need them later, but you don't want to accidentally pick one of them in the next few steps.
Go to the duplicate image. Right-click and select Filters -> Edge Detect -> Edge. In the Edge Detect dialog box, select a parameter value of the appropriate size for the edges in your image. You may need to experiment with this.

Now convert the edges image to grayscale by right clicking on it and selecting Image -> Mode -> Grayscale. This image is going to become our sharpening mask.

The next step is to adjust the tonality a little so that areas that need sharpening are really white and anything that doesn't need sharpening at all is really black.

Open the Levels dialog ( Image -> Colors -> Levels). Bring the black point up and the white point down to filter out any insignificant edges. You may need to play around with the exact positions of the sliders. Click OK when the image outlines the significant edges in white and most everything else is black.

How much you'll need to tweak this really depends on the image.

Now apply a gaussian blur ( Filters -> Blur -> Gaussian Blur) to smooth out the edges a little. A radius of between 3 and 10 pixels (horizontal and vertical) should be enough.
Open the Layers dialog. Select the LAB image (if HSV, value) in the drop down box at the top and then click on the Channels tab.

Click on the new channel button () at the bottom of the dialog to create a new channel. Name it "Sharpening Mask".
Right-click in the blurred/edges image window and Select -> All. Right-click again and select Edit -> Copy. (Alternatively you can use keyboard shortcuts Ctrl+A and Ctrl+C in succession).

In the Layers dialog, make sure the Sharpening Mask channel is selected. Go back to the LAB (value) window and paste ( Edit -> Paste or Ctrl+V).

Select the Layers tab in the Layers dialog and click on the anchor button () to anchor the floating image.
Click on the Channels tab in the Layers dialog. You should see a tiny version of the sharpening mask in the channel icon, indicating that you properly pasted the sharpening mask into the new channel. At this point you may wish to click on the eye icon to make the sharpening mask invisible.

Select the Sharpening Mask channel and click the "Channel to Selection" button (). You should see "marching ants".

You can experiment with feathering the selection here if you want; I usually don't.
Important: in the Layers dialog, click on the Layers tab and make sure the luminosity layer (if HSV, Background layer of Value window) is selected, and is the only one selected. We only want to sharpen the luminosity channel.

Apply an unsharp mask ( Filters -> Enhance -> Unsharp Mask). You may want to experiment with the settings here. You will find that you can use much higher amounts of sharpening (than if the entire image were selected) without significantly degrading the image.
Now get rid of the selection (right-click and Select -> None) and zoom in (= key) to examine the results. If you're not happy with the results, undo and try the sharpen step again with different parameters.
It's time to reconstruct our original image from the LAB (HSV) components.

Right-click in the luminosity (value) window and select ( Image -> Mode -> Compose). In the Compose Options dialog, make sure that you have selected LAB (HSV) on the left and on the right that the Luminosity, A and B (Hue, Saturation and Value) components are matched up with their respective images.

Click OK; this should create a new composite image.
It may help to unminimize the original image for comparison. If you feel your image needs more/less sharpening, then go back to the LAB window, undo twice and redo the unsharp mask step above.

When you are satisfied with the result you can close all the extraneous windows.
Closed Thread

Bookmarks

Tags
gimp, sharpen, smart

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off



Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

What’s Your Preference?

Daily Digest

Each day we send out a quick email to thousands of DPS readers to notify them of updates. This email is just short excerpt of the first few lines of our latest post with a link if you want to read it all. You can unsubscribe from this this service at any time.

This service is provided by a third party (Feedburner) and you can subscribe to it by leaving your email address in the following field and confirming your subscription when you get an email asking you to do so.

Enter your email address for
Daily Updates:

Weekly Summary

For those wanting a weekly summary of what happens on this site this free email newsletter is probably your best option. It includes a summary of the tips posted to the site each week. This newsletter is subscribed to by over 25000 readers (many who also subscribe to the other options above) - come join the community!

To subscribe to this weekly newsletter simply add your email address to the following field and then follow the confirmation prompts. You will be able to unsubscribe at any time.

Enter your email address for
Free Weekly Newsletter:

 
SEO by vBSEO 3.3.0