Advanced Blurity usage: custom blur models
Sometimes, not even Blurity can remove the blur from a photo on its own. If that happens, you might be able to help it along by using one of Blurity’s advanced features: opening a custom blur model.
In ordinary operation, Blurity builds a model of the blur in a photo by looking for clues about the hidden sharp image’s structure. Unfortunately, poor lighting, bad focus, and sensor noise can all cause that modeling to fail.
However, it is sometimes possible for a human to “see” the form of the blur in the image even when Blurity cannot. It is most visible as glints on rounded surfaces, where point sources of light trace out the movement of the camera. In effect, those glints show the “point spread function” that Blurity normally attempts to derive via an algorithm.
If a glint showing the point spread function is visible in the image, and — importantly — the glint represents an accurate model of the blur throughout the image, it’s possible to extract the glint from the image and then use Blurity’s “Open blur model” function to deblur the image using that model.
How about an example?
Here’s a photo of a bottle of vitamins and a bottle of cologne. I took it with my cellphone, a Motorola Droid X, which runs Android. The same procedures could be applied to any other camera, from a DSLR to an iPhone to a point-and-shoot.
The photo is in focus, but it is clearly motion blurred. Thus, it’s a good candidate for deblurring.
Normally, you’d use Blurity in Basic or Advanced mode and let it figure out the blur model on its own, which it does easily with this image. You wouldn’t want to follow the steps outlined here in most situations.
However, for the sake of demonstration, we’ll assume that the automated ways failed.
Look closely at the cover of the cologne bottle. Notice how it’s shiny. In particular, notice how at one of the corners there’s a bright, slightly curved line. That’s a glint, and it’s tracing out the motion of the camera. We want to extract that glint so that we can feed it back into Blurity.
First, open up the blurry photo in your favorite photo editor. We’ll use Photoshop in this example.
Select the glint plus some margin around it.
Copy that selection into a new image.
The more accurate the blur model is, the better the deblurring results will be. Therefore, we want to eliminate all of the superfluous data from around the glint. In the end, we want to end up with something that looks like one of the computed blur models. (If the idea of the computed blur model is unfamiliar to you, please refamiliarize yourself with how to use Blurity by referring to the user manual.)
First, ensure that the blur model is grayscale by desaturating it.
Next, adjust the levels so that the glint is isolated.
You want the glint to be bright and everything else to be black. However, you don’t want the entire glint clipped to white; shades of gray in the blur model can be just as important to deblurring quality as the overall shape of the blur model. You just want the brightest parts of the blur model to be just below being clipped.
Depending on your situation, you might need to manually paint parts of your blur model black. Remember that you want to eliminate everything that isn’t part of the model of the blur. In this example, the blur model was sufficiently clean without manually painting any areas black.
Assuming all has gone well, the end result is a clean model of the blur. Save it as a PNG file.
Now it’s time to bring our blur model into Blurity. First, open the blurry image in Blurity. Once it’s open, select “Open blur model…” from the “Blur model” sub-menu in the “File” menu. Navigate to where you’ve saved the desaturated, level-corrected, cleaned-up blur model, and open it.
After a short processing period, Blurity produces the deblurred image. If you open the full-resolution version of the image, you can see that the glint has been resolved back into a point-source of light. Seeing that indicates that the blur model was successfully developed and applied. Since the blur in the glint accurately represented the blur on the front of the vitamin bottle, the text there is also sharp.
Obviously, it’s easier to use Blurity in one of its normal automated modes. However, if you need the extra power of extracting and defining your own blur models, that functionality is nice to have.
As a variation on this technique, you can use the “Save blur model…” menu option to save any blur models that Blurity has calculated. If you wish, you can then reapply those blur models to other images. That can be useful for batch processing, where many images are blurred the same way. A series of video stills might be an example of that.
Or, if you can tell that Blurity got close to a good blur model by observing the “Computed blur model” display, but you can tell that it isn’t 100% there, you can save the blur model Blurity calculated, touch it up on your own, and then open your revised model back in Blurity for use during the final deblurring.