Download Presentation
## Chapter 5

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Chapter 5**Image Restoration**What is Image Restoration?**• Goal • Improve an image in some predefined sense • Image restoration attempts to restore images that have been degraded by using a prior knowledge of the degradation phenomenon. • model the degradation • Identify the degradation process and attempt to reverse it • Similar to image enhancement, but more objective**Degradation/restoration process model**• Degradation model • A degradation function and additive noise that operate on an input image f(x, y) to produce a degraded image g(x, y):**Degradation/restoration process model**• Restoration model • Given g(x, y) and some knowledge about the degradation function H and the noise η • Obtain an estimate fˆ(x, y) of the original image • If H is a linear spatially invariant process: • In spatial domain: • h(x, y): spatial representation of the degradation function • In an equivalent frequency domain**Sources of noise**• Arise during image acquisition (digitization) and/or transmission • Environmental conditions: light, temperature, humidity, atmospheric disturbance... • Quality of sensing elements and transmission media • Human interference (Transmition) • Assumptions of noise (except spatially periodic noise) • Independent of spatial coordinates • Uncorrelated with respect to the image itself**Noise Model**• Spatial noise • Considered as random variables, characterized by a probability density function (PDF) • Noise models • Simulate the behavior and effect of noise • There are many different models for the image noise term η(x, y) • Gaussian • Most common model • Rayleigh • Erlang • Exponential • Uniform • Impulse • Salt and pepper noise**Gaussian Noise**• Gaussian (normal) noise, PDF: * z: gray level, μ: mean value, σ: standard deviation,σ2: variance**Histogram to go here**Noise Example • The test pattern to the right is ideal for demonstrating the addition of noise • Consists of constant areas that span the gray scale from black to near white. • The parameters of the noise are chosen so that the histogram corresponds to the three intensity levels would start to merge Histogram Image**Periodic Noise**• Typically arises from electrical or electromechanical interference during image acquisition. • Spatial dependent noise • FT of a pure sinusoid is a pair of conjugate impulses located at the conjugate frequencies of sine wave. • More in section 5.4**Estimation of Noise Parameters**• Periodic noise parameters typically are estimated by inspection of the FT. • Periodic noise tends to produce frequency spikes. • Try to infer the periodicity of noise components directly from the image (simple case only) • Automated analysis is possible when knowledge is available about the general location of the frequency components**Estimation of Noise Parameters**• The parameters of noise PDFs may be known partially from sensor specifications • But its necessary to estimate them form images. • Capture a set of images of flat environment. • In the case of optical sensors, this is simple as imaging a solid board that is illuminated uniformly. • The resulting images are good indicators of system noise.**Estimation of Noise Parameters**• Calculate a histogram of a small patches of reasonable constant background intensity • Use data from image strip to calculate the mean and variance of the gray levels. • If the strip is denoted by S, then**Restoration in the Presence of Noise Only-Spatial Filtering**• When the only degradation present in an image is noise, • and • The noise terms are unknown, so subtracting them from g(x,y) or G(u,v) is not realistic option. • In periodic noise, it is possible to estimate N(u,v) from the spectrum of G(u,v). • So subtraction can be done to obtain an estimate of the original image • This is an exception rather than a rule • Spatial filtering is the method of choice in situations when only additive noise is present.**Mean Filters-Arithmetic Mean Filter**• We can use spatial filters of different kinds to remove different kinds of noise • The arithmeticmean filter is a very simple one and is calculated as follows: • This is implemented as the simple smoothing filter • Smooths local variations. • Blurs the image to remove noise**Arithmetic Mean Filter**• Image corrupted with Gaussian noise of zero mean and variance 400. • 3x3 arithmetic mean filter. • Good for random noise such as Gaussian or uniform noise After A 3*3ArithmeticMean Filter**Other Means**• There are different kinds of mean filters all of which exhibit slightly different behaviour: • Geometric Mean • Harmonic Mean • Contraharmonic Mean**Geometric Mean**• Achieves similar smoothing to the arithmetic mean, but tends to lose less image detail • Good for random noise such as Gaussian or uniform noise After A 3*3Geometric Mean Filter**Harmonic Mean**• Works well for salt noise, but fails for pepper noise • Also does well for other kinds of noise such as Gaussian noise**Contraharmonic Mean**• Q is the order of the filter and adjusting its value changes the filter’s behaviour • Positive values of Q eliminate pepper noise • Negative values of Q eliminate salt noise • If Q = 0 => arithmetic mean filter • If Q=-1 =>harmonic filter**Contraharmonic Mean**• Well suited for impulse noise • It must be known whether the noise is dark or light in order to select proper sign for Q (disastrous)**Order Statistics Filters**• Spatial filters that are based on ordering the pixel values that make up the neighbourhood operated on by the filter • Useful spatial filters include • Median filter • Max and min filter • Midpoint filter • Alpha trimmed mean filter**Median Filter**• Excellent at noise removal, without the smoothing effects that can occur with other smoothing filters • Particularly good when salt and pepper noise is present • Effective in the presence of both bipolar and unipolar impulse noise**Examples**• A 4x4 grayscale image is given by impulse? impulse? • Filter the image with a 3x3 median filter, after zero-paddingat the image borders median filtering zero-padding**Examples**• Filter the image with a 3x3 median filter, after replicate-padding at the image borders median filtering replicate -padding impulse cleaned!**Max and Min Filter**• Max Filter: • Useful for find the brightest points in image and reduce the pepper noise • Min Filter: • Useful for find the darkest points in image and reduce the salt noise**Midpoint Filter**• Midpoint Filter: • Computes the midpoint between the max. and min values in the area. • Good for random Gaussian and uniform noise • Combines both order statistics and averaging.**Alpha-Trimmed Mean Filter**• Alpha-Trimmed Mean Filter: • We can delete the d/2 lowest and d/2 highest grey levels • So gr(s, t) represents the remaining mn – d pixels • d can range from 0 to mn-1. • If d =0, the filter is reduced to arithmetic mean • If d= mn – 1, the filter become median filter • For other values, the filter is useful in situation involving multiple types of noise • Combination of salt-and-pepper and Gaussian noise**Alpha-Trimmed Mean Filter**ImageCorrupted By UniformNoise Image FurtherCorrupted By Salt andPepper Noise Filtered By5*5 ArithmeticMean Filter Filtered By5*5 GeometricMean Filter Filtered By5*5 MedianFilter Filtered By5*5 Alpha-TrimmedMean Filter d=5**Adaptive Filters**• The filters discussed so far are applied to an entire image without any regard for how image characteristics vary from one point to another • The behaviour of adaptive filters changes depending on the characteristics of the image inside the filter region • Superior performance compared to filters discussed so far • We will take a look at the adaptive median filter**Adaptive, Local Noise Reduction Filters**• Statistical measures of a random variables are closely related to appearance of an image • Adaptive filter is based on these quantities (mean, variance) • Mean gives a measure of average intensity • Variance gives a measure of contrast • The filter response at any point (x,y) is based on four quantities: • g(x,y):the value of the noisy image at (x,y) • The variance of the noise corrupting f(x,y) to form g(x,y) • The local mean of the pixels in Sxy • The local variance of the pixels in Sxy**Adaptive, Local Noise Reduction Filters**• The behaviour of the filter as follow • If is zero, the filter should return simply the value of g(x,y) • If the local variance is high relative to , the filter should return a value close to g(x,y). A high local variance is associated with edges, and should be preserved. • If the two variances are equal, we want the filter to return the arithmetic mean value of the pixels in Sxy, the local area has the same properties as the over all image, (local noise is reduced by averaging)**Adaptive, Local Noise Reduction Filters**• An adaptive expression based on the assumption mentioned earlier • The only quantity that needs to be known is the variance of the overall noise. • Other parameters are computed from the pixels in Sxy. • Assumption is that • Reasonable since the noise is additive and position invariant • The ratio is set to 1 if**Adaptive Median Filtering**• The median filter performs relatively well on impulse noise as long as the spatial density of the impulse noise is not large (Pa and Pb less than 0.2) • The adaptive median filter can handle much more spatially dense impulse noise, and also performs some smoothing for non-impulse noise • The key insight in the adaptive median filter is that the filter size changes depending on the characteristics of the image**Adaptive Median Filtering (cont…)**• Remember that filtering looks at each original pixel image in turn and generates a new filtered pixel • First examine the following notation: • zmin = minimum grey level in Sxy • zmax = maximum grey level in Sxy • zmed = median of grey levels in Sxy • zxy = grey level at coordinates (x, y) • Smax =maximum allowed size of Sxy**Adaptive Median Filtering (cont…)**• Level A: • A1 = zmed – zmin • A2 = zmed – zmax • If A1 > 0and A2 < 0, Go to level B • Else increase the window size • If window size ≤ Smax repeat level A • Else output zmed • Level B: • B1 = zxy – zmin • B2 = zxy – zmax • If B1 > 0and B2 < 0, output zxy • Else output zmed**Adaptive Median Filtering (cont…)**• The key to understanding the algorithm is to remember that the adaptive median filter has three purposes: • Remove impulse noise • Provide smoothing of other noise • Reduce distortion**Adaptive Median Filtering (cont…)**• Level A: • zmin ,zmax are considered as impulse noise component • If zmin< zmed< zmax, go to level B • Else increase the window size • If window size ≤ Smax, repeat level A • Else output zmed • Level B: • If zmin< zxy< zmax, output zxy(→ do not filter) • Else (zmin =zxy or zxy = zmax ) output zmed(→ filter by replacing the pixel with zmed)**Adaptive Filtering Example**Image corrupted by salt and pepper noise with probabilities Pa = Pb=0.25 Result of filtering with a 7 * 7 median filter Result of adaptive median filtering with i = 7