Unformatted text preview: Image Segmentation Homework Try out the seg.m file (download seg.zip from student centre) Explain the programming steps involved, in words Matlab exercise: Detect edges in lena.bmp picture using sobel, prewitt and canny filter/detector mask. Which mask detector produces best result? Segment lena.bmp image using gray thresholding. Make use of matlab function graythresh. MATLAB GUI Read Matlab Online HELP : Getting Started with GUIDE Also refer to thesis2.m done by your senior (download from student centre). MATLAB GUI GUIDE, the MATLAB graphical user interface development environment, provides a set of tools for creating graphical user interfaces (GUIs). These tools greatly simplify the process of designing and building GUIs. You can use the GUIDE tools to Lay out the GUI. Using the GUIDE Layout Editor, you can lay out a GUI easily by clicking and dragging GUI components such as panels, buttons, text fields, sliders, menus, and so on into the layout area. GUIDE stores the GUI layout in a FIGfile. Program the GUI. GUIDE automatically generates an Mfile that controls how the GUI operates. The Mfile initializes the GUI and contains a framework for the most commonly used callbacks for each component the commands that execute when a user clicks a GUI component. Using the Mfile editor, you can add code to the callbacks to perform the functions you want. WRET2101
IMAGE RESTORATION Image Restoration To improve the appearance of an image uses a mathematical model. Source of Image Degradation Examples Example: Blurring caused by motion or atmospheric disturbance Geometric distortion cause by imperfect lenses Superimposed interference patterns caused by mechanical system Noise from electronic sources Image Restoration Idea It is assumed that the degradation model is known and can be estimated The idea is to model the degradation process and then apply the inverse process to restore the original image. Restoration process relies on the experience of the individuals to model the degradation process successfully Example degraded image
Develop degradation model Develop inverse degradation process Knowledge of image creation process Input Image d(r,c) Apply inverse degradation process Output image (r,c) Image Restoration Process Referring to the diagram:
Provide degraded image(s) and knowledge of the image creation process into the development of degradation model input Knowledge application specific Ex. How specific lens distorts an image How mechanical vibration from satellite affects an image After degradation model has been developed, formulate the inverse process Apply inverse degradation process to the degraded image d(r,c) Resulted in a output image (r,c) which represents an estimation of the original image Process continues until satisfactory result achieve We can define image restoration as the process of: finding an approximation to the degradation process and finding the appropriate inverse process to estimate the original image. System Model Degradation process model consists of two parts, the degradation function and the noise function General model in spatial domain: d ( r , c ) = h( r , c ) * I ( r , c ) + n( r , c ) Where: d(r,c) degraded image h(r,c) degradation function * denotes the convolution process I(r,c) original image n(r,c) additive noise function Noise What is noise? Any undesired information that contaminates an image Appears in image from a variety of sources Digital image acquisition process, which convert optical image to continuous electrical signal that is then sampled is primary process by which noise appears in digital images Noise Images noise can be modeled with the following distribution: Gaussian (normal) Uniform or, salt and pepper (impulse) Histogram can model these distribution shapes as a function of gray levels Gaussian Model Often used to model natural noise process Ex. From electronic noise in image acquisition system Salt and Pepper Typically caused by malfunctioning pixel elements in camera sensors, faulty memory, or timing error in digitization process. Uniform Can be used to generate any other type of noise distribution most unbiased or neutral noise model. S.F can be effectively used to remove various types of noise in digital images Operate on small neighborhood, 3x3, to 11x11 Can be implemented as convolution masks 2 primary categories of spatial filter: Noise Removal Using Spatial Filters Order filters Mean filters Order filter Arranging the neighborhood pixels in order from smallest to largest grey level value Using this ordering to select the "correct" value Work best with salt and pepper noise (specifically the median) Nonlinear result are unpredictable Average value Work best with gaussian or uniform noise Blurring the image edges or details lowpass filter Mean filter We have eliminated any noise, but also lost the information in the image Ideally , a filter that adapts to the underlying pixel values is desired A filter that can change its behavior based on greylevel characteristics (statistics) of a neighborhood is called adaptive filter 1 Order Filter Based on a specific type of image statistics called order statistics Operate on small subimages, windows, and replace the center pixel value (=convolution) Order statistics is a technique that arrange all the pixels in sequential order based on grey level value The placement of the value within this ordered set referred as the rank Given the following 3x3 subimage: 110 110 114 100 104 104 95 88 85 The result from applying order statistics: {85,88,95,100,104,104,110,110,114} Median Filter Most useful order filters is median filter Select the middle pixel value from ordered set Previous example : 104 Performed by applying sliding window concept "wasted" rows and column are often filled with zeroes (or cropped off the image) Used for elimination of salt and pepper (impulse) noise
Maximum Filter Maximum & Minimum Filter Select the largest value within ordered window of pixel values Works when noise primarily of peppertype (low values) Also can select 2nd largest , 3rd largest.. Tend to brighten the image Minimum Filter Select the smallest value within ordered window of pixel values Works when noise primarily of salttype (high values) Also can select 2nd smallest, 3rd smallest... Tend to darken the image Another order filter: I 1 I 2 I 3 ....I n 2 Midpoint filter Average of the min and max Useful for gaussian and uniform noise I1 + N 2 I 2 Alphatrimmed mean filter Average of the pixel values within the window but with some of the endpointranked values excluded
1 N 2  2T
N 2 T i =T +1 I i T is the number of pixel values excluded at each end of the ordered set. 2 Mean Filters Finding some form of average within the NxN window using sliding window concept to process the entire image Most basic is the arithmetic mean filter Find the arithmetic average of the pixels values in the window 1 N2 ( r ,c )W d (r , c) Where N2 = number of pixels in NxN window, W arithmetic mean filter Smooths out local variations within an image Essentially a lowpass filter Implemented with a convolution mask where all the mask coefficient are 1/N2 Tend to blur an image while mitigating the noise effects Works best with gaussian and uniform noise ContraHarmonic Mean Filter Another type of mean filter Works well for images containing salt or pepper type noise Depending on filter order, R:
( r ,c )W d (r , c) R+1 d (r , c) R Where W is the NxN window under consideration ( r ,c )W ContraHarmonic Mean Filter If R = negative, it eliminates salttype noise If R = positive, it eliminates peppertypes noise Geometric Mean Filter Another type of mean filter Works well for images containing gaussian noise and retain detail information better than arithmetic mean filter
( r ,c )W [ I ( r , c)] 1/ N 2 Defined as the product of the pixel values within the window, raised to the 1/N2power Harmonic Mean Filter Another type of mean filter Works well for images containing salt type noise but fails with pepper noise 2
N
( r ,c )W 1 d (r , c) Frequency Domain Filters Operates by using Fourier Transform representation of images. This representation consists of information about the spatial frequency content of the image (i.e. spectrum of the image) Degraded image d(r,c) Degradation function h(r,c) Fourier Transform Frequency filter R(u,v) Noise model n(r,c) Inverse Fourier Transform Restored Image Diagram Interpretation FT performed on three spatial domain functions The degraded image d(r,c) The degradation function h(r,c) app. dependent The noise model n(r,c) app. dependent Next the frequency domain filter is applied to the FT outputs N(u,v), D(u,v) and H(u,v) The output of the filter operation then undergoes an inverse FT to output restored image. D(u, v) = H (u , v) I (u , v) + N (u, v) D(u,v) Fourier Transform of the degraded image H(u,v) Fourier Transform of the degradation function I(u,v) Fourier Transform of the original image N(u,v) Fourier Transform of the additive noise function The inverse filter Inverse filter uses the foregoing model with added assumption of no noise (N(u,v)=0) D(u,v) = H(u,v)I(u,v) + 0 So the FT of the original image can be found as follows:
I(u,v) = D(u,v) / H(u,v) To find the original image, we take the inverse FT of I(u,v)
I(r,c) = F1 [I(u,v)] = F1 [D(u,v) /H(u,v)] Exercise Given Image: 100 99 60 56 170 70 104 61 71 101 50 200 62 31 70 65 40 96 55 100 85 10 87 125 99 Exercise Using subimage of size 3x3, get the image filtered using:
1. 2. 3. Median Filter Midpoint filter Arithmetic mean filter Study the differences between order filter and mean filter ...
View
Full Document
 Winter '09
 NorAini
 Image processing, Mean

Click to edit the document details