Download Computer Vision Lecture 1: Course Overview and Convolution - Prof. Marshall Tappen and more Study Guides, Projects, Research Computer Science in PDF only on Docsity! CAP 5415 – Computer Vision Marshall Tappen Fall 2009 Lecture 1 Welcome! About Me − (Relatively) New Faculty Member (Three Years) − Interested in Machine Vision and Machine Learning − Happy to chat with you at almost any time May want to e-mail me first − Office Hours: Tuesday-Thursday after class Environments MATLAB − Pro:Well-established package. You can find many tutorials on the net. − Con: Not free. If your lab does not already have it, talk to me about getting access. Octave − Free MATLAB look-alike − Pro: Should be able to handle anything you will do in this class − Con: “Should be”. I'm not sure about support in Windows Environments Numerical Python − All the capabilities of MATLAB − Free! − Real programming language − Used for lots of stuff besides numerical computing − Cons: Documentation is a bit sparse and can be outdated I can get you started – I am working on a tutorial Math We will use it We will be talking about mathematical models of images and image formation This class is not about proving theorems My goal is to have you build intuitions about the models Try and visualize the computation that each equation is expressing Basic Calculus and Basic Linear Algebra should be sufficient Image Processing For now, we won't worry about the physical aspects of getting images View image as an array of continuous values Simple Modification What if we wanted to blur this image? We could take a local average − Replace each pixel with the mean of an NxN pixel neighborhood surrounding that pixel. 3x3 Neighborhood Original Averaged Let's represent this more generally
16
46
oO} Oo}; ol1}o
Oo] Oo] DAI Ww
NO) NI] —|}o
43
Let's represent this more generally 43200 46200 16160 0030 1/91/91/9 1/91/91/9 1/91/91/9 Input Image Kernel Let's represent this more generally Multiply corresponding numbers and add 43200 46200 16160 0030 1/91/91/9 1/91/91/9 1/91/91/9 Input Image ???? ???? ??1.33? ???? Take out a piece of paper Let’s say i= 10 and j=10 Which location in K is multiplied by I(5,5)? I(5,4) Resulting Image Input Image Convolution Kernel Resulting Image Input Image Convolution Kernel Notation Also denoted as R = I * K We “convolve” I with K − Not convolute! Sliding Template View Take the template K Flip it Slide across image 987 654 321 123 456 789 Predict the Image Input 000 100 000 Kernel Output ? Predict the Image 000 100 000 Input Kernel Output Predict the Image Predict the Image 000 000 001 Input Kernel Output Predict the Image Predict the Image Predict the kernel What if I wanted to compute R(i,j) = I(i+1,j) – I(i,j) at every pixel? What would the kernel be? This is one discrete approximation to the derivative What’s the problem with this derivative? [1 -1 0] − Where’s the center of the derivative? An alternative − [-1 0 1] Your Convolution filter toolbox In my experience, 90% of the filtering that you will do will be either − Smoothing (or Blurring) − High-Pass Filtering (I’ll explain this later) Most common filters: − Smoothing: Gaussian − High Pass Filtering: Derivative of Gaussian Effect of Changing σ With σ set to 1 With σ set to 3 Input Practical Aspects of Computing Convolutions Let's blur this flat, gray image: What should it look like? Practical Aspects of Computing Convolutions Depending on how you do the convolution in MATLAB, you could end up with 3 different images 266x266 Image 256x256 Image 246x246 Image Practical Aspects of Computing Convolutions Filled in borders with zeros, computed everywhere the kernel touches Called “full” in MATLAB 266x266 Image Border Handling
1/9 |1/9 |1/9
1/9 |1/9 |1/9
119 |1/9 |1 }/3 0
0 (6 16
0 {0 46
0 |0 43
Practical Aspects of Computing Convolutions Fill in border with zeros, only compute at “original pixels” Called “same” in MATLAB 256x256 Image There are other options The first two methods that I described fill missing values in by substituting zero Can fill in values with different methods − Reflect image along border − Pull values from other side Not supported in MATLAB's convolution − Eero Simoncelli has a package that supports that kind of convolution Going Non-Linear Convolution is a linear operation − What does that mean? A simple non-linear operation is the median filter − Will explore that filter in the first problem set. Practical Use of These Properties – Image Sharpening Take this image and blur it Let's make the image sharper We know + = Let's boost the sharp stuff a little +2× Let's boost the sharp stuff a little +2× = Rewrite this This is an identity filter or unit impulse Basic Convolution Properties Can derive all of these with the definition of convolution Comes from linearity of convolution Rewrite this
Tx f+2(2—-Txf)
Tx f+2(Z*xd—-—TZx f)
T x (f +206 —2f)