immagini e filtri lineari
Post on 22-Mar-2016
Embed Size (px)
DESCRIPTIONImmagini e filtri lineari. Image Filtering. Modifying the pixels in an image based on some function of a local neighborhood of the pixels. p. N(p). Linear Filtering. The output is the linear combination of the neighborhood pixels - PowerPoint PPT Presentation
Immagini e filtri lineari
Image FilteringModifying the pixels in an image based on some function of a local neighborhood of the pixelspN(p)
Linear FilteringThe output is the linear combination of the neighborhood pixels
The coefficients of this linear combination combine to form the filter-kernel
Linear Filtering(Gaussian Filter)
Gaussian Vs AverageGaussian SmoothingSmoothing by Averaging
Noise FilteringGaussian NoiseAfter Gaussian SmoothingAfter Averaging
Noise FilteringSalt & Pepper NoiseAfter Gaussian SmoothingAfter Averaging
Shift Invariant Linear SystemsSuperposition
The Fourier TransformRepresent function on a new basisThink of functions as vectors, with many componentsWe now apply a linear transformation to transform the basisdot product with each basis elementIn the expression, u and v select the basis element, so a function of x and y becomes a function of u and vbasis elements have the form
Here u & v are larger than the previous slideLarger than the upper example
Cheetah ImageFourier Magnitude (above)Fourier Phase (below)
Zebra ImageFourier Magnitude (above)Fourier Phase (below)
Reconstruction withZebra phase,Cheetah Magnitude
Reconstruction withCheetah phase,Zebra Magnitude
Various Fourier Transform PairsImportant factsThe Fourier transform is linearThere is an inverse FTif you scale the functions argument, then the transforms argument scales the other way. This makes sense --- if you multiply a functions argument by a number that is larger than one, you are stretching the function, so that high frequencies go to low frequenciesThe FT of a Gaussian is a Gaussian.The convolution theoremThe Fourier transform of the convolution of two functions is the product of their Fourier transformsThe inverse Fourier transform of the product of two Fourier transforms is the convolution of the two inverse Fourier transforms
Various Fourier Transform Pairs
AliasingCant shrink an image by taking every second pixelIf we do, characteristic errors appear In the next few slidesTypically, small phenomena look bigger; fast phenomena can look slowerCommon phenomenonWagon wheels rolling the wrong way in moviesCheckerboards misrepresented in ray tracingStriped shirts look funny on colour television
Resample the checkerboard by taking one sample at each circle. In the case of the top left board, new representation is reasonable. Top right also yields a reasonable representation. Bottom left is all black (dubious) and bottom right has checks that are too big.
Constructing a pyramid by taking every second pixel leads to layers that badly misrepresent the top layer
Sampling in 1D takes a continuous function and replaces it with a vector of values, consisting of the functions values at a set of sample points. Well assume that these sample points are on a regular grid, and can place one at each integer for convenience.Sampling in 1D
Sampling in 2D does the same thing, only in 2D. Well assume that these sample points are on a regular grid, and can place one at each integer point for convenience.Sampling in 2D
Nyquist TheoremIn order for a band-limited (i.e., one with a zero power spectrum for frequencies f > B) baseband ( f > 0) signal to be reconstructed fully, it must be sampled at a rate f 2B . A signal sampled at f = 2B is said to be Nyquist sampled, and f =2B is called the Nyquist frequency. No information is lost if a signal is sampled at the Nyquist frequency, and no additional information is gained by sampling faster than this rate.
Smoothing as low-pass filteringThe message of the NT is that high frequencies lead to trouble with sampling.Solution: suppress high frequencies before samplingmultiply the FT of the signal with something that suppresses high frequenciesor convolve with a low-pass filterA filter whose FT is a box is bad, because the filter kernel has infinite supportCommon solution: use a Gaussianmultiplying FT by Gaussian is equivalent to convolving image with Gaussian.
Sampling without smoothing. Top row shows the images,sampled at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
Sampling with smoothing. Top row shows the images. Weget the next image by smoothing the image with a Gaussian with sigma 1 pixel,then sampling at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
Sampling with smoothing. Top row shows the images. Weget the next image by smoothing the image with a Gaussian with sigma 1.4 pixels,then sampling at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
What about 2D?Separability of Gaussian
Requires n2 k2 multiplications for n by n image and k by k kernel.Requires 2kn2 multiplications for n by n image and k by k kernel.
AlgorithmApply 1D mask to alternate pixels along each row of image.Apply 1D mask to alternate pixels along each colum of resultant image from previous step.
This and the last slid constitute a proof by drawing of Nyquists theorem. Its worth mentioning this, thoughwe dont use it explicitly. The crucial point to mention here is that sampling doesnt work if you have frequencycomponents that are too high.The phenomena at the coarsest scale are related to the fact that a Gaussian is a fairly poor low-pass filter. If the sigma is big, then the reconstruction error will be smaller (because the function is flatterin the relevant region of FT space), but aliasing will be larger, because it doesnt die off quickly enough.