Chapter4 - Image Filtering and Restoration

43
DIGITAL IMAGE DIGITAL IMAGE PROCESSING PROCESSING CHAPTER4 - IMAGE FILTERING AND CHAPTER4 - IMAGE FILTERING AND RESTORATION RESTORATION TMM2443 TMM2443

description

IMAGE FILTERING

Transcript of Chapter4 - Image Filtering and Restoration

  • DIGITAL IMAGE PROCESSINGCHAPTER4 - IMAGE FILTERING AND RESTORATION TMM2443

  • What is image filtering?Image filtering allows you to apply various effects on photos. The type of image filtering described here is 2D filtering.Image filtering is a process by which we can enhance (or otherwise modify, warp, and mutilate) images.What is image filtering?Modify the pixels in an image based on some function of a local neighborhood of the pixels.Simplest: linear filteringReplace each pixel by a linear combination of its neighbors. The prescription for the linear combination is called the convolution kernel.a kernel, convolution matrix, or mask is a small matrix useful for blurring, sharpening, embossing, edge-detection, and more. This is accomplished by means of convolution between a kernel and an image.

  • What is image filtering?Depending on the element values, a kernel can cause a wide range of effects.

  • What is image filtering?

  • Median FilterThere are also nonlinear neighborhood operations that can be performed for the purpose of noise reduction that can do a better job of preserving edges than simple smoothing filters.One such method is known as median filtering.In median filtering, the neighboring pixels are ranked according to brightness (intensity) and the median value becomes the new value for the central pixel.Median filters can do an excellent job of removing certain types of noise, in particular, salt and pepper noise in which some individual pixels have extreme values.In the median filtering operation, the pixel values in the neighborhood window are ranked according to intensity, and the middle value (the median) becomes the output value for the pixel under evaluation.

  • Median Filter

  • Median Filter

  • Median FilterThe Median filters offer three advantages:No reduction in contrast across steps, since output values available consist only of those present in the neighborhood (no averages).Median filtering does not shift boundaries, as can happen with conventional smoothing filters (a contrast dependent problem).Since the median is less sensitive than the mean to extreme values (outliers), those extreme values are more effectively removed.

  • Median FilterThe median is, in a sense, a more robust average than the mean, as it is not affected by outliers (extreme values).Since the output pixel value is one of the neighboring values, new unrealistic values are not created near edges.Since edges are minimally degraded, median filters can be applied repeatedly, if necessary.Considerations:The median filter is more expensive to compute than a smoothing filter.Median filters are nonlinear: Median[A(x)+B(x)] ~= median[A(x)]+median[B(x)]

  • Median Filter

  • Median Filter (Conclusion)Median filter is the nonlinear filter more used to remove the impulsive noise from an image. Furthermore, it is a more robust method than the traditional linear filtering, because it preserves the sharp edges.Median filter is a spatial filtering operation, so it uses a 2-D mask that is applied to each pixel in the input image. To apply the mask means to center it in a pixel, evaluating the covered pixel brightnesses and determining which brightness value is the median value. Figure presents the concept of spatial filtering based on a 3x3 mask, where I is the input image and O is the output image.

  • Mean FilterMean filtering is a simple, natural and easy to implement method of smoothing images, i.e. reducing the amount of intensity variation between one pixel and the next. It is often used to reduce noise in images.The idea of mean filtering is simply to replace each pixel value in an image with the mean (`average') value of its neighbors, including itself. This has the effect of eliminating pixel values which are unrepresentative of their surroundings. Often a 33 square kernel is used, although larger kernels (e.g. 55 squares) can be used for more severe smoothing. (Note that a small kernel can be applied more than once in order to produce a similar but not identical effect as a single pass with a large kernel.)

  • Mean FilterFiltered ImageOriginal Image

  • Mean Vs. Median FiltersThe median filter considers each pixel in the image in turn and looks at its nearby neighbors to decide whether or not it is representative of its surroundings. It simply replaces the pixel value with the median of those values. The median is calculated by first sorting all the pixel values from the surrounding neighborhood into numerical order and then replacing the pixel being considered with the middle pixel value. (If the neighborhood under consideration contains an even number of pixels, the average of the two middle pixel values is used.) The mean filter on the other hand replaces the pixel value with the average value of the surrounding pixels, the mean filter works as convolving the filter with the image and extracts the average of the operation to be replaced as the new value of the pixel.

  • Mean Vs. Median Filters

  • Mean Vs. Median FiltersThe median is a more robust average than the mean and so a single very unrepresentative pixel in a neighborhood will not affect the median value significantly. Since the median value must actually be the value of one of the pixels in the neighborhood, the median filter does not create new unrealistic pixel values when the filter straddles an edge. For this reason the median filter is much better at preserving sharp edges than the mean filter.

    Both filters are used to reduce the noise in the digital image but the result of the median filter is much better than the mean filter.

  • Wiener filterIt is a linear filter that is extensively used to restore images degraded by additive white Gaussian noise . It attempts to reduce the mean square error (MSE) between the original and the estimated images. Likewise, this filter processes degraded images in the frequency domain. The equation of Wiener filter is:

    Where, (R) is the restored image, (H*) is the complex conjugate of the PSF, (|H|2) is (H* * PSF), (I) is the degraded image; () is a constant that represents the noise signal power density ratio.

  • The Point Spreading Function (PSF)

  • Wiener filter (example)

  • Laplacian Sharpening FilterThis filter sharpens the important features of the image such as lines and edges. Its usually employs a convolution operation to perform its sharpening task with a specific mask (kernel). The Laplacian sharpening method is a linear, spatial domain, and high pass filter.This filter own two types of masks, firstorder derivative masks and secondorder derivative masks. Some forms of Laplacian kernels can be convolved directly to the image to obtain the sharpened version of the image, this type of kernels is called firstorder derivative. Other forms of Laplacian kernels are convolved to the image to get a filter image. Then, this filter image will be subtracted from the blurred image to obtain the sharpened image, this type of kernels is called secondorder derivative. An example of the firstorder derivative kernel is the (9) core kernel. For the secondorder derivative kernels, are (-4) and (-8) core kernels.

  • Laplacian Sharpening Filter

    010111-1-1-11-411-81-19-1010111-1-1-1

  • Laplacian Sharpening Filter

  • Richardson-Lucy deblurring algorithmThe RL is an iterative algorithm.The RL algorithm has several advantages such as it requires fewer calculations and lower processing times for any iteration.Its early iterations are extremely effective.The RL algorithm is firm against minor PSF errors.It maintains the non-negativity.Its late iterations are not that effective due to the slow convergence because its non-linear.In the subsequent several iterations, the noise will be accentuated.The reason is that The R-L algorithm is sensitive to the noise existence, and it is considered as an inversion settlement.The RL algorithm may require hundreds or thousands of iterations to restore an image if the size of the image is large.The RL algorithm is used in the process of deconvolving images affected by a known PSF.

  • Richardson-Lucy deblurring algorithm

  • Richardson-Lucy deblurring algorithm

  • Histogram EqualizationThis method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values.The method is useful in images with backgrounds and foregrounds that are both bright or both dark. In particular, the method can lead to better views of bone structure in x-ray images, and to better detail in photographs that are over or under-exposed. The calculation is not computationally intensive.

  • Histogram EqualizationIt may increase the contrast of background noise, while decreasing the usable signal.Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like thermal, satellite or x-ray images.Suppose that u have the following matrix:

    821411158141215191031341016123141612719861495191413161117741451298121115101318141361018127111691812814171013

  • Histogram Equalization

  • Histogram Equalization

  • Histogram Equalization

  • Histogram Equalization

  • Normalization

  • Normalization

  • Measuring the image qualityThe value of an objective image quality metric is important, it can play a variety of roles. First, it can be used to monitor image quality in order to dynamically adjust it. An example is a network digital video server that examines the transmission quality and thereby can allocate streaming resources. Second, the metric can be employed to optimize parameter settings in image processing systems, such as bit assignment in a compression algorithm. Third, it can be used to benchmark image processing systems, a very important role in the research context.Image quality is difcult to assess for a number of reasons.Firstly, image quality is perceptual by nature. This makes it hard to measure in a standardized way and allows for personal preferences. Secondly, it can differ vastly between different domains. Acceptable disturbances in vacation photos are not the same as in x-ray images.

  • Image quality measurement methodsAverage Difference (AD)This technique is extensively employed to calculate the average difference between the pixel values of the processed image to the original image. Moreover, its mostly used when measuring the results of an experiment using synthetically degraded images.

    Where, (X) is denoted as the original image, X^ is the processed image, and (M, N) are the image dimensions. The lower outcome from Average Difference (AD) method indicates to improvement in the image quality and ideally it equals to zero

  • Image quality measurement methodsNormalized Absolute Error (NAE)This technique measures exactly what is the difference between the processed image and the original image. Its the numerical variance between the restored and the original image. The result of this method falls into the interval of values between [0 and 1]. Moreover, the results that are near to zero means that the image have high similarity to the original one and the results near the value one indicates that the image have a very poor quality . The equation of (NAE) is :

  • Image quality measurement methodsRoot Mean square error (RMSE)This technique is simply the square root of the mean square error (MSE) which is the average squared difference between all the pixels in the original and the restored image. Furthermore, it measures the volume of alteration per pixel between the two images. The lower the results of RMSE mean less error between the original and the restored image and that means a better image quality. The RMSE can be described using the subsequent equation:

  • Image quality measurement methodsPeak Signal to Noise Ratio (PSNR)This PSNR is an easy well-known technique that is used to consider the accuracy between the original image and its reconstructed version. Furthermore, the greater PSNR value indicates that the resulted image is more similar to the original one. Perfectly the value of PSNR is infinity, basically its value falls into the interval of 25 to 40dB. In general, higher PSNR the better results. It is typically expressed as a logarithmic decibel. The PSNR can be calculated using the subsequent formula :

  • Image quality measurement methodsPeak Signal to Noise Ratio (PSNR)

    Where, (Max) is the maximum value of the intensities that is either 1 or 255. The measuring unit for PSNR is dB. This technique is used widely to assess the distorted or the reconstructed images to the original one. a note should be taken that higher PSNR values do not constantly reflect a better quality because the signal-to-noise methods do not associate with human subjective perception.

  • Image quality measurement methods (examples)

    ImagesADNAEPSNRRMSENoisy with AWGN = 0.006-0.00510.163623.38320.0046Its Restored Version0.00440.118925.84030.0026

  • Image quality measurement methods (examples)

    ImagesADNAEPSNRRMSE1st Image LC (-40)-6.5228e-0050.416516.42790.0228Its Enhanced Version-0.02500.085529.23360.0012

  • Image quality measurement methods (examples)

    ImagesADNAEPSNRRMSE1st Image GB (R=1)-1.0626e-0050.045029.27290.0012Its Restored Version0.00370.036531.93366.4067e-004

  • THE END