Friday, December 5, 2014

Enhancement: Brightness/Contrast and Histogram



The previous method based on the transfer function [Link] is powerful but you have to manually define the slope and the y-intercept of the transfer function. It is faster to directly modify the histogram.

Here is our test image...
Fig.1: Test image

2. Playing with the histogram


Fig.2: Histogram of the image in Fig.1

2.1. Normalization of the histogram
In the histogram of Fig. 2, there is no pixel value in the range of [0-50] and of [178-255].
It can be interesting to use all the pixel values available in a 8-bit image and thus to stretch the histogram between its extreme values (0 and 255) by interpolating all the values between 0 and 255. This operation is called the normalization of the histogram.

Go to Process > Math > Macro... and type the following formula:
min=50;max=178;v=(v-min)/(max-min)*255
The resulting image appears brighter and more contrasted. Then, run again the histogram by typing Ctrl + H. Et voilĂ ! the minimum and maximum values are 0 and 255, respectively.

Of course, it is implemented in ImageJ, go to Process > Enhance Contrast... . In the dialog window, set the Saturated Pixels to 0.0%  and check the Normalize checkbox.

Fig.3: Enhance Contrast Dialog Window

Check your histogram to be sure that the normalization is correct.
2.2. Equalization of the histogram
An ideal transfer function based on the cumulative histogram

[TODO]

3. Other crazybiocomputing posts

Further readings are available in ...
  • Image Enhancement Series  [Link]
  • Image Processing TOC [Link]

No comments:

Post a Comment