Skip to main content

A Fast, Simple and Powerful Contrast Enhancement Algorithm for Image Analysis

A few months ago I started a fun project to develop a low-cost superficial vein finder as an android smartphone accessory. I had already identified that I need a camera without an IR filter, which is compatible with Android because the built-in camera of a typical smartphone completely cuts the near IR radiation. 

After researching for several days I bought a night vision camera which supports V4L2 driver, from eBay. I was able to get the video stream from the camera to openCV on NDK in my Android mobile thanks to the saki's code for accessing UVC camera from Android. The next challenge was to find an image enhancement method to process the vein images in real-time. The enhancement should normalize the illumination and enhance the contrast of superficial veins in real-time.
I implemented several illumination normalization algorithms and adaptive contrast enhancement algorithms by referencing several credible pieces of literature but none of them gave the expected result. 

After spending many hours, I got an idea for a new contrast enhancement algorithm which is based on the linear contrast stretching which I learned for image processing in my university. The idea is extremely simple as it only applies a Gaussian smoothing and linear contrast stretching with a small modification. It took only 10 minutes to implement the new algorithm in c++ with openCV but the result seemed better. The new algorithm was named as Speeded-Up Adaptive Contrast Enhancement (SUACE). Then I transferred the code to the Android vein finder project. The application was tested by installing in my Galaxy Note5 and the new algorithm processed the frames at the rate of 28 fps.

Since I felt that the algorithm is fresh and the results are better, wrote a research paper and submitted to ICIIS2017 conference. Mr. H. Kulathilake from the Rajarata University also contributed to preparing this paper. I also tried applying the same algorithm to enhance the blood vessel structure of retinal fundus images and found the result is extremely better than the existing enhancement algorithms. The fact was confirmed by a medical doctor; Dr. M. P. Giragama. Since the paper submission deadline of ICIIS2017 was extended by 15 more days, I wrote another paper by including the results of retinal fundus image enhancement and segmentation with a slight modification to the Tyler Coye's algorithm and submitted to the same conference. Hopefully, the both papers were accepted with good comments from the reviewers.

The Adaptive Contrast Enhancement Algorithm

In the conventional contrast stretching algorithm, a given range of intensities is mapped into a wider range by using a linear or piecewise linear transformation function. However, the given range (reference range) of the intensities is static for the whole set of pixels in the image. The idea of the novel algorithm is to change the reference range based on the illumination around the pixel.

It is a known fact that the illumination can be extracted by filtering the lower frequency components of an image. The lower frequency components can be obtained by using a smoothing filter to the image without transforming it to the frequency domain.

In this new algorithm, the illumination is calculated by convolving the image with a Gaussian kernel. Then the reference intensity range of the contrast stretching algorithm is shifted based on the corresponding value from the image smoothed by convolving with the Gaussian kernel. The following figure shows the height map (the height is proportional to the intensity) of the original image I(x,y) and its Gaussian smoothed version g(x,y)
Height map of the original image I(x,y) and the Gaussian smoothed image g(x,y)
The red marks in the above image indicate the reference range of intensities which is to be stretched. The mid point of the range is similar to the g(x,y) value where the lower and upper boundaries are a(x,y) and b(a,y). There are d number of intensities in the reference range. The typical contrast stretching function is given in the below figure.


In this algorithm, the a and b are shifted along the reference intensity axis based on the value of g(x,y) keeping the width of reference range d fixed. The following equations explain how to obtain the a(x,y), b(x,y) and the contrast enhanced image I'(x,y).






You can get the c++/opencv based implementation of the SUACE algorithm from https://github.com/ravimalb/suace


Sample Images Enhanced by SUACE

Original Image


Enhanced with SUACE

Original Image

Enhanced with SUACE

The following image shows the performance comparison of different contrast enhancement algorithms applied to a retinal fundus image with their blood vessel segmentation outputs.

More details can be found in the two research papers which will be available in IEEE Xplore digital library in near future. But you can download the SUACE implementation in C++/OpenCV from here. 

Use the following BibTexts to cite our work. The papers are still in the "accepted" state so I will update the DOI once it is put in the IEEE Xplore digital library.

@inproceedings{bandara_super-efficient_2017,
address = {Peradeniya, Sri Lanka},
title = {Super-{Efficient} {Spatially} {Adaptive} {Contrast} {Enhancement} {Algorithm} for {Superficial} {Vein} {Imaging}},
booktitle = {2017 {IEEE} 12th {International} {Conference} on {Industrial} and {Information} {Systems} ({ICIIS}) ({ICIIS}'2017)},
author = {Bandara, Randitha and Kulathilake, Hemantha and Giragama, Manjula},
month = dec,
year = {2017},
keywords = {Adaptive Contrast Enhancement, Illumination Normalization, Mobile Computing, Real-time Vein Imaging}
}


@inproceedings{bandara_retinal_2017,
address = {Peradeniya, Sri Lanka},
title = {A {Retinal} {Image} {Enhancement} {Technique} for {Blood} {Vessel} {Segmentation} {Algorithm}},
author = {Bandara, Randitha and Giragama, Manjula},
month = dec,
year = {2017},
keywords = {Adaptive Contrast Enhancement, Illumination Normalization, Mobile Computing, Real-time Vein Imaging}
}

Comments

Popular posts from this blog

Sri Lanka Maps in Garmin GPS

Recently I received a Garmin GPS (nuvi 50) from my brother who is studying in China. The GPS looks fine but there are no Sri Lanka base maps installed in it. Then I tried to find a Sri Lanka road map that supports to the device. As I went through the articles I got to know that the format of the maps used in Garmin devices is a proprietary one. The map blocks are archived in to a single file which has the extension ".img" but not similar to DVD or floppy image file.

I found there are three methods to get Sri Lanka map to Garmin devices.

Download from the Garmin map resourcesDownload Sri Lanka maps from UMP (Unofficial Map Project)Download and convert maps from OpenStreetMap  (PS: I found this link of OpenStreetMap which seems to support routable maps and very easy to download maps of any country including Sri Lanka. http://garmin.openstreetmap.nl/)
The first method is bit expensive and I don't think that it is worth to buy map from Garmin because they don't give enoug…

How to Send Executable (.exe, .ocx, .dll, .com, .bat) Files in Gmail Without Changing the File Extension?

Why Gmail doesn't like exe files? If you use gmail as your email service probably you should be getting frustrated with it when you want to send files with the extensions exe, ocx, dll, com or bat. These executable stands for some files which can be executed independently within a typical operating system and there is a huge probability to contain computer viruses or malware in these types of files. Since these kind of files can be executed independently any virus that the file carried will infect our computers very easily.

Although this is not a problem in other free email services like yahoo, as Google has grabbed a big part from the services which we use for our day to day cyber needs, we can't move in to another service just because of this problem.

What happen when we are trying to upload an executable file in Gmail? When we attach an executable file first it upload the whole file and check on several criteria such as file extension (whether it contains .exe, .dll etc) a…

What minHessian, Octaves and Layers mean in SURF (Speeded-up Robust Feature)? QA

My previous article in this blog is about a discussion on measuring image similarities with BOF in a large database. It is an extracted part from a forum of an article posted in CodeProject "Bag-of-Features Descriptor on SIFT Features with OpenCV (BoF-SIFT)". This article is also an extracted part from the commenting section of the same article in the code project. As I described in my previous article, many people who used visual features do not have a proper understanding over the feature extraction and description algorithms because of these algorithms contain a lot of mathematical procedures which are difficult to understand with an average mathematical knowledge. The question which is about to discuss in this article has proved the above said fact and also the fact may cause the users to limit the usage of such features in their studies and applications.
Lets begin the discussion.

Q. I just wanted to ask why the minHessian value is 400, the number of octaves is 4, and th…