I have spent a significantly large part of the past year on an image processing project, that ended up blending in quite a lot of modern image processing techniques from different areas of the field.

Most of the time had been spent researching the methods available for the various tasks that had to be done, in order for the solution to work.

It is a modern developer art not to reinvent the wheel but to reuse existing resources whenever possible. Therefore, much of my work was based on open source implementations that I found out there.

What I am sharing with this post is a summary of the methods that I have studied, with links, notes and open source implementation whenever mainstream frameworks (mostly OpenCV) do not contain a solution. I hope this will help others, undergoing image processing projects, with their research and development.

It would be extremely arrogant to claim that the list of the techniques shown here is exhaustive, so please do not take it as such. It is only a compilation of some techniques that happen to be of interest to me for this particular project. Feel free to discuss any of them, or any others in the comments section.

Binarization

Let’s begin with binarization, a step that I consider as one of the most important one when it comes to recognition tasks, such as character recognition, traffic sign recognition etc.

Applied on a grayscale image, the simplest technique is a hard thresholding method, like if the color is above 128, it is white, otherwise black. As expected, this has poor results, because it does not take into consideration the surrounding pixel colors. When it comes to binarization, in order to extract some information conveying symbol from the image, we need relative gray level differences. An absolute threshold, all over the image will do very poorly.

For this reason, there are a few very effective techniques out there:

The above links contain C implementation that can easily ported to other languages.

Entropy measurement

Entropy is the statistical measure of randomness. We need to measure entropy in an image, or in an area of an image, in order to figure whether there is some underlying pattern in it, conveying information.

Here is how Matlab is doing it.

This is an opencv implementation.

This is an awesome analysis, that associates the problem to spatial proximity and here is an implementation.

A final one I found is here.

Measuring blur and deblurring

This is not more than what the title says, measuring how blurred an image is and trying to remove that blur.

Here is a good starting point on how to measure blur.

This is one is excellent for motion blur.

This is a great presentation. There is both theory and sample code (in Matlab). The technique is implemented in an open source tool as well.

What makes deblurring hard, is the fact that the blurring kernel, in other words the deformation applied to the original image, is unknown.

For example, if the blur comes from motion and you take a picture while panning to the right, the picture you will get will be motion blurred and you will know a great deal about how it was blurred (right panning), hence you will know a lot about the kernel. If you also knew the motion speed, you could almost remove the blur completely.

But whenever we do not have such information, we have to estimate the kernel. This is a publication that describes how (with prestigious names behind it).

Image luminosity

Let’s say you are building an app and you need access to the phone camera light sensor readings and such an access is not provided to the developer. Or, that you need to measure the luminosity of a picture after it was taken and its metadata do not contain that kind of information.

Here is a simple way to measure it.

Now, this post is getting much bigger than I thought, so I am thinking of continuing at another one. So stay tuned!