1、2 Histogram Equalization 12.1 Central Ideas 12.2 Application Scenario 12.3 Cumulative Distribution Function 12.4 Advantages and Disadvantages 22.5 Algorithm 22.6 The results 33 Noise Reduction 53.1 Type of this Noise 53.2 Median Filter 53.2.1 Main Idea 53.2.2 Application Scenario 63.2.3 Algorithm 63
2、.2.4 The results 63.3 Averaging Filter 83.3.1 Introduction 83.3.2 Algorithm 83.3.3 The results 94 Gaussian high pass filters 104.1 Introduction 104.2 Algorithm 114.3 The results 115 Conclusion 151 IntroductionIn this project we mainly solve three problems about image enhancement. The first question
3、is histogram equalization, the second question is noise reduction, andthethird question is Gaussian high pass filters. I solve the three question by using python programming language.2 Histogram Equalization2.1 Central IdeasThe histogram is based on the statistics of the grey levels of pixels.Histog
4、ram equalization is a method of adjusting the contrast using image histograms in the field of image processing. Histogram equalization is done by using the cumulative distribution function to adjust the gray value to achieve the purpose of contrast enhancement. The central idea of histogram equaliza
5、tion is to change the gray histogram of the original image from a relatively concentrated gray scale to a uniform distribution over the entire gray scale, which increases the dynamic range of the pixel gray scale value so as to achieve the effect of enhancing the overall contrast of the image. Histo
6、gram equalization is the non-linear stretching of the image, redistribute of image pixel values, to make the number of pixels in a certain gray scale range approximately the same. Histogram equalization is to change the histogram distribution of a given image to a uniform distribution histogram dist
7、ribution.2.2 Application ScenarioThis method is often used to increase the local contrast of many images, especially when the contrast of the useful data of the image is fairly close. In this way, the brightness can be better distributed over the histogram. This can be used to enhance the local cont
8、rast without affecting the overall contrast, histogram equalization by effectively expanding the commonly used brightness to achieve this function. This method is very useful for backgrounds and prospects that are too bright or too dark,for example,skeletal structures in X-ray images, overexposure o
9、r underexposure photos.2.3 Cumulative Distribution FunctionEqualization process, we must ensure that the two conditions: no matter how the pixel map, we must ensure that the gray size relationship of original image keep unchanged, the bright area is still brighter, dark still dark, but the contrast
10、increases.If it is an eight-bit image, then the value of the pixel mapping function should be between 0 and 255,do notcross the border.Based on the above two conditions, the cumulative distribution function is a good choice, because the cumulative distributionfunction is a monotonically increasing f
11、unction (To ensure that the enhanced processing does not disrupt the grayscale order of the original image), and the range is 0 to 1.2.4 Advantages and DisadvantagesAdvantages It is a fairly intuitive technique and is a reversible operation. If the equalization function is known, then the original h
12、istogram can be restored and the amount of computation is not large.Disadvantages1. The gray scale of the transformed image is reduced and some details disappear2. Some images, if the histogram have a peak, after treatment, the contrast is unnatural.3. It does not select the data to be processed, it
13、 may increase the contrast of the background and reduce the contrast of the useful signal2.5 AlgorithmThe histogram equalization algorithm is divided into three steps. 1. Count the number of pixels in each appearing gray level. Then map(gray level,the number of pixels of this gray level).2. Sort by
14、the gray level3. For every gray level, Sum all the number of pixels of gray level before it including the number of pixels of it. Then map (gray level, sum the number of pixels still to current gray level)4. For every gray level, normalize “sum the number of pixels still to current gray level”5. eve
15、ry normalized result *2552.6 The resultsFigure 1 the histogram of original imageFigure 2histogram after histogram equalizationFigure 3original imageFigure 4image after histogram equalizationWeget the uniform distribution histogram over the entire gray scale, compared to the gray histogram of the ori
16、ginal image from a relatively concentrated gray scale .We achieve the effect of enhancing the overall contrast of the image.3 NoiseReduction3.1 Type of this NoiseFigure5 image bWe will remove the noise from the image b.Filtering is often used to remove noise from images. We can know the noise in ima
17、ge b is salt and pepper. Salt-and-pepper noise also called impulse noise, it presents itself as sparsely occurring white and black pixels.Salt-and-pepper noise is produced by the image sensor, transmission channel, decoding processing. As we can those black or white points are very different from th
18、e pixels around it, so we regard them as exception value.So we can replace exception value with pixels around it.An effective noise reduction method for this type of noise is a median filter. In addition, we try the effect of averaging filter.3.2 Median Filter3.2.1 Main IdeaMedian filter is a nonlin
19、ear digital filtering technique.Thebasic principle of median filter is that we replace the value of a point in the digital image or a sequence of digit with the median of each point in neighbors of the point in order to eliminate isolated noise points.The method is to use two-dimensional sliding tem
20、plate, the template is called the “window”. If the window has an odd number of points,it is just the middle value after all the pixels in the window are sorted numerically.3.2.2 Application ScenarioMedian filter is particularly effective in the presence of salt-and-pepper noise3.2.3 Algorithmedge =
21、step/ 2 for i in range(edge, image height -edge) for j in range(edge, image width -edge) sum= for k in range(-edge,edge+1):for m in range(-edge,edge+1): sum.append(imagei+kj+m)sum.sort()imageij=sumint(step*step/2)+13.2.4 The resultsFigure 6 median filterFigure 7 Figure 8 We can see from the Figure 6
22、-8 that median filter is particularly effective in the presence of salt-and-pepper noise and the larger the size of the window,the moreblurry the image becomes. We can find thatmedian filter cant filter the edge noise.3.3 Averaging Filter3.3.1 IntroductionAveraging filter is a typical linear filteri
23、ng algorithm. Its principle is that replace the original pixel value with the average pixel of all pixels around it. Averaging filter destroys the details of the image while reduce noise of the image, so that the image becomes blurred and the noise is not well removed. For Gaussian noise, the effect
24、 of the mean filtering is better than that of the median filter.3.3.2 Algorithmimageij=sum.sum/(step*step)3.3.3 The resultsFigure 9 averaging filterWe can see from the Figure 9 that the image is very blurry. For salt-and-pepper noise,the median filter is better than averaging filter.4 Gaussian highp
25、ass filters4.1 IntroductionFigure 10 image cA Gaussian filter is a class of linear smoothing filters that select weights based on the shape of the Gaussian function. The Gaussian smoothing filter is very effective in suppressing noise from the normal distribution. Gaussian Sharpencan make image look
26、 clearer by modifying the difference between the light and dark points, and can produce more obvious contrast between bright and dark pixels.In Fourier transform, the low frequencies are responsible for the general grey level appearance of an image over smooth areas. The higher frequencies begin to
27、correspond to faster and faster gray level changes in the image.High pass filters only pass the high frequencies, drop the low ones.Details such as edges and noises in images are associated with high frequency components, so we can get edges and fine detail information by high pass filters. We will
28、enhance the image in the frequency domain, firstly we will get the discrete Fourier transform of the image.The transfer function of a Gaussian high pass filter is defined as:is the cut-off frequency, is the square of the distance from the point in the image to the center point.4.2 Algorithm1. The fa
29、st Fourier transform algorithm is used to obtain the frequency distribution2. The default result center point position is in the upper left corner, move it to the middle position, get fshift 3. Get the width and height of this image4. Make the cut off distanceD0equal 15,30,805. Get center point coor
30、dinate (m,n) of this image6. Traverse each point coordinate (i, j) in the image7. d=the square of(i-m)+the square(n-j)8. h=exp(-d/(2*the square ofD0)9. Resultij=(1-h)*fshiftij10. Then back to the spatial domain to restore the image4.3 The resultsFigure 11 Fourier spectrum of the image cFigure 12 Res
31、ults of Gaussian high pass filtering with D0 = 15Figure 13 Fourier spectrum of image of Gaussian high pass filtering with D0 = 15Figure 14 Results of Gaussian high pass filtering with D0 = 30Figure 15Fourier spectrum of image of Gaussian high pass filtering with D0 = 30Figure 16Results of Gaussian high pass filtering with D0 = 80Figure 17Fourier spect