Enlargement blur

Let’s say you have a small image and you want to make it big.  Perhaps you lost the larger version, or perhaps there never was a larger version. If you go to a normal photo editing program, like Photoshop, and try to enlarge the image, you’ll probably be somewhat disappointed.

The editing program is likely to use either bilinear or bicubic interpolation to create the missing pixels in the enlarged image.  The problem is that they’re looking rather naively at just the neighboring pixels when they create a new pixel.  Obviously, they can’t magically “enhance” their way into adding new information to the image, but neither are they being clever about using what data is available.  Thus, the enlarged image is rather soft and blurry.

So what can be done?  Unfortunately, Blurity isn’t well-suited for enlarging photos.  The problem of enlarging photos, called “superresolution”, is related to the problem of removing blur from photos, called “blind deconvolution”, but not in a way that makes Blurity useful for enlargement.  Instead, we need a different type of specialized tool.

One of the most interesting and successful approaches takes advantage of the fractal nature of a natural image.  In particular, visual elements are repeated within the image at different scales.  This is important for two reasons.

This is an extreme example, but many images have repetition.

This is an extreme example, but almost all images have some degree of repetition. Notice how the yellow circles enclose what appear to be multiple copies of the same chimney. This repetition can be used to create a higher-resolution version of the chimney.

First, the visual elements are likely to be repeated within the image at sub-pixel misalignments.  In essence, the higher-resolution version of that repeated visual element has been sampled multiple times, which provides enough data to reconstruct a model of the higher-resolution visual element without directly observing it.  The extra sampling also enables the removal of noise and compression artifacts.

Inferring the latent high-resolution version of the patch from a variety of slightly differently sampled lower-resolution versions of the patch is the essence of classical superresolution.

Second, the visual elements at different scales can be used directly in the resized image.  For example, a circle might appear repeated in the small version of the image at multiple scales.  A large scale of that circle could then be used in the enlarged image as a replacement for a small scale circle.

At the moment, most of this technology is limited to the lab.  A paper by Glasner et al. called “Super Resolution From a Single Image” includes some great examples of state-of-the-art image enlargement.

If you’re not in the lab, never fear. There are several  products that attempt to do the same thing. (Disclaimer: bleeding-edge technology like this tends to be finicky, and these algorithms don’t always produce good results.) Some options to consider:

Happy enlarging, and don’t forget Blurity if you just need to remove some blur.

Categories: Imaging | Comments Off on Enlargement blur

Blurity is Back!

Blurity is back!  The world is still full of blurry photos, and there still are no other decent blur removal tools available to consumers.

For this round, Blurity is an application that runs on your PC. Specifically, your Windows PC — a Mac version will be released if it looks like there’s sufficient demand.

What happened to the web version? In short, the market happened: nobody wanted web-based photo blur removal.  A minor pivot, but a pivot nonetheless!

Categories: Imaging | Comments Off on Blurity is Back!

Battle: Photoshop vs. Blurity for motion blur

Whenever the topic of photo deblurring comes up, there are inevitably comparisons to and questions about Photoshop’s built-in tools.  As discussed in an earlier post, things like unsharp mask do help to improve the apparent sharpness in certain situations.  In fact, for out-of-focus blurs, the results produced by unsharp mask and those produced by Blurity can be quite similar.

Not so for motion blur.  Blurity blows away the other approaches when removing motion blur.

For motion blur, unsharp masking and tools like “Smart Sharpen” are nearly useless. They attempt to improve local contrast to increase perceived sharpness, but that trick doesn’t work very well with motion blur.  Even in Smart Sharpen’s motion blur mode, it cannot restore the detail obscured by the blur.  Blurity, on the other hand, creates an actual model of the blur, so it is able to adapt to complex movements and transformations.

Here’s a real-world image that suffers from motion blur:

Blurry mug

Blurry mug and watch (click to enlarge)

I captured this image of my Seiko watch and favorite mug on my desk with my Canon A1100IS camera.  (Full disclosure: I switched the camera’s built-in optical image stabilizer off in order to get a good demonstration photo.  Also, the image has been rescaled to be 3.0 MP to improve blur modeling, which is a trick I’ll cover in a future article.)  It’s about a half-second exposure, and the blur is obviously quite severe.

Ordinarily, you might turn to something like Photoshop to try to fix a photo like that.  Ok, we’ll give that a shot.

Here’s the blurry image sharpened with Photoshop’s Smart Sharpen filter (motion blur setting, 64px length, 135 degree angle, 100% application):

The mug photo, with Photoshop Smart Sharpen

The blurry photo, with Photoshop Smart Sharpen applied (click to enlarge)

That didn’t help much.  The watch face is still unreadable, the mug is still fuzzy, and the photography gods are still crying.

We can do better.  We have Blurity.

Here’s the same image again, this time deblurred with Blurity:

Same photo, deblurred with Blurity

Same photo, deblurred with Blurity (click to enlarge)

Incredible!

The difference is even more stark when zoomed in.  Blurity managed to recover an impressive amount of detail:

Detail of deblurred watch

Detail of deblurred watch. Note the legibility of the watch face.

The text on the mug is clear, and the second-marker hashes are crisp on the watch face.  It’s even possible to read the numbers on the sub-dials on the watch face and the date in the watch’s date window (it says “3” because I forgot to set it forward at the end of February).  Isn’t that amazing?

For comparison, here’s a close-up of the original blurred watch face next to the Blurity deblurred watch face:

Watch face comparison

Close-up of the original blurred watch face (left) and the Blurity deblurred watch face (right)

I think you’ll agree that Blurity handled this image much, much better than Photoshop.

Not all blurs can be removed, but if any automated tool can do the deed, it’s going to be Blurity.  And of course, it’s always free to preview the deblurring.

Categories: Imaging | Tags: , , , , , | 1 comment

Why _Un_sharp Mask Makes Images Look Sharper

With a name like “unsharp mask,” it would be reasonable to assume that such a thing would make a blurry image even blurrier.  The opposite is true, of course: unsharp mask is a popular technique for improving the perceived sharpness of photos.  It works by increasing the edge contrast — the “acutance” — of an image.

But what’s going on when you slap “Unsharp Mask” in Photoshop?

Let’s walk through an example.  Say we have a have a slightly soft image of some text that we want to improve:

Our image is blurry. Oh no!

Pretty, no?

The first step for unsharp masking is, surprisingly, to make the image even blurrier.  Here we apply a 1 pixel Gaussian blur to the blurry original:

Our image, blurred even more.

Next is the key to the technique.  We want to use the extra-blurry image as a mask.

Subtract the really-blurry image from the somewhat-blurry image, and we get…

The difference between the extra-blurred image and the original blurred image

…a black rectangle.  Not really; there are actually difficult-to-see lines roughly tracing the edges of the letters.  Here’s the difference result again, this time level-shifted to be more visible:

Same difference mask, but level-shifted to be more visible

Set that aside for a moment, and make another copy of the original blurred image.  To this image, increase the contrast significantly.

High-contrast version of the original blurry image

It’s sharper, sure, but the overall colors have been shifted.  Where we once had shades of gray everywhere, we’re now left with just black and white.  This would be even worse if it were a color image.  Not good.

Intuitively, we want to use the high-contrast version of the image near the edges, but we want to use the original version everywhere else so that our entire picture doesn’t get the high-contrast look.  This turns out to be easy: just use the difference map from a couple of steps ago as a mask for the high-contrast version of the image.  Layer the masked high-contrast image over the original image, and…

The original blurred image again, for comparison

The final unsharp-masked image. Sharper!

Voila!  A sharpened version of our image.   Note that there is a bit of a halo effect here around the edges due to overshoot, but applied conservatively, unsharp masking can provide a pleasant crispness to many images and even fix slight blurs.

Major blurs require a different approach, but we’ll save that for another day.

Categories: Imaging | 2 comments

Motion blur

Imagine this: you’re trying to take a photo of your friends with your camera, but the light is dim and you can’t use a flash. The camera seems to focus successfully, so you click the shutter, but the resulting photo is totally blurry.  Oh no!  Sound familiar?

What you’ve just experienced is known as motion blur.  It’s caused when either your camera or what you’re photographing moves during the exposure.

Motion blur is most often a problem when the light is dim.  Your camera compensates for the reduced light levels by taking a longer exposure.  The longer the exposure, the more time there is for movement, and if there’s movement, there’s blur.

Modern point-and-shoot cameras and DSLR lenses incorporate image stabilization systems which can eliminate some types of motion blur to a certain extent, but the best strategy is still prevention.

Here are some tips for reducing motion blur:

  • Use a faster shutter speed: The shorter the exposure (i.e., the faster the shutter speed), the less time there will be for movement.  A rule of thumb for photographing stationary objects is to use a shutter speed at least as fast as the reciprocal of the effective focal length.  For most point-and-shoot digital cameras, that means a shutter speed of at least 1/30 second at wide angle, and at least 1/150 second when zoomed all of the way in.
  • Add more light: If it’s possible to add more light to the scene, that will allow you to use a faster shutter speed.
  • Increase your camera’s sensitivity: No, this doesn’t mean you need to teach your camera to “actually listen” to you.  It means that you can try increasing the ISO sensitivity level, which is somewhat analogous to turning up the “volume” on its light sensor.  If your camera is set to 200, try 400.  If it’s set to “auto,” try a higher manual value, perhaps 800.  Be aware, however, that there’s a trade-off: the higher the sensitivity, the noisier/grainier the photos will be, which can result in blur of a different sort.
  • Remind everybody to stay still: If the problem is not that the camera is moving, but rather that the people in the photo are moving, then don’t be afraid to tell them to stay still.  Depending on your camera, they might need to remain stationary for some time before or after they hear the camera click in order to prevent blur.
  • Use a tripod or other brace: If you can hold the camera still using something like a tripod, that’s a win.  If you don’t have a tripod, any other solid object can serve a similar purpose.  Tables, fence posts, and car hoods are some often-convenient options.
  • Hold the camera tight to your body: Your body will experience less movement than will your hands.  Therefore, you can use your body as a sort of crude brace.  Grasp each side of your camera with your hands, then bring your arms in and hold them tightly against your chest.  Alternately, turn your head to the side and hold your camera on your shoulder.  You’ll be able to frame your image while enjoying a relatively solid bracing surface.

Have other ideas?  Feel free to add them in the comments!

Categories: Imaging | Comments Off on Motion blur

Newer posts →