Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Digital image processing using matlab

7,773 views

Published on

introduction to image processing using Matlab ,point processing,filters,Fourier transform,neighborhood processing

Published in: Engineering
  • Download The Complete Lean Belly Breakthrough Program with Special Discount. ■■■ http://scamcb.com/bkfitness3/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Download The Complete Lean Belly Breakthrough Program with Special Discount.  http://scamcb.com/bkfitness3/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Nice !! Download 100 % Free Ebooks, PPts, Study Notes, Novels, etc @ https://www.ThesisScientist.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Digital image processing using matlab

  1. 1. Digital Image Processing using Matlab Introduction Eng.Amr Ez El_Din Rashed Assistant Lecturer Taif university. Tel:0554404723 e-mail:amr_rashed2@hotmail.com
  2. 2. 2 of 38 Introduction “One picture is worth more than ten thousand words” Anonymous
  3. 3. 3 of 38 References “Digital Image Processing using Matlab”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2004 or “Computer Vision and image processing processing A practical approach using cvip tools Scott E umbaugh Prentice hall 1998
  4. 4. 4 of 38 An Introduction to Digital Image Processing with Matlab,2004 School of Computer Science And Mathematics Victoria University of Technology Biosignal and Biomedical Image Processing Matlab-Based Application, JOHN L. SEMMLOW
  5. 5. 5 of 38 Course •This course will cover: Introduction to Image Processing And Computer Vision. Image Fundamentals. Intensity Transformation and Spatial Filtering Frequency Domain Processing Image Restoration Wavelets Morphological Image Processing Image Segmentation
  6. 6. 6 of 38 Contents This lecture will cover: –What is a digital image? –What is digital image processing? –History of digital image processing –State of the art examples of digital image processing –Key stages in digital image processing
  7. 7. 7 of 38 Images an image is a single picture which represents something. It may be a picture of a person, of people or animals, or of an outdoor scene, or a microphotograph of an electronic component, or the result of medical imaging.  Even if the picture is not immediately recognizable, it will not be just a random blur.
  8. 8. 8 of 38 Computer imaging •It’s defined as the acquisition and processing of visual information by computer. •The ultimate receiver of information is: –Computer –Human visual system •So we have two categories:- –Computer vision –Image processing
  9. 9. 9 of 38 Computer vision and image processing •In computer vision: –The processed output images are for use by computer. •In Image processing: –The output images are for human consumption
  10. 10. 10 of 38 Computer vision •One of the computer vision fields is image analysis. •It involves the examination of image data to facilitate solving a vision problem. •Image analysis has 2 topics: –Feature extraction: acquiring higher level image information –Pattern classification taking these higher level of information and identifying objects within the image
  11. 11. 11 of 38 What is a Digital Image? A digital image is a representation of a two- dimensional image as a finite set of digital values, called picture elements or pixels
  12. 12. 12 of 38 What is a Digital Image? (cont…) Pixel values typically represent gray levels, colours, heights, opacities etc Remember digitization implies that a digital image is an approximation of a real scene 1 pixel
  13. 13. 13 of 38 What is a Digital Image? (cont…) Common image formats include: –1 sample per point (B&W or Grayscale) –3 samples per point (Red, Green, and Blue) For most of this course we will focus on grey-scale images
  14. 14. 14 of 38 What is Digital Image Processing? Digital image processing involves changing the nature of an image in order to either –Improve it’s pictorial information for human interpretation(image ehancement) –Processing of image data for storage, transmission and representation for autonomous machine perception(ادراك ) Some argument about where image processing ends and fields such as image analysis and computer vision start
  15. 15. 15 of 38 DIP(cont…) •It is necessary to realize that these two aspects represent two separate but equally important aspects of image processing. A procedure which satisfies condition. •(1)a procedure which makes an image look better may be the very worst procedure for satisfying condition •(2). Humans like their images to be sharp, clear and detailed; machines prefer their images to be simple and uncluttered.
  16. 16. 16 of 38 Example of (1) Enhancing the edges of an image to make it appear sharper
  17. 17. 17 of 38 Example of (1)
  18. 18. 18 of 38 Example of (1)
  19. 19. 19 of 38 Example of (2)
  20. 20. 20 of 38 Example of (2)
  21. 21. 21 of 38 What is DIP? (cont…) The continuum ( متصل - متسلسل )from image processing to computer vision can be broken up into low-, mid- and high-level processes Low Level Process Input: Image Output: Image Examples: Noise removal, image sharpening Mid Level Process Input: Image Output: Attributes Examples: Object recognition, segmentation High Level Process Input: Attributes Output: Understanding Examples: Scene understanding, autonomous navigation In this course we will stop here
  22. 22. 22 of 38 History of Digital Image Processing Early 1920s: One of the first applications of digital imaging was in the news- paper industry –The Bartlane cable picture transmission service (5 tones) –Images were transferred by submarine cable between London and New York –Pictures were coded for cable transfer and reconstructed at the receiving end on a telegraph printer Early digital image
  23. 23. 23 of 38 History of DIP (cont…) Mid to late 1920s: Improvements to the Bartlane system resulted in higher quality images –New reproduction processes based on photographic techniques –Increased number of tones in reproduced images Improved digital image Early 15 tone digital image
  24. 24. 24 of 38 History of DIP (cont…) 1960s: Improvements in computing technology and the onset of the space race led to a surge of work in digital image processing –1964: Computers used to improve the quality of images of the moon taken by the Ranger 7 probe –Such techniques were used in other space missions including the Apollo landings A picture of the moon taken by the Ranger 7 probe minutes before landing
  25. 25. 25 of 38 History of DIP (cont…) 1970s: Digital image processing begins to be used in medical applications –1979: Sir Godfrey N. Hounsfield & Prof. Allan M. Cormack share the Nobel Prize in medicine for the invention of tomography, the technology behind Computerised Axial Tomography (CAT) scans Typical head slice CAT image
  26. 26. 26 of 38 History of DIP (cont…) 1980s - Today: The use of digital image processing techniques has exploded and they are now used for all kinds of tasks in all kinds of areas –Image enhancement/restoration –Artistic effects –Medical visualisation –Industrial inspection –Law enforcement –Human computer interfaces
  27. 27. 27 of 38 Examples: Image Enhancement One of the most common uses of DIP techniques: improve quality, remove noise etc
  28. 28. 28 of 38 Examples: The Hubble Telescope Launched in 1990 the Hubble telescope can take images of very distant objects However, an incorrect mirror made many of Hubble’s images useless Image processing techniques were used to fix this
  29. 29. 29 of 38 Examples: Artistic Effects Artistic effects are used to make images more visually appealing, to add special effects and to make composite images
  30. 30. 30 of 38 Examples: Medicine Take slice from MRI scan of canine heart, and find boundaries between types of tissue –Image with gray levels representing tissue density –Use a suitable filter to highlight edges Original MRI Image of a Dog Heart Edge Detection Image
  31. 31. 31 of 38 Examples: GIS Geographic Information Systems –Digital image processing techniques are used extensively to manipulate satellite imagery –Terrainتضاريس classification –Meteorology الأرصاد الجوية
  32. 32. 32 of 38 Examples: GIS (cont…) Night-Time Lights of the World data set –Global inventory of human settlement –Not hard to imagine the kind of analysis that might be done using this data
  33. 33. 33 of 38 Examples: Industrial Inspection Human operators are expensive, slow and unreliable Make machines do the job instead Industrial vision systems are used in all kinds of industries Can we trust them?
  34. 34. 34 of 38 Examples: PCB Inspection Printed Circuit Board (PCB) inspection –Machine inspection is used to determine that all components are present and that all solder joints are acceptable –Both conventional imaging and x-ray imaging are used
  35. 35. 35 of 38 Examples: Law Enforcement Image processing techniques are used extensively by law enforcers –Number plate recognition for speed cameras/automated toll systems –Fingerprint recognition –Enhancement of CCTV images
  36. 36. 36 of 38 Examples: HCI Try to make human computer interfaces more natural –Face recognition –Gesture ايماءة recognition Does anyone remember the user interface from “Minority Report”? These tasks can be extremely difficult
  37. 37. 37 of 38 Key Stages in Digital Image Processing Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  38. 38. 38 of 38 Key Stages in Digital Image Processing: Image Aquisition Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  39. 39. 39 of 38 Image Enhancement: taking an image and improving it visually Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  40. 40. 40 of 38 Image Restoration : taking an image with some known or estimated degradation and restoring it to its original appearing Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  41. 41. 41 of 38 Key Stages in Digital Image Processing: Morphological Processing Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  42. 42. 42 of 38 Key Stages in Digital Image Processing: Segmentation Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  43. 43. 43 of 38 Key Stages in Digital Image Processing: Object Recognition Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  44. 44. 44 of 38 Key Stages in Digital Image Processing: Representation & Description Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  45. 45. 45 of 38 Image compression: reducing the massive amount of data needed to represent an image Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  46. 46. 46 of 38 Key Stages in Digital Image Processing: Colour Image Processing Image Acquisition Image Restoration Morphological Processing Segmentation Representation & Description Image Enhancement Object Recognition Problem Domain Colour Image Processing Image Compression
  47. 47. 47 of 38 Sampling •Sampling refers to the process of digitizing a continuous function. For example, suppose we take the function •and sample it at ten evenly spaced values of x only. The resulting sample points are shown in figure 1.6. This shows an example of under sampling, where the number of points is not sufficient to reconstruct the function. Suppose we sample the function at 100 points, as shown in figure 1.7. We can clearly now reconstruct the function; all its properties can be determined from this sampling. In order to ensure that we have enough sample points, we require that the sampling period is not greater than one-half the finest detail in our function. This is known as the Nyquist criterion, and can be formulated more precisely in terms of “frequencies”. The Nyquist criterion can be stated as the sampling theorem, which says, in effect, that a continuous function can be reconstructed from its samples provided that the sampling frequency is at least twice the maximum frequency in the function. A formal account of this theorem is provided by Castleman
  48. 48. 48 of 38 Image Acquisition and Sampling
  49. 49. 49 of 38 Effect of Sampling Sampling an image requires that we consider the Nyquist criterion, when we consider an image as a continuous function of two variables, and we wish to sample it to produce a digital image. An example is shown ,where an image is shown, and then with an under sampled version. The jagged edges in the under sampled image are examples of aliasing. The sampling rate will of course affect the final resolution of the image. In order to obtain a sampled (digital) image, we may start with a continuous representation of a scene. To view the scene, we record the energy reflected from it; we may use visible light, or some other energy source.
  50. 50. 50 of 38 Data Classes
  51. 51. 51 of 38 Types of digital images The toolbox supports four types of images: 1-intensity images. 2-binary images. 3-Indexed images. 4-RGB images.
  52. 52. 52 of 38 Intensity images(grayscale images) •An intensity image is a data matrix whose values have been scaled to represent intensities. •Class uint8 :range [0,255] •Class uint16:range[0,65535] •Double: floating point[0,1]
  53. 53. 53 of 38 Binary image Binary. Each pixel is just black or white. Since there are only two possible values for each pixel, we only need one bit per pixel. Such images can therefore be very efficient in terms of storage. Images for which a binary representation may be suitable include text (printed or handwriting), fingerprints, or architectural plans.
  54. 54. 54 of 38 True color, or RGB image Here each pixel has a particular color; that color being described by the amount of red, green and blue in it. If each of these components has a range 0-255 this gives a total of different possible colors in the image 255^3=16,777,216. This is enough colors for any image. Since the total number of bits required for each pixel is 24, such images are also called 24 bit color images. Such an image may be considered as consisting of a “stack” of three matrices; representing the red, green and blue values for each pixel. This means that for every pixel there correspond three values.
  55. 55. 55 of 38 Indexed image Most color images only have a small subset of the more than sixteen million possible colors. For convenience of storage and file handling, the image has an associated color map, or color palette, which is simply a list of all the colors used in that image. Each pixel has a value which does not give its color (as for an RGB image), but an index to the color in the map.
  56. 56. 56 of 38 Converting between Image Classes andTypes
  57. 57. 57 of 38 Cont.
  58. 58. 58 of 38 Cont.
  59. 59. 59 of 38 Reading Images
  60. 60. 60 of 38 Displaying Images
  61. 61. 61 of 38 Cont.
  62. 62. 62 of 38 Cont.
  63. 63. 63 of 38 Writing Images
  64. 64. 64 of 38 Image Information
  65. 65. 65 of 38 Image File Sizes •Image files tend to be large. We shall investigate the amount of information used in different image type of varying sizes. For example, suppose we consider a binary image. The number of bits used in this image (assuming no compression, and neglecting, for the sake of discussion, any Header information) is 512×512×1=262,144 =32768 bytes •If we now turn our attention to color images, each pixel is associated with 3 bytes of color Information. A 512×512×3 image thus requires 512×512×3=786,432Byte • =786.43Kb • =0.786 Mb.
  66. 66. 66 of 38 Import pixel information
  67. 67. 67 of 38 Indexed and RGB images
  68. 68. 68 of 38 ind2gray
  69. 69. 69 of 38 gray2ind
  70. 70. 70 of 38 Image perception •Much of image processing is concerned with making an image appear better to human beings. We should therefore be aware of the limitations of the human visual system. Image perception consists of two basic steps: •1. Observed intensities vary as to the background. A single block of grey will appear darker if placed on a white background than if it were placed on a black background.
  71. 71. 71 of 38 Cont. •2.We may observe non-existent intensities as bars in continuously varying grey levels. This image varies continuously from light to dark as we travel from left to right. However, it is impossible for our eyes not to see a few horizontal edges in this image.
  72. 72. 72 of 38 Cont. 3. Our visual system tends to undershoot or overshoot around the boundary of regions of different intensities. For example, suppose we had a light grey blob on a dark grey background. As our eye travels from the dark background to the light region, the boundary of the region appears lighter than the rest of it. Conversely, going in the other direction, the boundary of the background appears darker than the rest of it.
  73. 73. 73 of 38 image 50 100 150 200 250 50 100 150 200 250
  74. 74. 74 of 38 Cont. •will certainly display the cameraman, but possibly in an odd mixture of colors, and with some stretching. The strange colors come from the fact that the image command uses the current color map to assign colours to the matrix elements. The default color map is called jet, and consists of 64 very bright colours, which is inappropriate for the display of a grayscale image. •To display the image properly, we need to add several extra commands to the image line. •1.truesize. •2.axis off •3. colormap(gray(247)), which adjusts the image colour map to use shades of grey only. We can find the number of grey levels used by the cameraman image with
  75. 75. 75 of 38 Cont.
  76. 76. 76 of 38 image(x),truesize,axis off, colormap(gray(512)) will produce a dark image. This happens because only the first 247 elements of the color map will be used by the image for display, and these will all be in the first half of the color map; thus all dark greys.
  77. 77. 77 of 38 image(x),truesize,axis off, colormap(gray(128)) •will produce a very light image, because any pixel with grey level higher than 128 will simply pick that highest grey value (which is white) from the color map.
  78. 78. 78 of 38 Indexed color images
  79. 79. 79 of 38 RGB images
  80. 80. 80 of 38 imshow
  81. 81. 81 of 38 Cont. To display the matrix cd, we need to scale it to the range [0,1]. This is easily done simply by dividing all values by 255:
  82. 82. 82 of 38 im2double We can convert the original image to double more properly using the function im2double. This applies correct scaling so that the output values are between 0 and 1.
  83. 83. 83 of 38 Bit planes •Grayscale images can be transformed into a sequence of binary images by breaking them up into their bit-planes. If we consider the grey value of each pixel of an 8-bit image as an 8- bit binary word, •then the 0th bit plane consists of the last bit of each grey value.Since this 0th bit plane has the least effect in terms of the magnitude of the value, it is called the least significant bit, and the plane consisting of those bits the least significant bit plane. •Similarly the 7th bit plane consists of the first bit in each value. This bit has the greatest effect in terms of the magnitude of the value, so it is called the most significant bit, and the plane consisting of those bits the most significant bit plane.
  84. 84. 84 of 38 Cont.
  85. 85. 85 of 38 Spatial Resolution •Spatial resolution is the density of pixels over the image: the greater the spatial resolution, the more pixels are used to display the image. We can experiment with spatial resolution with Matlab's
  86. 86. 86 of 38 Cont.
  87. 87. 87 of 38 Another solution
  88. 88. 88 of 38 imdemos
  89. 89. 89 of 38 Point Processing •Any image processing operation transforms the grey values of the pixels. However, image processing operations may be divided into three classes based on the information required to perform the transformation. From the most complex to the simplest, they are: •1.Transforms. •2. Neighborhood processing. •3.Point operations : They are especially useful in image pre-processing, where an image is required to be modified before the main job is attempted.
  90. 90. 90 of 38 Arithmetic operations
  91. 91. 91 of 38 Cont. imadd output
  92. 92. 92 of 38 Cont.
  93. 93. 93 of 38 Cont. y=x/2 y=x*2 y=x/2+128
  94. 94. 94 of 38 Complements The complement of a grayscale image is its photographic negative. If an image matrix m is of type double and so its grey values are in the range [0,1]. If the image is binary, we can use •If the image is of type uint8, the best approach is the imcomplement function he complement function y=255-x
  95. 95. 95 of 38 Cont.
  96. 96. 96 of 38 Part Complementation(Solarization)
  97. 97. 97 of 38 Cont.
  98. 98. 98 of 38 Histograms Given a grayscale image, its histogram consists of the histogram of its grey levels; that is, a graph indicating the number of times each grey level occurs in the image. 1-In a dark image, the grey levels (and hence the histogram) would be clustered at the lower end. 2-In a uniformly bright image, the grey levels would be clustered at the upper end. 3-In a well contrasted image, the grey levels would be well spread out over much of the range.
  99. 99. 99 of 38 Cont. 0 200 400 600 800 1000 1200 1400 1600 0 50 100 150 200 250
  100. 100. 100 of 38 Histogram Stretching (Contrast stretching) •Given a poorly contrasted image, we would like to enhance its contrast, by spreading out its histogram. There are two ways of doing this. 1.Histogram stretching (contrast stretching). 2.Histogram equalization 2Histogram Stretching (Contrast stretching) Histogram Stretching (Contrast stretching)
  101. 101. 101 of 38 Cont. Suppose we have an image with the histogram shown , associated with a table of the numbers ni of gray values
  102. 102. 102 of 38 Cont. We can stretch the grey levels in the centre of the range out by applying the piecewise linear function shown at the right in figure. This function has the effect of stretching the grey levels 5-9 to gray levels 2-14 according to the equation Where I is the original gray level and j its result after the transformation .This yields
  103. 103. 103 of 38 Cont. which indicates an image with greater contrast than the original.
  104. 104. 104 of 38 Use of imadjust
  105. 105. 105 of 38 Cont.
  106. 106. 106 of 38 Cont.
  107. 107. 107 of 38 Cont.
  108. 108. 108 of 38 Cont.
  109. 109. 109 of 38 Cont. 50 100 150 200 250 50 100 150 200 250
  110. 110. 110 of 38 A piecewise linear stretching function The heart of our function will be the lines
  111. 111. 111 of 38 2.Histogram equalization •The trouble with any of the above methods of histogram stretching is that they require user input. Sometimes a better approach is provided by histogram equalization, which is an entirely automatic procedure. The idea is to change the histogram to one which is uniform; that is that every bar on the histogram is of the same height, or in other words that each grey level in the image occurs with the same frequency. In practice this is generally not possible, although as we shall see the result of histogram equalization provides very good results.
  112. 112. 112 of 38 Cont. Suppose a 4-bit gray scale image has the histogram shown in figure associated with a table of the numbers
  113. 113. 113 of 38 Cont.
  114. 114. 114 of 38 Cont. We now have the following transformation of grey values, obtained by reading o the first and last columns in the above table: This is far more spread out than the original histogram, and so the resulting image should exhibit greater contrast.
  115. 115. 115 of 38 Cont. 0 500 1000 1500 2000 2500 3000 3500 0 50 100 150 200 250 0 200 400 600 800 1000 1200 1400 1600 0 50 100 150 200 250
  116. 116. 116 of 38 Cont. We give one more example, that of a very dark image. We can obtain a dark image by taking an image and using imdivide. 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 0 50 100 150 200 250
  117. 117. 117 of 38 Cont. 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 0 50 100 150 200 250
  118. 118. 118 of 38 Lookup tables
  119. 119. 119 of 38 Cont.
  120. 120. 120 of 38 Example
  121. 121. 121 of 38 Neighborhood Processing
  122. 122. 122 of 38 Spatial domain filtering
  123. 123. 123 of 38 Linear filter A diagram illustrating the process for performing spatial filtering is given in figure. Spatial filtering thus requires three steps: 1.position the mask over the current pixel. 2. form all products of filter elements with the corresponding elements of the neighborhood. 3. add up all the products. This must be repeated for every pixel in the image.
  124. 124. 124 of 38 Convolution
  125. 125. 125 of 38 Mean filter
  126. 126. 126 of 38 Cont.
  127. 127. 127 of 38 Cont. If we continue in this manner, the following output is obtained:
  128. 128. 128 of 38 Cont.
  129. 129. 129 of 38 Cont. mean filter output 50 100 150 200 250 50 100 150 200 250 original image
  130. 130. 130 of 38 Another solution
  131. 131. 131 of 38 Another solution
  132. 132. 132 of 38 Edge of the image
  133. 133. 133 of 38 Filtering in Matlab
  134. 134. 134 of 38 Cont. •filter2(filter,image,'valid') applies the mask only to inside pixels. The result will always be smaller than the original:
  135. 135. 135 of 38 Cont. •The result of 'same' above may also be obtained by padding with zeros and using 'valid':
  136. 136. 136 of 38 Cont. filter2(filter,image,'full') returns a result larger than the original; it does this by padding with zero, and applying the filter at all places on and around the image where the mask intersects the image matrix.
  137. 137. 137 of 38 Cont. •The shape parameter, being optional, can be omitted; in which case the default value is 'same'. There is no single best approach; the method must be dictated by the problem at hand; by the filter being used, and by the result required. We can create our filters by hand, or by using the fspecial function; this has many options which makes for easy creation of many different filters. We shall use the average option, which produces averaging filters of given size; thus
  138. 138. 138 of 38 Cont.
  139. 139. 139 of 38 Note.
  140. 140. 140 of 38 Cont.
  141. 141. 141 of 38 Notes. •The resulting image after these filters may appear to be much worse than the original. However, applying a blurring filter to reduce detail in an image may the perfect operation for autonomous machine recognition, or if we are only concentrating on the gross aspects of the image: numbers of objects; amount of dark and light areas. In such cases, too much detail may obscure the outcome.
  142. 142. 142 of 38 Separable filters
  143. 143. 143 of 38 Frequencies; low and high pass filters
  144. 144. 144 of 38 Cont.
  145. 145. 145 of 38 Cont.
  146. 146. 146 of 38 Cont. laplacian log In each case, the sum of all the filter elements is zero. High pass filtering
  147. 147. 147 of 38 Cont.
  148. 148. 148 of 38 Cont.
  149. 149. 149 of 38 Cont.
  150. 150. 150 of 38 Cont.
  151. 151. 151 of 38 imfilter
  152. 152. 152 of 38 Edge sharpening
  153. 153. 153 of 38 Cont.
  154. 154. 154 of 38 Cont.
  155. 155. 155 of 38 Cont.
  156. 156. 156 of 38 Cont.
  157. 157. 157 of 38 Cont.
  158. 158. 158 of 38 High boost filtering
  159. 159. 159 of 38 Non-linear filters
  160. 160. 160 of 38 Cont.
  161. 161. 161 of 38 colfilt
  162. 162. 162 of 38 Rank order filter
  163. 163. 163 of 38 geometric mean filter, alpha-trimmed mean filter
  164. 164. 164 of 38 The Fourier Transform
  165. 165. 165 of 38 Background
  166. 166. 166 of 38 Cont.
  167. 167. 167 of 38 1D-DFT
  168. 168. 168 of 38 FFT
  169. 169. 169 of 38 2D –DFT,Properties
  170. 170. 170 of 38 Cont.
  171. 171. 171 of 38 Convolution
  172. 172. 172 of 38 DC Coefficient
  173. 173. 173 of 38 shifting
  174. 174. 174 of 38
  175. 175. 175 of 38 trouble
  176. 176. 176 of 38 Fourier transforms in Matlab
  177. 177. 177 of 38 Example
  178. 178. 178 of 38 Example 2. Now we'll take a matrix consisting of a single corrugation:
  179. 179. 179 of 38 Example 3 •We will take here a single step edge:
  180. 180. 180 of 38 Fourier transforms of images(spectrum)
  181. 181. 181 of 38 FFTshow function
  182. 182. 182 of 38 Example 1
  183. 183. 183 of 38 Example 2(box)
  184. 184. 184 of 38 Example 3(box rotated 45)
  185. 185. 185 of 38 Example 4.(circle)
  186. 186. 186 of 38 Notes •Note the ringing in the Fourier transform. This is an artifact associated with the sharp cut off of the circle. As we have seen from both the edge and box images in the previous examples, an edge appears in the transform as a line of values at right angles to the edge. We may consider the values on the line as being the coefficients of the appropriate corrugation functions which sum to the edge. With the circle, we have lines of values radiating out from the circle; these values appear as circles in the transform.
  187. 187. 187 of 38 Example 5
  188. 188. 188 of 38 Filtering in the frequency domain •Ideal filtering(low pass filter)
  189. 189. 189 of 38 Cont.
  190. 190. 190 of 38 Cont.
  191. 191. 191 of 38 Notes •Note that even though cfli is supposedly a matrix of real numbers, we are still using fftshow to display it. This is because the fft2 and fft2 functions, being numeric, will not produce mathematically perfect results, but rather very close numeric approximations . So using fftshow with the 'abs' option rounds out any errors obtained during the transform and its inverse. Note the ringing about the edges in this image. This is a direct result of the sharp cutoff of the circle. The ringing as shown in figure is transferred to the image. •We would expect that the smaller the circle, the more blurred the image, and the larger the circle; the less blurred.
  192. 192. 192 of 38 Cont.
  193. 193. 193 of 38 High pass filtering
  194. 194. 194 of 38 Example
  195. 195. 195 of 38 Image Restoration •Image restoration concerns the removal or reduction of degradations which have occurred during the acquisition of the image. Such degradations may include noise, which are errors in the pixel values, or optical effects such as out of focus blurring, or blurring due to camera motion. We shall see that some restoration techniques can be performed very successfully using neighborhood operations, while others require the use of frequency domain processes. Image restoration remains one of the most important areas of image processing, but in this chapter the emphasis will be on the techniques for dealing with restoration, rather than with the degradations themselves, or the properties of electronic equipment which give rise to image degradation.
  196. 196. 196 of 38 Noise •We may define noise to be any degradation in the image signal, caused by external disturbance. If an image is being sent electronically from one place to another, via satellite or wireless transmission, or through networked cable, we may expect errors to occur in the image signal. These errors will appear on the image output in different ways depending on the type of disturbance in the signal. •Usually we know what type of errors to expect, and hence the type of noise on the image; hence we can choose the most appropriate method for reducing the effects. Cleaning an image corrupted by noise is thus an important area of image restoration.
  197. 197. 197 of 38 Salt and pepper noise •Also called impulse noise, shot noise, or binary noise. This degradation can be caused by sharp, sudden disturbances in the image signal; its appearance is randomly scattered white or black (or both) pixels over the image.
  198. 198. 198 of 38 Cont.
  199. 199. 199 of 38 Gaussian noise
  200. 200. 200 of 38 Speckle noise
  201. 201. 201 of 38 Periodic noise •If the image signal is subject to a periodic, rather than a random disturbance, we might obtain an image corrupted by periodic noise. The effect is of bars over the image. The function imnoise does not have a periodic option, but it is quite easy to create our own, by adding a periodic matrix(using a trigonometric function). •Salt and pepper noise, Gaussian noise and speckle noise can all be cleaned by using spatial filtering techniques. Periodic noise, however, requires the use of frequency domain filtering. This is because whereas the other forms of noise can be modelled as local degradations, periodic noise is a global effect.
  202. 202. 202 of 38 Cleaning salt and pepper noise
  203. 203. 203 of 38 Cont.
  204. 204. 204 of 38 Removal of periodic noise
  205. 205. 205 of 38 Segmentation
  206. 206. 206 of 38 label2rgb
  207. 207. 207 of 38 bwconncomp
  208. 208. 208 of 38 Cont.
  209. 209. 209 of 38 labelmatrix

×