[Digikam-devel] [Bug 174177] New: Proposal for implementing smart unsharp masking

Dik Takken d.h.j.takken at xs4all.nl
Mon Nov 3 15:52:41 GMT 2008


http://bugs.kde.org/show_bug.cgi?id=174177

           Summary: Proposal for implementing smart unsharp masking
           Product: digikamimageplugins
           Version: unspecified
          Platform: Gentoo Packages
        OS/Version: Linux
            Status: NEW
          Severity: wishlist
          Priority: NOR
         Component: Unsharp
        AssignedTo: digikam-devel at kde.org
        ReportedBy: d.h.j.takken at xs4all.nl


Version:           0.9.4 (using KDE 3.5.10)
OS:                Linux
Installed from:    Gentoo Packages

There are two problems with plain unsharp masking:

* It amplifies noise
* It destroys image detail due to clipping of highlights and shadows

Both problems can be fixed by 'smart unshap masking'. 

The noise problem can be solved by masking the whole image, except for the
edges. In the GIMP:

* Duplicate layer
* Use 'Edge' filter to find the edges in the image
* Convert to grayscale
* Apply gaussian blur to make smooth edges (slightly, 5 pixels or so)
* Apply levels to increase the contrast, this will influence noise suppression

Now you have a mask that you can use to combine the original image with the
unsharp masked one. Only the areas that feature lots of detail will be unsharp
masked.

The clipping problem can be solved by masking the highlights and shadows in the
image. In the GIMP:

* Duplicate layer
* Convert to grayscale
* Use the Curves tool to make the shadows and highlights turn out black, the
middle tones should be white. There should be a steep but smooth transition in
between. The shadow and highlight thresholds depend on the image and the
strength of unsharp masking.

There is another technique that cannot be done in the GIMP, but it could be
implemented in DigiKam. It might yield better results and might be simpler to
implement:

* Apply normal unsharp masking
* Create a mask from all pixels that are clipped after unsharp masking
* Blur the mask slightly, gives smooth transitions
* Now re-do the unsharp masking, using the mask to prevent clipping.

Currently, I apply the above two GIMP procedures manually. When I need 16-bit
support, I apply them using ImageMagick. It would be great if DigiKam could add
a 'noise suppression' and a 'protect shadows/highligts' option to its unsharp
masking implementation, so these techniques can be applied automatically.


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list