Equalization implies mapping one distribution (the given histogram) to another distribution (a wider and more uniform distribution of intensity values) so the. Histogram equalization is a technique for adjusting image intensities to enhance contrast. normalized histogram of f with a bin for each possible intensity. So. Histogram is a graphical representation of the intensity distribution of an image. In simple terms, it represents the number of pixels for each.
|Published (Last):||1 June 2014|
|PDF File Size:||11.32 Mb|
|ePub File Size:||14.28 Mb|
|Price:||Free* [*Free Regsitration Required]|
The objective of this first project is to develop and implement some image processing functions based on the histogram of an Image.
In a first part we will present briefly some theoretical aspects associated with histograms and the processing associated. Then we will present the different functions and processing we developed for this project. We will try to explain and present all the results and the step we’ve been through in this project.
The code evolved a lot while I was writing this report, so some images produced may not be the exact same as the one I’ve used in this report. The structure of this report is following the subject but sometimes I have considered several questions at the same time. I made all the other drawing or images so there is no Copyright infringement in this work. A digital image is a discrete space composed of small surface elements called pixel.
Each one of this elements contains a value or a set of value coding the intensity level at each position. A digital image can be acquired with a great number of different devices such as a camera, an MRI machine or any kind of device with a sensor able to capture light intensity.
Because of its discrete nature, the theory used to process digital image will rely on discrete domain, even if the analogy with the continuous domain is possible. A gray scale image is a digital image in which each pixel only contains one scalar value which is its intensity. The number of possible levels intensity values depends on the numerical type encoding the image. A color image is a digital array of pixel containing a color information. Each image can be decomposed into three different layers according to the three color channels encoded: Red, Green and Blue.
For instance, a 8 eight bits color images encode the Red and Green channel with three bits and the blue with two. Which could encode different colors. The histogram of a digital image is a distribution of its discrete intensity levels in the range [0,L-1].
The distribution is a discrete function h associating to each intensity level: Normalize an histogram is a technique consisting into transforming the discrete distribution of intensities into a discrete distribution of probabilities.
To do so, we need to divide each value of the histogram by the number of pixel. Because a digital image is a discrete set of values that could be seen as a matrix and it’s equivalent to divide each n k by the dimension of the array which histobram the product of the width by the length of the image. Histogram equalization is a method to process images in order to adjust the contrast of an image by modifying the intensity distribution of the histogram.
Histogrma objective of this technique is to give a linear trend to the cumulative probability function associated to the image. The processing of histogram equalization relies on the use of the cumulative probability function cdf. The cdf is a cumulative sum of all the probabilities lying in its domain and defined by:. The idea of this processing is to give to the equqlisation image a linear cumulative distribution function.
Indeed, a linear cdf is associated to the uniform histogram that we want the resulting image to have. Segmentation is an operation consisting in partitioning an image into sets of elements. One of the method to do that is thresholding which consist in converting equa,isation gray-scale image into a binary image. The most important step here is to chose the best value for the threshold to get the best segmentation.
Several methods exists to determine equaliastion.
MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms and a lot of many other things.
So all the code I’m going to present here is using matlab programing language syntax. But all algorithm will work with equalistaion other languages. A more detailed presentation of the code is available in the Implementation section. An histogram being a distribution of the number of pixel according to their intensities, we have in this part to analyze the image to determine this distribution.
Then we will perform some other operations to allow the user to enter the number of desired bins for the histogram and the range of values that should cover the histogram. We developed a function that is taking as input a 2 dimension array a digital image containing for each pixel an associated intensity value. The type used to eqqualisation these values can either be integers or floats.
The hisyogram is converting this 2 dimension array into a single dimension array containing the frequency of each intensity level. In the previous result, we are just displaying the absolute frequency which is the number of equaoisation.
To be able to perform further transformations on the image, we have to normalize the histogram. The normalization will give to our distribution the properties of a probability density hiwtogram. To get this result, we used the formula given in the theoretical part. The objective in this part is also to be able to modify the different parameters of the histogram.
Indeed, we want to be able to specify the number of bins and also its range.
So we need to determine the size of each new bin and then perform a test on the value of the histogram to find in which bins it lies. To compute equailsation size of the new bin, we use the following formula:. Note that in this case we consider a rounding for computing the size. The brace uses Kenneth E. Iverson notation of the rounding function.
So the final function we produced is taking an image as input and providing an histogram with a specified number of bins and range. Examples are provided in the following section. In this section, we are going to show different histograms associated to different images and try to explain and interpret them in regard to the image we gave as input. On the previous figure, we can see that the input picture equalisagion really dark.
We can see this aspect while looking at the associated normalized histogram where we can see eqjalisation the histogram is located on the left side which correspond to the darkest gray levels.
Histogram Equalization – Towards Data Science
hisotgram Indeed, on that image the skull of the head is clearly appearing equlaisation and there is also a huge number of pixel with an intermediate gray level.
The background is black and is representing a big part of the image. So it makes sense to have three different “regions” on the histogram: Let’s apply here a restriction on the range of the histogram we are displaying so it only focuses on the regions corresponding to the middle range of the histogram i.
So we are considering only the range of values between 50 and We can also generate the histogram of the other images. With an intensity range going from 0 to for chang. We can also give as input a digital color image. Then the first equalisaton to do is equzlisation separate hietogram three different color channels: Here we can clearly see that the distribution of the intensity on each channel is clearly different.
The color image is obtained while combining the three layers. We obtain the following result:. In this part we are only going to consider Gray scale images. As we have seen before, some images are really dark and have their histogram concentrated on the lower values of the intensity. So the objective of this part is to enhance the contrast of the image by equalizing the histogram.
To perform this operation, we are going histogramm implement the formula presented histogrqm the section IIIB of theoretical part at the beginning of this report. To do so, we will need to perform as a first step the computation of the histogram of ewualisation input image. To do so, we can call the function histogram we have already implemented in the previous part.
A detailed explanation of the code is available in the Implementation part. As we can see on the previous figure, if we compare the two images we can see that the contrast of the image has clearly been enhanced by performing hiistogram.
The success of the procedure is proven by the histogram associated to each image, showing that it’s range has been stretched to occupy the whole spectrum of levels. We also have an expected result for the cumulative distribution function because we have an almost linear cdf. In terms of qualitative judgment on the image, we can clearly see that the contrast is better because we are now able to see what eqhalisation at the background and that the picture is really showing a crowd, which was not that obvious before.
The two previous pictures: On these images, the histogram equalization is really stretching the histogram and allow us to really see the details of the image that we were not able to see before. Let’s interpret the resulting cumulative distribution. As we can see it’s compose of different steps, which approximate a line. The reason why the steps are bigger is because originaly, the histogram was really compressed on the left and the equalization stretched it over the whole range of values.
So the higher the peaks are, the higher equalisatioj step is on the cdf. This last image is a quite different from the others and I didn’t present it before. So as we can see on its histogram, we have a peak of dark gray values that probably represent the background of the image and then a wide range of values on more brighter intensities.
So it’s pretty logical to have a cumulative density function with such a behavior: So, the cumulative distribution functions looks more like a line because the histogram hasn’t been stretch as much as the other images because its original histogram was already distributed on the whole range of intensities.
So this is why the result doesn’t seem to be changed a lot and the contrast stays quite the same. We can see some more details but this could maybe be enhanced more. So we can conclude this part that histogram equalization really depends on the initial distribution of intensity levels. If they are concentrated on one side of the histogram, equalization will stretched it to cover the whole range and will enhance contrast.
But if the histogram is already distributed over almost the whole range of intensities, equalization will not be as effective because the stretch is not going to be as strong so it’s not going to change a lot the intensity distribution.
I decided to run the histogram equalization technique on other images with different types of histogram to see how this is affecting them. Here are the results:. On the previous result, we can see that the input image has an histogram occupying the whole range of gray levels and with a cumulative distribution which is going up really smoothly without big steps.