reading
play

Reading Jain, Kasturi, Schunck, Machine Vision . McGraw- Hill, 1995. - PDF document

Reading Jain, Kasturi, Schunck, Machine Vision . McGraw- Hill, 1995. Sections 4.2-4.4, 4.5(intro), 4.5.5, 4.5.6, 5.1-5.4. Image processing cse457-04-image-processing 1 cse457-04-image-processing 2 What is an image? Images as functions We


  1. Reading Jain, Kasturi, Schunck, Machine Vision . McGraw- Hill, 1995. Sections 4.2-4.4, 4.5(intro), 4.5.5, 4.5.6, 5.1-5.4. Image processing cse457-04-image-processing 1 cse457-04-image-processing 2 What is an image? Images as functions We can think of an image as a function, f , from R 2 to R: � f ( x, y ) gives the intensity of a channel at position ( x, y ) � Realistically, we expect the image only to be defined over a rectangle, with a finite range: • f : [ a , b ] x [ c , d ] � [0,1] f(x,y) A color image is just three functions pasted y together. We can write this as a “vector-valued” function: x r x y ( , )   f x y ( , )  g x y ( , )  =   b x y ( , )     cse457-04-image-processing 3 cse457-04-image-processing 4

  2. What is a digital image? Image processing In computer graphics, we usually operate on An image processing operation typically defines digital ( discrete ) images: a new image g in terms of an existing image f. � Sample the space on a regular grid The simplest operations are those that transform � Quantize each sample (round to nearest each pixel in isolation. These pixel-to-pixel integer) operations can be written: If our samples are ∆ apart, we can write this as: g x y ( , ) t f x y ( ( , )) = f [ i , j ] = Quantize{ f ( i ∆ , j ∆ ) } Examples: RGB � grayscale , threshold Note: a typical choice for mapping to grayscale is to apply the YIQ television matrix and keep the Y. Y 0.299 0.587 0.114 R        I  0.596 0.275 0.321   G = − −      Q 0.212 0.523 0.3 11 B −           f[i,j] j i cse457-04-image-processing 6 single pixel changes Pixel movement Some operations preserve intensities, but move pixels around in the image to grayscale C C g x y ( , ) f x x y ( ( , ), ( , )) y x y = ⇒ Examples: many amusing warps of images threshold at 55 threshold at 128 hair.ppt cse457-04-image-processing 7 cse457-04-image-processing 8

  3. Pixel movement More pixel movement effects Some operations preserve intensities, but move pixels around in the image example: image registration ripple reflection in ripples image transitions cse457-04-image-processing 9 cse457-04-image-processing 10 Noise Ideal noise reduction Image processing is also useful for noise reduction and edge enhancement. We will focus on these applications for the remainder of the lecture… Common types of noise: Salt and pepper noise : contains random � occurrences of black and white pixels Impulse noise: contains random occurrences of � white pixels Gaussian noise : variations in intensity drawn � from a Gaussian normal distribution cse457-04-image-processing 12

  4. Ideal noise reduction Practical noise reduction Averaging multiple examples of the same image is often not possible. How can we “smooth” away noise in a single image? Is there a more abstract way to represent this sort of operation? Of course there is! cse457-04-image-processing 13 cse457-04-image-processing 14 Convolution One of the most common methods for filtering an image is called convolution . In 1D, convolution is defined as: g x ( ) f x ( ) h x ( ) = ∗ ∞ f x h x ( ') ( x dx ') ' = − ∫ −∞ ∞ f x h x ( ') ( ' � x dx ) ' = − ∫ ~ −∞ where h (x) h( x) = − g(x) is “f convolved with h” cse457-04-image-processing 15 cse457-04-image-processing 16

  5. Discrete convolution For a digital signal, we define discrete convolution as: g i [ ] f i [ ] h i [ ] = ∗ f i h i [ '] [ i '] = − ∑ i ' ~ f i h i [ '] [ ' � i ] = − where h [ i ] h [ i ] = − ∑ i ' g[i] is “f convolved with h” cse457-04-image-processing 17 cse457-04-image-processing 18 Convolution in 2D Convolution representation ~ h Since f, g, and are defined over finite regions, we can write them out in two-dimensional arrays: In two dimensions, convolution becomes: g x y ( , ) f x y ( , ) h x y ( , ) = ∗ 0.2 0 0.2 0 0.2 0 ∞ ∞ 0.2 0 0.2 f x y h x ( ', ') ( x y ', y dx dy ') ' ' = − − ~ ∫ ∫ h −∞ −∞ ∞ ∞ f x y h x ( ', ') ( ' x y , ' y dx dy ) ' ' = − − ∫ ∫ −∞ −∞ 242 245 245 245 244 228 191 165 where � ( , ) . h x y h ( x , y ) = − − 245 246 240 220 204 184 151 138 f 232 192 165 141 131 142 138 136 190 165 144 143 142 140 137 138 Similarly, discrete convolution in 2D becomes: 141 145 148 146 135 135 135 135 g [ i , j ] f [ i , j ] * h [ i , j ] = f [ k , l ] h [ i k , j l ] = − − g ∑∑ k l ~ f [ k , l ] h [ k i , l j ] = − − ∑∑ k l Note: This is not matrix multiplication ! C [ , ] where h i j h [ i , j ] . = − − Q : What happens at the edges? cse457-04-image-processing 19 cse457-04-image-processing 20

  6. Mean filters Effect of mean filters How can we represent our noise-reducing averaging filter as a convolution diagram (know as a mean filter )? cse457-04-image-processing 21 cse457-04-image-processing 22 Gaussian filters Effect of Gaussian filters Gaussian filters weigh pixels based on their distance from the center of the convolution filter. In particular: 2 2 2 ( i j )/(2 ) − + σ e h i j [ , ] = C This does a decent job of blurring noise while preserving features of the image. What parameter controls the width of the Gaussian? What happens to the image as the Gaussian filter kernel gets wider? What is the constant C ? What should we set it to? cse457-04-image-processing 23 cse457-04-image-processing 24

  7. Median filters Effect of median filters A median filter operates over an m x m region by selecting the median intensity in the region. What advantage does a median filter have over a mean filter? Is a median filter a kind of convolution? cse457-04-image-processing 25 cse457-04-image-processing 26 Comparison: salt and pepper Comparison: Gaussian noise noise cse457-04-image-processing 27 cse457-04-image-processing 28

  8. Edge detection What is an edge? One of the most important uses of image processing is edge detection: � Really easy for humans � Really difficult for computers � Fundamental in computer vision � Important in many graphics applications Q : How might you detect an edge in 1D? cse457-04-image-processing 29 cse457-04-image-processing 30 Gradients Less than ideal edges The gradient is the 2D equivalent of the derivative: f f ∂ ∂   f x y ( , ) , ∇ =  x y   ∂ ∂ � Properties of the gradient � It’s a vector � Points in the direction of maximum increase of f � Magnitude is rate of increase How can we approximate the gradient in a discrete image? cse457-04-image-processing 31 cse457-04-image-processing 32

  9. Steps in edge detection Edge enhancement Edge detection algorithms typically proceed in A popular gradient magnitude computation is the three or four steps: Sobel operator : � Filtering : cut down on noise � Enhancement : amplify the difference 1 0 1 −   between edges and non-edges s  2 0 2  = − x � Detection : use a threshold operation   1 0 1 −   � Localization (optional): estimate geometry   of edges beyond pixels 1 2 1   s  0 0 0  =  y  1 2 1 − − −     We can then compute the magnitude of the vector ( s x , s y ). cse457-04-image-processing 33 cse457-04-image-processing 34 Results of Sobel edge detection Second derivative operators The Sobel operator can produce thick edges. Ideally, we’re looking for infinitely thin boundaries. An alternative approach is to look for local extrema in the first derivative: places where the change in the gradient is highest. Q : A peak in the first derivative corresponds to what in the second derivative? cse457-04-image-processing 36

  10. Localization with the Laplacian Localization with the Laplacian An equivalent measure of the second derivative in 2D is the Laplacian : 2 2 f f ∂ ∂ 2 f x y ( , ) ∇ = + 2 2 x y ∂ ∂ Using the same arguments we used to compute the gradient filters, we can derive a Laplacian filter to be: Original Smoothed 0 1 0   2  1 4 1  ∆ = −   0 1 0     Zero crossings of this filter correspond to positions of maximum gradient. These zero crossings can be used to localize edges. Laplacian (+128) cse457-04-image-processing 37 cse457-04-image-processing 38 Marching squares Sharpening with the Laplacian We can convert these signed values into edge contours using a “marching squares” technique: Original Laplacian (+128) Original + Laplacian Original - Laplacian Why does the sign make a difference? How can you write each filter that makes each bottom image? cse457-04-image-processing 39

  11. Summary What you should take away from this lecture: � The meanings of all the boldfaced terms. � How noise reduction is done � How discrete convolution filtering works � The effect of mean, Gaussian, and median filters � What an image gradient is and how it can be computed � How edge detection is done � What the Laplacian image is and how it is used in either edge detection or image sharpening cse457-04-image-processing 41

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend