CAP 545 Computer Vision Fall 2 Dr. Mubarak Sa Univ. o Central Florida www.cs.uc.edu/~vision/courses/cap545/all22 Oice 247-F HEC
Filtering Lecture-2
General Binary Gray Scale Color
Binary Images Y Row X q : Black : Wite Row q p
Gray Level Image 5 9
Gray Scale Image
Color Image Red, Green, Blue Cannels
Image Histogram
Image Noise Ligt Variations Camera Electronics Surace Relectance Lens
Image Noise I,y) : te true piel values n,y) : te noise at piel,y) I ˆ,, y I, y n y
Gaussian Noise n n 2, y e 2 2
Image Derivatives & Averages
Deinitions Derivative: Rate o cange Speed is a rate o cange o a distance Acceleration is a rate o cange o speed Average Mean) Dividing te sum o N values by N
Derivative d d lim ) ) ) v ds dt speed a dv dt acceleration
Eamples y dy d 2 4 2 4 3 y dy d sin cos e ) e
Discrete Derivative ) ) ) lim d d ) ) ) d d ) ) ) d d
Discrete Derivative Finite Dierence d d ) ) ) Backward dierence d d ) ) ) Forward dierence d d ) ) ) Central dierence
Eample ) 5 25 2 2 2 ) 5 5 5 5 ) 5 5 5 2 5 Derivative Masks Backward dierence Forward dierence Central dierence [- ] [ -] [- ]
Derivatives in 2 Dimensions ), y Given unction y y y y y ), ), ), Gradient vector 2 2 ), y y Gradient magnitude y tan Gradient direction
Derivatives o Images 3 Derivative masks 3 y 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 I I
Derivatives o Images I y 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 I
Correlation k l l j k i l k,, Kernel Image 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 *
Convolution k, li k j l *, k l Image 7 8 9 X lip Kernel 4 5 6 2 3 2 3 4 5 6 7 8 9 Y lip 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 * 4 7 9 6 3 2 5 8 8 5 2 3 6 9 7 4
Convolution,) ),,) ),,) ),,) ),,) ),,) ), ), ), ), ), ), ), ), y y y y y y y y y y ), ), i j j i i y i -,,, -,,, -,-,-,- Coordinates
Averages Mean n I n I I I I n i i n 2 Weigted mean n w I n I w I w w I I n i i i n n 2 2
Gaussian Filter g 2 2 2 ) e g y 2 2, y) e 2 2 g )..3.6.6.3.
Properties o Gaussian Most common natural model Smoot unction, it as ininite number o derivatives Fourier Transorm o Gaussian is Gaussian. Convolution o a Gaussian wit itsel is a Gaussian. Tere are cells in eye tat perorm Gaussian iltering.
Filtering Modiy piels based on some unction o te neigborood 3 2 2 9 p 5.7 Alper Yilmaz, Mubarak Sa, UCF
Linear Filtering Te output is te linear combination o te neigborood piels 3-2 2. - = 5 4 - Image Kernel Filter Output Alper Yilmaz, Mubarak Sa, UCF
Filtering Eamples * Alper Yilmaz, Mubarak Sa, UCF
Filtering Eamples * Alper Yilmaz, Mubarak Sa, UCF
Filtering Eamples * 9 Alper Yilmaz, Mubarak Sa, UCF
Filtering Eamples * 25 Alper Yilmaz, Mubarak Sa, UCF
Blurring Eamples 8.3 2.4 original piel oset iltered 8 4.3 8 6 4.8 4 original piel oset iltered
Filtering Gaussian * Alper Yilmaz, Mubarak Sa, UCF
Gaussian vs. Smooting Gaussian Smooting Smooting by Averaging Alper Yilmaz, Mubarak Sa, UCF
Noise Filtering Ater Averaging Gaussian Noise Ater Gaussian Smooting Alper Yilmaz, Mubarak Sa, UCF
MATLAB Functions conv: -D Convolution. C = conva, B) convolves vectors A and B. conv2: Two dimensional convolution. C = conv2a, B) perorms te 2-D convolution o matrices A and B.
MATLAB Functions ilter2: Two-dimensional digital ilter. Y = ilter2b,x) ilters te data in X wit te 2-D FIR ilter in te matri B. Te result, Y, is computed using 2-D correlation and is te same size as X. ilter2 uses CONV2 to do most o te work. 2- D correlation is related to 2-D convolution by a 8 degree rotation o te ilter matri.
MATLAB Functions gradient: Approimate gradient. [FX,FY] = gradientf) returns te numerical gradient o te matri F. FX corresponds to df/d, FY corresponds to df/dy. mean: Average or mean value. For vectors, meanx) is te mean value average) o te elements in X.
MATLAB Functions special: Create predeined 2-D ilters H = specialtype) creates a two-dimensional ilter H o te speciied type. Possible values or TYPE are: 'average' averaging ilter; 'gaussian' Gaussian lowpass ilter 'laplacian' ilter approimating te 2-D Laplacian operator 'log' Laplacian o Gaussian ilter 'prewitt' Prewitt orizontal edge-empasizing ilter 'sobel' Sobel orizontal edge-empasizing ilter Eample: H=special'gaussian',7,) creates a 77 Gaussian ilter wit variance.