| Digital images, on the other hand, can often be salvaged. Because of
their digital nature, it's possible to apply mathematical
formulas that can create higher contrast at the edge of objects, thus creating
a sharper image. This process is called unsharp masking. Most good imaging
software programs, such as Adobe PhotoShop, will allow you to do this.
Here's how unsharp masking works.
Pixels and algorithms: A brief review
A digital image is made up of thousands of pixels,
or tiny squares, each of which is assigned its own color. Three different
values combine to determine this color: the R (red) value, the G (green)
value, and the B (blue) value. Varying levels of red, blue, and green produce
every color in the spectrum, from yellow to purple, and black to white.
Because the pixels have a numeric value, you can make instantaneous
changes by applying a single mathematical formula that affects every pixel.
For example, you could give a photo a warm, reddish cast by uniformly raising
the R value of each pixel.
That's the simplest case. The algorithm for unsharp masking, which changes
the sharpness of the image rather than its color, is more complex.
Detecting and sharpening edges
An image is out of focus because one object blurs into another. For
example, you've taken an out-of-focus photo of an air balloon against a
blue sky. If you look closely, you'll notice there's no distinct point
at which the balloon ends and the sky begins. This is because the transition
occurs over three or four pixels.
The job of an unsharp masking algorithm is to detect this blurry edge
and divide it into two distinct parts. The first part--detecting the edge--is
relatively easy. First, the photo is converted into a grayscale image.
Then, areas that have a rapid change in brightness within just a few pixels
are singled out as edges.
So far, so good. Now the difficult part: how can you reintroduce sharpness
to this edge? It's actually a three-step process.
 |
 |
| Original image |
Algorithm widens edges |
First, the algorithm creates an even blurrier version of the photograph,
so the blurry edges aren't just three or for pixels wide, but perhaps eight
or ten.
 |
| Mask is created |
Second, the numerical values of the pixels in the blurred copy are subtracted
from the pixels of the original. The result is called a "mask." The mask
is actually a series of positive and negative values. It registers the
small but soon-to-be-important differences between the original and the
blurred copy.
Third, the values of the mask--whether positive or negative--are added
to the original image. This makes the bright half of the edge even brighter,
and the dark half even darker. Thus, the original goal is achieved--higher
contrast at the edge of objects, so the boundaries between objects are
more distinct.
 |
 |
| Original edges |
Sharpened edges |
A balancing act
As clever as an unsharp masking algorithm may be, it has its limitations,
and what it detects as the edge of an object may not be an edge at all.
For example, digital images often have small imperfections that are invisible
to eye, such as light pixels in the middle of a shadow. If the unsharp
mask function is too sensitive, it will pick up these small abnormalities
and make adjustments that actually introduce more errors. And even where
a real edge does exist, the unsharp mask can create edges that are too
hard, giving the image a flat, unrealistic feel.
But several solutions are possible. For example, you might use the unsharp
mask function only on specific parts of the image, leaving the rest untouched.
Or you could make it more or less difficult to detect edges by changing
either kernel size--the width of the edge (meaning the number of pixels
over which a change in contrast occurs); or the height of the edge (meaning
the minimum change in contrast that defines an edge).
As you can see, unsharp masking may require some manipulations to achieve
the best results. Still, it represents a significant advance over traditional
photography, since you can actually make a sharper, better image than the
original. |