Enhancing Image Quality of Thermal Images (Seek)

As you may know, I recently bought the ”Seek Thermal Camera” for my smartphone. It works great, but the images I take are blurry and quite noisy. In this post I will try to sharpen the images using a technique called ”homomorphic filtering” in Matlab. I have written a GUI where you can try this out for yourself. I will provide you with a link to my github account and you can just download it and try it out.

To learn more about the thermal camera, see my earlier post: review of the Seek thermal camera. Link to project on github.

Introduction

Homomorphic filtering works by assuming the illumination-reflectance model of image formation. This model says that the intensity of a pixel is governed by the following relationship

\(\cal{I}(x,y) = \cal{L}(x,y) \cdot \cal{R}(x,y)\)

where the intensity of a pixel equals the product of the illumination of the scene and the reflectance of the (objects) in the scene. Illumination tends to vary slowly over an image, so we can use this fact to enhance images such as MRIs, microscopic images and thermal images.

The trick to eliminate the illumination component of the image is based on the law of logarithms.

\(log(a\cdot b) = log(a) + log(b)\).

So, we get

\(log(\cal{I(x,y)}) = log(L(x,y)) + log(R(x,y))\).

Now we only need to apply a high-pass filter to remove the slowly varying illumination part of the image. We can then get back to the original image by using \(b^{\log_b(x)} = x\) and we are done.

Experiments

I took the liberty to write a GUI in Matlab where I can apply the filter to an image and with sliders change the variables of the Gaussian high-pass filter. First I use the filtering technique on the frequently used PET scan. This scan can often be seen when talking about homomorphic filtering. The other set of photos are taken with the Seek Thermal camera. I have created gif animations that switch between the blurry prefiltered images and the enhanced/sharper ones.

The GUI written in Matlab.

PET scan enhancement.

Thermal image of my bicycle disc brake.

Thermal photo of Marta González Carcedo with filter.

Since the last post I took a trip to my summer house and payed a visit to the local riding school in Frillesås and surrounding farms. I found a couple of willing participants.

Thermal image of a horse.

Thermal image of another horse.

There are some problems with using this method to enhance thermal images. The method is sensitive to noise. By boosting the high-frequency data of the image, we also boost the noise. To combat this we can apply a Gaussian filter of the data, as a preprocessing step. This will smooth the noise, but if we smooth too much, any detail we wish to preserve will be eliminated. I believe that by first reducing the noise and then reducing the illumination, I expect to get a better filter technique for enhancing photos taken with the Seek thermal camera.

Note: there is a image enhancement method in the Seek thermal app. The enhancement seems to be a simple smoothing filter. In all my photos I want as much control of the original data as possible, so I don’t apply this filter to my photos.

Conclusions

The homomorphic filtering technique works well when we wish to enhance details in a blurry thermal image. The problem is that the images often have noise and as the method boosts high-frequency data, the noise will be part of that data.

This method, however, could possibly be combined with noise reduction techniques (using wavelets for instance). The Matlab code, that has been linked to in this post, provides the user with a simple way to adjust the variables in a interactive way. Be sure to not open large images, as they take longer to process.

Link to project on github

Leave a Reply

Your email address will not be published. Required fields are marked *