c37ce51bf330e315b028d3c465d50065.ppt
- Количество слайдов: 79
Chap. 10 Digital Filters 숙명여자대학교 컴퓨터과학과 최영우 2005년 2학기
Abstract (I) n Image Processing Filters Æ To suppress either the high frequencies in the image ð Smoothing the image Æ Or, to suppress the low frequencies in the image ð Enhancing or detecting edges in the image n An image can be filtered either in the frequency or in the spatial domain. Æ In the frequency domain ð Transform the image into the frequency domain. ð Multiply it with the frequency filter function. ð Re-transform the result into the spatial domain. Æ In the spatial domain ð Convolve the input image f(i, j) with the filter function h(i, j).
Abstract (II) Æ For a square kernel with a size Mx. M, the output image is calculated with the following formula by shift and multiply. n The mathematical operation is identical to the multiplication in the frequency domain, but the results of the digital implementations vary. Æ Since we have to approximate the filter function with a discrete and finite kernel.
Mean Filter (I) n Brief Description Æ Simple and easy method of smoothing images Æ Used to reduce noise in the images. n How It Works Æ Replace each pixel value in an image with the mean(average) value of its neighbors including itself. Æ The effect will eliminate pixel values which are unrepresentative of their surroundings. Æ Usually thought of as a convolution filter.
Mean Filter (I) Æ Example: Often a 3*3 square kernel is used. 3*3 averaging kernel ð Computing convolution of an image with this kernel carries out the mean filtering. ð Larger kernels(e. g. 5*5 squares) can be used for more severe smoothing.
Mean Filter (II) n Guidelines For Use Æ Example: Used as a simple method for reducing noise Original image Gaussian noise ( =8, m=0) Applying a 3*3 mean filter Applying a 5*5 mean filter Note that the noise is less apparent, but the image has been softened or blurred.
Mean Filter (III) ÆExample: Shows an image containing salt and pepper shot noise Salt and pepper Applying a 3*3 mean filter Applying a 5*5 mean filter ð a significant improvement in noise reduction. Not ð image is now very blurred. The
Mean Filter (III) Æ Two main problems with mean filtering ð A single pixel with a very unrepresentative value can significantly affect the mean value of all the pixels in its neighborhood. ð When the filter neighborhood straddles an edge, the filter will interpolate new values for pixels on the edge and so will blur that edge.
Mean Filter (IV) Æ The mean filter acts as a low-pass frequency filter. ð Reduce the spatial intensity derivatives present in the image. magnitude cut-off frequency = 1/3 frequency Ideal low-pass filter
Mean Filter (V) Æ Example: Applying the mean filter to an image Original image Passing a 3*3 filter over original image three times Applying a 7*7 mean filter ð Note that the low spatial frequency information in the background has not been affected significantly by filtering, but the edges of the foreground object have been appreciably smoothed.
Median Filter (I) n Brief Description Æ Used to reduce noise in an image, somewhat like the mean filter. n How It Works Æ Sort all the pixel values from the surrounding neighborhood into the numerical order. Æ Then, replace the pixel with the middle pixel value. ð If the neighborhood contains an even number of pixels, the average of the two middle pixel value can be used.
Median Filter (II) ÆExample: Calculate the median value of a pixel neighborhood 123 125 126 130 140 122 124 126 127 135 118 120 150 125 134 119 115 119 123 133 neighborhood values : 115, 119, 120, 123, 124 125, 126, 127, 150 median value : 124 111 116 110 120 130 ð The central pixel value of 150 is rather unrepresentative of the surrounding pixels and is replaced with the median value of 124.
Median Filter (III) n Guidelines for Use Æ Two main advantages of the mean filter ð The 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. - Much better at preserving sharp edges than the mean filter.
Median Filter (IV) Æ Example: An image corrupted by Gaussian noise ( Original image =8, m=0) Applying a 3*3 median filter ð Note how the noise has been reduced at the expense of a slight degradation in the image quality.
Median Filter (V) Æ Example: An image corrupted by even more noise Gaussian noise ( = 13, m = 0 ) Applying a 3*3 median filter ð The median filter is sometimes not as subjectively good at dealing with large amounts of Gaussian noise as the mean filter.
Median Filter (VI) Æ Example: An image corrupted by salt and pepper noise Salt & pepper noise (flipped with probability 1%) Applying a 3*3 mean filter Applying a 3*3 median filter
Median Filter (VII) Æ Example: An image corrupted by even more noise Original image Salt & pepper noise Applying a 3*3 median filter
Median Filter (VIII) Æ Example: Remove all the noise with less loss of detail. Salt & pepper noise Applying (flipped with probability 5%) a 7*7 median filter Passing a 3*3 filter over original image three times ð With 7 x 7 all the noisy pixels disappear. Note that the image is beginning to look a bit ‘blotchy’ as gray-level regions are mapped together. ð We can pass a 3 x 3 median filter over the image three times in order to remove all the noise with less loss of detail.
Median Filter (IX) Æ The median filter allows a great deal of high spatial frequency detail to pass while very effectively removing noise on the images. Æ It is relatively expensive and complex to compute. ð To find the median it is necessary to sort all the values in the neighborhood and this is relatively slow, even with fast sorting algorithms such as a quick sort.
Gaussian Smoothing (I) n Brief Description Æ Used to blur images and remove detail and noise. n How It Works Æ Gaussian distribution 1 -D m = 0,
Gaussian Smoothing (II) Æ Gaussian distribution 2 -D ð an isotropic (i. e. circularly symmetric) m = (0, 0), Æ Idea of Gaussian smoothing ð To use this 2 -D distribution as a `point-spread' function ð Performed using convolution methods
Gaussian Smoothing (III) Æ Example: Suitable integer-valued convolution kernel that approximates a Gaussian 2 4 5 4 2 4 9 12 9 4 5 12 15 12 5 4 9 12 9 4 2 4 5 4 2 Discrete approximation to Gaussian function with ð Once a suitable mask has been calculated, then the Gaussian smoothing can be performed using standard convolution methods.
Gaussian Smoothing (IV) Æ The 2 -D isotropic Gaussian is separable into x and y components. ð First convolving with a 1 -D Gaussian in the x direction ð And then convolving with another 1 -D Gaussian in the y direction 1. 3 3. 2 3. 8 3. 2 1. 3 One of the pair of 1 -D convolution masks ð Used to calculate the full mask more quickly.
Gaussian Smoothing (V) n Guidelines For Use Æ A Gaussian provides gentler smoothing and preserves edges better than a similar size mean filter. ð Average weighted more towards the value of the central pixels Æ One of the principle justifications is due to its frequency response. ð Most convolution based smoothing filters act as low pass frequency filters.
Gaussian Smoothing (VI) Æ Both filters attenuate high frequencies more than low frequencies. ð The mean filter exhibits oscillations in its frequency response. - 1 -D mean filter with width 7 response ð The Gaussian on the other hand shows no oscillations ( =3). spatial frequency Frequency response of box (i. e. mean) filter spatial frequency Frequency response of Gaussian filter
Gaussian Smoothing (VII) Æ Example Original image Filtering with a Gaussian of = 1. 0 Gaussian of = 2. 0 Gaussian of = 4. 0 (and mask size 5*5) (and mask size 9*9) (and mask size 15*15) ð Illustrate the effect of smoothing with successively larger Gaussian filters
Gaussian Smoothing (VIII) Æ Example: Gaussian filter for noise reduction Gaussian noise ( = 8, m = 0) Applying a 5*5 Gaussian filter Applying a 5* 5 mean filter Applying a 3*3 median filter ð Compare results with that achieved by the mean and median filters.
Gaussian Smoothing (IX) ÆExample : An image corrupted by salt and pepper noise Applying a 3*3 (flipped with probability 1%) a 3*3 Gaussian filter median filter ð Note that much of the noise still exists and that it has been smeared out over a larger spatial region. ð This type of noise is better reduced using median filtering. Salt & pepper noise
Gaussian Function [ One of the pair of 1 -D convolution masks ] 1. 3 3. 2 3. 8 3. 2 1. 3 2 4 5 4 2 1. 3 1. 7 4. 2 4. 9 4. 2 1. 7 4 9 12 9 4 3. 2 4. 2 10. 5 12. 2 10. 5 4. 2 5 12 15 12 5 3. 8 4. 9 12. 2 14. 5 12. 2 4. 9 4 9 12 9 4 3. 2 4. 2 10. 5 12. 2 10. 5 4. 2 2 4 5 4 2 1. 3 1. 7 4. 2 4. 9 4. 2 1. 7 [ 2 D Gaussian function]
Conservative Smoothing (I) n Brief Description Æ Noise reduction technique Æ A simple, fast filtering algorithm that sacrifices noise suppression power in order to preserve the high spatial frequency detail in an image Æ Designed to remove noise spikes - isolated pixels of exceptionally low or high pixel intensity (salt and pepper noise) Æ Less effective at removing additive noise (Gaussian noise)
Conservative Smoothing (II) n How It Works Æ On the assumption that noise has a high spatial frequency Æ Attenuated by a local operation which makes each pixel's intensity roughly consistent with those of its nearest neighbors Æ Each pixel's intensity is bounded within the range of intensities of its neighbors.
Conservative Smoothing (III) Æ The minimum value < central pixel intensity < the maximum value ð Central pixel value is unchanged. Æ Central pixel intensity > the maximum value ð Set equal to the maximum value. Æ Central pixel intensity < the minimum value ð Set equal to the minimum value.
Conservative Smoothing (IV) Æ Example 123 125 126 130 140 122 124 126 127 135 118 120 150 125 134 119 115 119 123 133 111 116 110 120 130 ð Neighborhood values : - 115, 119, 120, 123, 124, 125, 126, 127, 150 - max : 127 min : 115 - Center intensity : 150 > max : 127 Center intensity = 127
Conservative Smoothing (V) n Guidelines for Use Æ Most frequent noise ð Additive noise (e. g. Gaussian noise) ð Impulse noise (e. g. salt and pepper noise) Æ Linear filter (such as mean filter) ð Primary tools for smoothing digital images degraded by additive noise. ð In suppressing the noise, edges were blurred and detail was lost. ð Tend to reduce the magnitude of an intensity gradient. ð Cannot totally eliminate impulse noise (single pixel which acts as an intensity spike can contribute significantly to the weighted average of the filter).
Conservative Smoothing (VI) Æ Example: Linear filtering (case of additive noise) Original image Add Gaussian noise (m=0, =13) Mean filtering 3 by 3 kernel ð Mean filtering is very effective to remove additive noise (Gaussian noise).
Conservative Smoothing (VII) Æ Non-linear noise suppression technique (such as the median filtering or conservative smoothing) ð Preserves spatial resolution by re-using pixel intensity values already in the original image. ð Non-linear filter can be robust to impulse noise. (Single outlier pixel intensity can be eliminated entirely. )
Conservative Smoothing (VIII) Æ Example: Non-linear filtering (case of additive noise) Mean filtering Median filtering Conservative smoothing ð Non-linear filtering preserves the details of image but not remove noise perfectly.
Conservative Smoothing (IX) Æ Example: Non-linear filtering (case of impulse noise) Salt & pepper noise 3 by 3 median filter Conservative smoothing ð Produces an image which still contains some noise in places. But, no image detail has been lost.
Conservative Smoothing (X) Æ Example: Median filtering vs. conservative smoothing Original image Noisy image Median filtering Conservative ð Conservative smoothing removes more noise than median filtering, but image is corrupted badly.
Crimmins Speckle Removal (I) n Brief Description Æ This reduces speckle from an image using the Crimmins complementary hulling algorithm. ð The algorithm has been specifically designed to reduce the intensity of salt and pepper noise in an image. n How It Works Æ This uses a non-linear noise reduction technique which compares the intensity of each pixel in an image with those of its 8 nearest neighbors and, based upon the relative values, increments or decrements the value of the pixel.
Crimmins Speckle Removal (II) ÆAlgorithm Input image Reduce pepper noise If center_pixel darker than northern_neighbor, then lighten center_pixel. Reduce pepper noise repeat for E-W, SE-NW, & NE-SW neighbor pairs. . . If center_pixel darker than southern_neighbor, then lighten center_pixel. Reduce salt noise If center_pixel lighter than northern_neighbor, then darken center_pixel. Reduce salt noise Output image If center_pixel lighter than southern_neighbor, then darken center_pixel.
Crimmins Speckle Removal (III) n Guidelines For Use Æ Example Noisy Image One iteration of Crimmins Removal Four iterations Eight iterations ð We can corrupt this image with a small amount (i. e. p=0. 1% that a bit is flipped) of salt and pepper noise. ð And then use several iterations of the Crimmins speckle removal algorithm to clean it up. ð It took 8 iterations to produce relatively noise-free image.
Crimmins Speckle Removal (IV) Æ Example: Significant noise still exists. Original noisy image Speckle filtered image after 1 iteration Speckle filtered image after 4 iteration ð By increasing the number of iterations of the algorithm, we increase the extent of this effect, and hence, incur blurring. ð If we keep increasing the number of iterations, we would obtain an image with very little contrast, as all sharp gradients will be smoothed down.
Crimmins Speckle Removal (V) Æ Example Original Image Noisy Image (Salt & Pepper) 13 iterations of Crimmins speckle removal ð In order to remove all the noise, 13 iterations of Crimmins speckle removal are required. ð Much detail has been sacrificed. ð We can obtain better performance if we use fewer iterations of the algorithm.
Crimmins Speckle Removal (VI) ÆExample Noisy Image (Salt & Pepper) 8 iterations of Crimmins speckle removal ð Applying 8 iterations of Crimmins speckle removal to the face corrupted with 5% salt noise yields right-side image. ð The snow has been removed from the light regions on the subject's face and sweater, but remains in areas where the background is dark.
Crimmins Speckle Removal (VII) Æ Example Noisy Image (Gaussian) Only 2 iterations of Crimmins speckle removal ð We can use Crimmins to smooth the Gaussian noise corrupted image (zero mean and =8). ð The Crimmins speckle removal algorithm is most useful on images corrupted by noise whose values are not more than a couple intensity levels different from those in the underlying image.
Crimmins Speckle Removal (VIII) Æ Example: Comparison with other filters 3 x 3 mean filter 5 x 5 mean filter Crimmins filter ð The Gaussian noise components being smoothed away after very few iterations.
Crimmins Speckle Removal (IX) Æ Example: Comparison with other filters (continued) 5 x 5 Gaussian filter 3 x 3 median filter Crimmins filter ð If we allow a little noise in the output of the Crimmins filter, we can retain a good amount of detail.
Frequency Filter (I) n Brief Description Æ Process an image in the frequency domain Fourier transform Image [spatial domain] Filter function Transformed Image [frequency domain] Re-Fourier transform Filtered Image [spatial domain]
Frequency Filter (II) multiplication Fourier transform Inverse Fourier transform
Frequency Filter (III) Æ All frequency filters can also be implemented in the spatial domain. And if there exists a simple kernel for the desired filter effect, it is computationally less expensive to perform the filtering in the spatial domain. Æ More appropriate if no straightforward kernel can be found in the spatial domain.
Frequency Filter (IV) n How It Works Æ Based on the Fourier Transform G(k, l) = F(k, l) H(k, l): filter function, G(k, l): filtered image F(k, l): input image in the Fourier domain Æ All frequency filters can in theory be implemented as a spatial domain. ð The multiplication in the Fourier space is identical to the convolution in the spatial domain. Æ The Fourier domain filter function can only be approximated by the filtering kernel in spatial domain.
Frequency Filter (V) Æ Filter functions ð Lowpass filter attenuates high frequencies. - The result in the spatial domain is equivalent to that of a smoothing filter. ð Highpass filter attenuates low frequencies (Edge detection). ð Bandpass filter attenuates very high frequencies and very low frequencies. Æ The most simple lowpass filter ð The ideal lowpass ð It suppresses all frequencies higher than the cut-off frequency D 0 and leaves smaller frequencies unchanged.
Frequency Filter (VI) Æ Drawback of this Filter functions is ringing effect. ð Occurs along the edges of the filtered spatial domain image. Cut-off frequency = 1/3 Magnitude Cut-off frequency = 2/3 Frequency Intensity Frequency Distance Show the shape of the one-dimensional filter in both the frequency and spatial domains for two different values of D 0.
Frequency Filter (VII) Æ Gaussian shaped filter function ð Better results can be achieved. ð Advantage - Has the same shape in the spatial and Fourier domains and therefore does not incur the ringing effect in the spatial domain of the filtered image. ð A commonly used discrete approximation to the Gaussian is Frequency response of Gaussian filter the Butterworth filter. inverting the corresponding low-pass filter. response Æ High-pass filter is obtained by Æ Band-pass filter is a combination of both low-pass and high-pass filters. spatial frequency
Frequency Filter (VIII) n Guidelines For Use Æ Frequency domain filters are most commonly used as low-pass filters. Original image Gaussian noise ( m = 0 , = 8) (a)Lowpass filter: cut-off frequency 1/3 (b)Lowpass filter: cut-off frequency 1/2 ð (b) is less blurred, but also contains more noise than (a).
Frequency Filter (IX) Æ The ringing effect originating from the shape of the ideal lowpass can be better illustrated on the following artificial example. (a) Ideal lowpass filter (b) Histogram equalization Binary image of (cut-off frequency ) a rectangle ringing is already recognizable in (a), but is much more ð The obvious in (b) after a histogram equalization.
Frequency Filter (X) ÆExample : Ideal lowpass filter vs. Butterworth filter Ideal lowpass filter (cut-off frequency ) Histogram equalization Butterworth filter (cut-off frequency ) Histogram equalization
Frequency Filter (XI) Æ Example: High-pass frequency filtering Original image Butterworth high-pass with the cut-off frequency being 0. 5. ð As a result of attenuating (or blocking) the low frequencies, areas of constant intensity in the input image are zero in the output of the high-pass filter. A middle gray value represents the low frequency areas and dark and light values for the edges.
Frequency Filter (XII) ÆExample: Frequecy filter vs. spatial filter Applying Sobel operator Butterworth high-pass with the cut-off frequency being 0. 5. (threshold the result with 13) ð The Sobel operator detects the edges better than the high-pass filter. ð Spatial filters are more commonly used for edge detection while frequency filters are more often used for high frequency emphasis.
Frequency Filter (XIII) Æ Frequency filters are quite useful when processing parts of an image which can be associated with certain frequencies. Æ Example: Fourier transform (a) Original image (b) Fourier Transform (after histogram equalization) (a) Each part of the house is made of stripes of a different frequency and orientation. (b) We can see the main peaks in the image corresponding to the periodic patterns in the real space image which now can be accessed separately.
Frequency Filter (XIV) Æ We can smooth the vertical stripes by multiplying the Fourier image with the following frequency mask. ð The effect is that all frequencies within the black rectangle are set to zero, the others remain unchanged. The frequency mask Applying the inverse Fourier Transform and normalizing
Frequency Filter (XV) Æ We can also use frequency filtering to achieve the opposite effect. ð If we want to keep the vertical stripes (i. e. the wall) in the above image, we can use the following mask. Spatial mask Re-transforming the output into the real space and normalizing ð The pixel values are the highest at the places that were composed of this vertical pattern in the input image and are zero in most of the background areas.
Frequency Filter (XVI) Æ Example: Identify the desired area by applying a threshold. Re-transformed output Threshold result ð A multiplication in the Fourier domain is identical to a convolution in the real domain.
Laplacian / Laplacian of Gaussian (I) n Brief Description Æ 2 -D isotropic measure of the 2 nd spatial derivative of an image ð An isotropic operator is one which applies equally well in all directions in an image, with no particular sensitivity or bias towards one particular set of directions. Æ Highlight regions of rapid change. Æ Often used for edge detection. n How It Works Æ Laplacian L(x, y) of the pixel with the intensity value I(x, y) is :
Laplacian / Laplacian of Gaussian (II) Æ Example: Three commonly used discrete approximations to the Laplacian filter 0 1 1 1 -1 2 -1 1 -4 1 1 -8 1 2 -4 2 0 1 1 1 -1 2 -1 Æ Using one of these kernels, the Laplacian can be calculated.
Laplacian / Laplacian of Gaussian (III) n Lo. G (Laplacian of Gaussian) Æ Since these kernels are approximating a second derivative measurement on the image, they are very sensitive to noise. Æ To reduce this, the image is often smoothed by Gaussian before applying the Laplacian filter. Æ 2 -D Lo. G function centered on zero and with Gaussian standard derivation has the form:
Laplacian / Laplacian of Gaussian (IV) 2 -D Lo. G function Discrete kernel that approximates this function ( = 1. 4)
Laplacian / Laplacian of Gaussian (V) n Guidelines For Use Æ Response of 1 -D Lo. G filter to a step edge Æ The left hand graph shows a 1 -D image, 200 pixels long, containing a step edge. The right hand graph shows the response of a 1 -D Lo. G filter with Gaussian = 3 pixels.
Laplacian / Laplacian of Gaussian (VI) Æ Example: Highlight edges in an image (a) (b) (a) A simple image with strong edges (b) The result of applying a Lo. G filter with Gaussian = 1. 0 (a 7 x 7 kernel was used).
Laplacian / Laplacian of Gaussian (VII) Æ Example Slightly blurry image of a face Applying an Lo. G filter Combining the filtered image with the original image
Laplacian / Laplacian of Gaussian (VIII) Æ Example (a) (b) ð If we simply filter the image with a Laplacian (i. e. use a Lo. G filter with a very narrow Gaussian), we obtain (a). ð Performing edge enhancement using this sharpening image yields the noisy result (b). ð Conversely, widening the Gaussian smoothing component of the operator can reduce some of this noise, but, at the same time, the enhancement effect becomes less pronounced.
Unsharp Filter (I) n Brief Description Æ A simple sharpening operator Æ Enhances edge and other high frequency components via a procedure which subtracts an unsharp, or smoothed, version of an image from the original image. n How It Works Æ Produce an edge image g(x, y) from an input image f(x, y). Where fsmooth(x, y) is a smoothed version of f(x, y). Where fsharp(x, y) is a sharpened version of f(x, y) k is a scaling constant (between 0. 2 and 0. 7).
Unsharp Filter (II) n How It Works Æ Unsharp masking function f(x, y) smooth - g(x, y) + Original signal + Spatial sharpening Lowpass signal Where x axis is spatial coordinate and y axis is response value. Highpass signal Calculating an edge image for unsharp filtering
Unsharp Filter (III) Æ Unsharp masking function (continued) f(x, y) smooth - + g(x, y) + + fsharp(x, y) The complete unsharp filtering operator Sharpened signal Sharpening the original signal using the edge image
Unsharp Filter (IV) ð Example Original image (Edges have been slightly blurred. ) Smooth original image using a 3× 3 mean filter and then subtract the smoothed result from the original image. Sharpened image
Unsharp Filter (V) Æ Spatial sharpening f(x, y) + - Laplacian fsharp(x, y) + + ð Convolving an original image with a Laplacian filter 0 -1 -1 -1 1 -2 1 -1 4 -1 -1 -1 -2 4 -2 0 -1 -1 -1 1 -2 1 8 Negative, discrete Laplacian filter
Unsharp Filter (VI) ð Example Original image Sharpened image Unsharpening produced by a 7× 7 Lo. G with a 7× 7 Laplacian Unsharpening with a 3× 3 Laplacian
Unsharp Filter (VII) Æ Unsharp filter produces a poor result in the presence of noise. Original image Median filtered image Unsharp filtered image
c37ce51bf330e315b028d3c465d50065.ppt