Sharpening, Acutance, and Local Contrast


Status
Not open for further replies.

LittleWolf

New Member
Jan 23, 2005
1,095
0
0
Singapore
#1
In an unrelated thread, I recently showed an example that pictures can be made to appear more "sharp" to the human eye/brain by simple image processing operations, in particular "unsharp masking". I've received requests for further clarification per PM. Here, I'll give two examples with some explanations how things work in non-mathematical terms for the benefit of those who haven't heard about it yet.

First example:



(1) is a synthetic "original". (2) is an "unsharp" version of (1), created using a "Gaussian blur" filter.

Another way of describing the "blurriness" of the edges in (2) is that instead of an abrupt change of brightness, the change is spread out, creating a gentle transition. To restore "sharpness", one has therefore to make this transition less gentle or, in other words, the slope of brightness transition has to be increased.

The simplest way of making the brightness scale steeper is to increase the image contrast. This is demonstrated in (3). Unfortunately, there are two undesired effects: Firstly, the contrast is not only increased at the edges, but everywhere, and darker regions in the image "drown" in the shadows while brighter regions are "burnt out". Secondly, while the edge transitions are steeper, they now have to cover a wider range from the darker shadows to the burnt out highlights, and while the transition is steeper, the overall width of the transition is unchanged.

The solution is to increase contrast only at/near the edges. A distinguishing property of edges compared to other image elements is that the brightness changes on small length scales. Therefore, if we increase the contrast for image features on small length scales while leaving it unchanged for larger image features, the problem is partially solved.

The desired manipulation falls into a class of signal processing operations known as "high pass filters". "Unsharp masking" is a family of high pass filters. (Note that I wrote "family" - "unsharp masking" by itself is not a well defined operation, and different programs may do somewhat different things.)

Typically, "unsharp masking" filters have at least two parameters: one is commonly called "radius" and specifies the scale (size) that determines whether image features are "large" (and to be left alone) or "small" (and to be boosted). The second parameter (often called "amount") specifies how much the small scale contrast is boosted.

In (4), image (2) was subjected to an "unsharp masking" filter with a "radius" of a few pixels. This markedly increases the edge contrast (or "acutance"), while leaving the overall tonal range unaffected. (4) looks visually "sharper" than (2). There are, however some artefacts: The increased contrast near the edges results in brighter "halos" on the bright side of the edge, and in darker "halos" on the dark side of the edge. (In signal processing, this effect is called "ringing.) Using the unsharp mask filter therefore requires a compromise between "better sharpness" and "less artefacts". The "best" compromise depends solely on the taste of the viewer.

Another way to make dull pictures more "spiffy" is to enhance the contrast of intermediate sized features. This is shown in the following example:



In the original image (A), the gray "blobs" don't stand out very well against the background. (The grayscale background could represent e.g. a transition from bright sunlight to a shady area.) Again, one could increase the global image contrast, but this would result in blown out highlights and "drowned" shadows.

In (B), the "local contrast" has been enhanced by unsharp masking. Since the "blobs" are of intermediate size, a intermediate feature size (radius) parameter was chosen for the filter. Similar artefacts (halos) as before are visible, too. (C) is the same as (B), except the (perfectly sharp) edges of the "blobs" have been exaggerated using unsharp masking with a small scale parameter (radius).

These techniques are not new inventions. In fact the term "unsharp masking" is a carryover from film days. By overlaying a picture with an out-of-focus negative of itself, large-scale contrast is reduced while small-scale contrast is unaffected. This is not identical, but mathematically very similar to what the computer USM filter does.

Also, there is an "edge effect" in film development that adds acutance (i.e. exaggerates edges or small-scale features) in much the same way as the computer version. In light of the latter, some image manipulation can hardly be counted as "cheating" - traditional photography does it all the time, whether the photographer wants it (or even knows about it) or not!

Finally, I should point out that in some circumstances, it is possible to create a "sharp" version of a blurred image without introducing artefacts. This requires however a detailed knowledge of the blurriness characteristics, which makes it impractical in general photography (for scientific image processing, it's an entirely different matter).

I'd also warn to take some explanations too literally. This forum is not the right place (and I don't have the time) to write a scientifically precise textbook :).
 

kahheng

Senior Member
Jan 20, 2002
1,481
1
38
bride.ru
#2
LittleWolf said:
Finally, I should point out that in some circumstances, it is possible to create a "sharp" version of a blurred image without introducing artefacts. This requires however a detailed knowledge of the blurriness characteristics, which makes it impractical in general photography (for scientific image processing, it's an entirely different matter).
Through some deconvolution method?
 

LittleWolf

New Member
Jan 23, 2005
1,095
0
0
Singapore
#3
kahheng said:
Through some deconvolution method?
Yes. If you know what deconvolution methods are, I figure you know all the details already ;).
 

yanyewkay

Senior Member
Sep 22, 2004
3,924
0
0
Cons digger.
#4
good stuff. :thumbsup: so we probably need mathlab to apply the deconvolution techniques to the image?
 

Zerstorer

Senior Member
Jul 8, 2002
3,437
0
0
#5
yanyewkay said:
good stuff. :thumbsup: so we probably need mathlab to apply the deconvolution techniques to the image?
There are many photoshop plugins that do this. Even PS-CS2's smart sharpen comes with a deconvolution option.
 

kahheng

Senior Member
Jan 20, 2002
1,481
1
38
bride.ru
#6
Zerstorer said:
There are many photoshop plugins that do this. Even PS-CS2's smart sharpen comes with a deconvolution option.
What other PS plugins do this?
 

yanyewkay

Senior Member
Sep 22, 2004
3,924
0
0
Cons digger.
#7
Zerstorer said:
There are many photoshop plugins that do this. Even PS-CS2's smart sharpen comes with a deconvolution option.
oh.. i dun have PS CS2 sadly..
 

Zerstorer

Senior Member
Jul 8, 2002
3,437
0
0
#8
One that comes to mind immediately, is FocusFixer, these are the 2 of the 3 that I've played with before that, one I can't recall at the moment. Should be easy to dig up more.

http://www.humansoftware.com/pages1200/AutoFocus/HSautofocus0.html
http://thepluginsite.com/products/photowiz/focalblade/faq.htm

Doesn't really work that well in reality, a gentle hand is required with the controls and in effect its still similar to other edge enhancement algorithms, but with more artifacting or "detail" in the textures.
 

kahheng

Senior Member
Jan 20, 2002
1,481
1
38
bride.ru
#9
Zerstorer said:
One that comes to mind immediately, is FocusFixer, these are the 2 of the 3 that I've played with before that, one I can't recall at the moment. Should be easy to dig up more.

http://www.humansoftware.com/pages1200/AutoFocus/HSautofocus0.html
http://thepluginsite.com/products/photowiz/focalblade/faq.htm

Doesn't really work that well in reality, a gentle hand is required with the controls and in effect its still similar to other edge enhancement algorithms, but with more artifacting or "detail" in the textures.
I wonder what the CIA/CSI uses in those programs we watch on television :)

I know: Macromedia Director...........
 

Zerstorer

Senior Member
Jul 8, 2002
3,437
0
0
#10
kahheng said:
I wonder what the CIA/CSI uses in those programs we watch on television :)
Probably something like this:
http://math.nist.gov/mcsd/highlights/blinddeconvolution.html

Even then I might think twice about applying it to any decent image....usually deconvolution is used to save really screwed up images....not for anything with fine photographic detail.;p
 

kahheng

Senior Member
Jan 20, 2002
1,481
1
38
bride.ru
#11
Zerstorer said:
Even then I might think twice about applying it to any decent image....usually deconvolution is used to save really screwed up images....not for anything with fine photographic detail.;p
But it looks so convincing on TV! :)
 

Zerstorer

Senior Member
Jul 8, 2002
3,437
0
0
#12
kahheng said:
But it looks so convincing on TV! :)
Maybe they've been arresting the wrong people?;P

Jokes aside, it seems to work best on images with distinct clean outlines. IDing car plate numbers and the number of Tu-22 parked in some soviet airbase should be ok. Trying to do it on a OOF portrait of your cat may not work as well.
 

LittleWolf

New Member
Jan 23, 2005
1,095
0
0
Singapore
#13
yanyewkay said:
good stuff. :thumbsup: so we probably need mathlab to apply the deconvolution techniques to the image?
Matlab would probably be a good tool to do it, but by no means a requirement. It's not difficult to write a small prgram that does this yourself (the tedious part is probably giving it a working user interface).

One trap that is easy to fall into: all the signal processing should probably be done on a linear brightness scale. Common image data is frequently encoded on a nonlinear scale. Applying numerical algorithms on such brightness scales may give results that are not completely off, but not really correct either. I strongly suspect that most image processing software does not take this into account.
 

kahheng

Senior Member
Jan 20, 2002
1,481
1
38
bride.ru
#14
LittleWolf said:
Matlab would probably be a good tool to do it, but by no means a requirement. It's not difficult to write a small prgram that does this yourself (the tedious part is probably giving it a working user interface).

One trap that is easy to fall into: all the signal processing should probably be done on a linear brightness scale. Common image data is frequently encoded on a nonlinear scale. Applying numerical algorithms on such brightness scales may give results that are not completely off, but not really correct either. I strongly suspect that most image processing software does not take this into account.
If you write anything interesting, do let me know.

I have tried a few astro-related programs and they were quite interesting.
 

Status
Not open for further replies.
Top Bottom