Gray-Scale Histogram



Дата20.04.2016
Памер10.25 Kb.
#15421

Gray-Scale Histogram


The gray-scale histogram of an image represents the distribution of the pixels in the image over the gray-level scale. It can be visualised as if each pixel is placed in a bin corresponding to the colour intensity of that pixel. All of the pixels in each bin are then added up and displayed on a graph. This graph is the histogram of the image. Figure 1 below illustrates the histogram of a sample image. The frequencies of all the intensity levels can be seen, and the image can be analysed based on this.


Figure 1 Example of an image with its histogram [1]
The histogram is a key tool in image processing. It is one of the most useful techniques in gathering information about an image. It is especially useful in viewing the contrast of an image. If the grey-levels are concentrated near a certain level the image is low contrast. Likewise if they are well spread out, it defines a high contrast image.

Contrast Stretching


This algorithm was considered for the project, but not used in the final design. Contrast stretching enables the spacing of some of the output values so that they are further apart, thereby making them more easily distinguishable. This can be done manually by choosing the upper and lower bound of the histogram and adjusting the graph to fit. It can also be done automatically by implementing the histogram-equalised stretch.

Histogram Equalised Stretch


This stretch assigns more display values to the frequently occurring portions of the histogram. In this way, the detail in these areas will be better enhanced relative to those areas of the original histogram where values occur less frequently. The aim is to maximise the overall contrast: as shown below, a nearly uniform (i.e. flat) distribution is produced.



Figure 2 Histogram Equalisation
As can be seen in figure 3 below, after an image has been equalised the features become much more defined and easier to identify for the viewer.


Figure 3 Image before and after equalisation
This technique is not implemented in this project. It would be a useful addition as it makes a clear point for thresholding much more obvious. Instead of selecting a point out of a mostly grey image, the system can select a value between high contrasting colours. This means that the system is more likely to select a suitable threshold value.

Thresholding


A simple segmentation technique that is very useful for scenes with solid objects resting on a contrasting background. All pixels above a determined (threshold) grey level are assumed to belong to the object, and all pixels below that level are assumed to be outside the object. The selection of the threshold level is very important, as it will affect any measurements of parameters concerning the object (the exact object boundary is very sensitive to the grey threshold level chosen). Thresholding is often carried out on images with bimodal distributions. This is explained below. The best threshold level is normally taken as the lowest point in the trough between the two peaks (as above) alternatively, the mid-point between the two peaks may be chosen.

Figure 4 below illustrates the application of a thresholding algorithm on a sample image. It clearly identifies the objects of interest in the image, and removes any noise present.





Figure 4 Thresholding Application

Bimodal Distribution


These are images with one clear peak for the background, and one clear peak for the foreground. The fact that an image has bimodal distribution means that it is a suitable image for segmentation. The system will find the two peaks, and average them. This average value is more likely to be accurate with a good bimodal image. Figure 1 shows an image with its histogram. This is a good example of bimodal distribution.

Implementation of Processing Algorithms

Histogram


There are two main components used in the implementation of a histogram. These are comparators and counters. This histogram consists of 8 different intensity levels or ‘bins’. For each bin there is one set of two comparators and a counter. If the intensity level of the first pixel is, for example, between 0 and 32 then the counter for the first bin will increment by 1. The pixels are read 1 at a time until the entire image has been processed. The result of this algorithm is the value that each counter has reached after processing.

Differential Histogram


This algorithm uses the results from the original histogram algorithm to help find the threshold point in the image. The original histogram is scanned. Each value in the differential histogram is the subtraction of that value in the histogram from the previous value in the histogram. This gives each peak in the histogram a negative value in the differential curve.

Thresholding


The threshold value is calculated using the differential histogram. The negative values of the curve are stored. The highest and lowest intensity values with a peak are stored. The threshold value is calculated as the average of these points. This is a fairly basic method of thresholding, but is effective with the majority of images. It is particularly effective with bimodal images.


Поделитесь с Вашими друзьями:




База данных защищена авторским правом ©shkola.of.by 2022
звярнуцца да адміністрацыі

    Галоўная старонка