CS 2770: Computer Vision Linear Algebra and Matlab

Slides:



Advertisements
Similar presentations
MF-852 Financial Econometrics
Advertisements

Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
Matrices MSU CSE 260.
Finding the Inverse of a Matrix
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Compiled By Raj G. Tiwari
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Sundermeyer MAR 550 Spring Laboratory in Oceanography: Data and Methods MAR550, Spring 2013 Miles A. Sundermeyer Linear Algebra & Calculus Review.
Little Linear Algebra Contents: Linear vector spaces Matrices Special Matrices Matrix & vector Norms.
Matrix Algebra. Quick Review Quick Review Solutions.
Chapter 4 Matrices By: Matt Raimondi.
CS 1699: Intro to Computer Vision Matlab Tutorial Prof. Adriana Kovashka University of Pittsburgh September 3, 2015.
Linear Filters Monday, Jan 24 Prof. Kristen Grauman UT-Austin …
Linear Filters August 27 th 2015 Devi Parikh Virginia Tech 1 Slide credit: Devi Parikh Disclaimer: Many slides have been borrowed from Kristen Grauman,
Fundamentals of Engineering Analysis
Chapter 6 Systems of Linear Equations and Matrices Sections 6.3 – 6.5.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
2 2.1 © 2012 Pearson Education, Inc. Matrix Algebra MATRIX OPERATIONS.
Matrices: Simplifying Algebraic Expressions Combining Like Terms & Distributive Property.
Chapter 2 … part1 Matrices Linear Algebra S 1. Ch2_2 2.1 Addition, Scalar Multiplication, and Multiplication of Matrices Definition A matrix is a rectangular.
Matrix Operations.
Copyright © Cengage Learning. All rights reserved. 2 SYSTEMS OF LINEAR EQUATIONS AND MATRICES.
Copyright © Cengage Learning. All rights reserved. 2 SYSTEMS OF LINEAR EQUATIONS AND MATRICES.
MATRIX A set of numbers arranged in rows and columns enclosed in round or square brackets is called a matrix. The order of a matrix gives the number of.
Pixels and Image Filtering Computational Photography Derek Hoiem 08/26/10 Graphic:
Capturing Light… in man and machine CS194: Image Manipulation & Computational Photography Alexei Efros, UC Berkeley, Fall 2015.
Chapter 1 Section 1.6 Algebraic Properties of Matrix Operations.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
13.3 Product of a Scalar and a Matrix.  In matrix algebra, a real number is often called a.  To multiply a matrix by a scalar, you multiply each entry.
Lecture 1 Linear algebra Vectors, matrices. Linear algebra Encyclopedia Britannica:“a branch of mathematics that is concerned with mathematical structures.
Ch. 12 Vocabulary 1.) matrix 2.) element 3.) scalar 4.) scalar multiplication.
10.4 Matrix Algebra. 1. Matrix Notation A matrix is an array of numbers. Definition Definition: The Dimension of a matrix is m x n “m by n” where m =
2.1 Matrix Operations 2. Matrix Algebra. j -th column i -th row Diagonal entries Diagonal matrix : a square matrix whose nondiagonal entries are zero.
MTH108 Business Math I Lecture 20.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Capturing Light… in man and machine
Sections 2.4 and 2.5 Matrix Operations
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
10.4 The Algebra of Matrices
Linear Algebra review (optional)
Linear Algebra Lecture 2.
Chapter 7 Matrix Mathematics
Copyright © 2009 Dan Nettleton
Finding the Inverse of a Matrix
Capturing Light… in man and machine
Linear Filters April 6th, 2017
MATHEMATICS Matrix Multiplication
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
L6 matrix operations.
Matrix Operations Add and Subtract Matrices Multiply Matrices
Matrices 3 1.
CS 1674: Intro to Computer Vision Linear Algebra Review
MULTIPLYING TWO MATRICES
Capturing Light… in man and machine
2. Matrix Algebra 2.1 Matrix Operations.
MATRICES MATRIX OPERATIONS.
1.3 Vector Equations.
Matrices and Matrix Operations
Matrix Algebra.
Linear Algebra review (optional)
Linear Algebra Lecture 11.
Math review - scalars, vectors, and matrices
Laboratory in Oceanography: Data and Methods
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
3.5 Perform Basic Matrix Operations Algebra II.
Presentation transcript:

CS 2770: Computer Vision Linear Algebra and Matlab Prof. Adriana Kovashka University of Pittsburgh January 10, 2017

What are images? (in Matlab) Matlab treats images as matrices of numbers To proceed, let’s talk very briefly about how images are formed

Image formation (film) Slide credit: Derek Hoiem

Digital camera A digital camera replaces film with a sensor array Each cell in the array is light-sensitive diode that converts photons to electrons http://electronics.howstuffworks.com/cameras-photography/digital/digital-camera.htm Slide by Steve Seitz

Digital images Sample the 2D space on a regular grid Quantize each sample (round to nearest integer) Slide credit: Derek Hoiem, Steve Seitz

Digital images Sample the 2D space on a regular grid Quantize each sample (round to nearest integer) What does quantizing signal look like? Image thus represented as a matrix of integer values. 6 5 1D 5.9 4.6 2D Adapted from S. Seitz

Digital color images Slide credit: Kristen Grauman

Digital color images Color images, RGB color space: Split image into three channels R G B Adapted from Kristen Grauman

Images in Matlab Color images represented as a matrix with multiple channels (=1 if grayscale) Suppose we have a NxM RGB image called “im” im(1,1,1) = top-left pixel value in R-channel im(y, x, b) = y pixels down, x pixels to right in the bth channel im(N, M, 3) = bottom-right pixel in B-channel imread(filename) returns a uint8 image (values 0 to 255) Convert to double format with double or im2double column row R 0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.99 0.95 0.89 0.82 0.56 0.31 0.75 0.81 0.91 0.72 0.51 0.55 0.42 0.57 0.41 0.49 0.96 0.88 0.46 0.87 0.90 0.71 0.80 0.79 0.60 0.58 0.50 0.61 0.45 0.33 0.86 0.84 0.74 0.39 0.73 0.67 0.54 0.48 0.69 0.66 0.43 0.77 0.78 G 0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.99 0.95 0.89 0.82 0.56 0.31 0.75 0.81 0.91 0.72 0.51 0.55 0.42 0.57 0.41 0.49 0.96 0.88 0.46 0.87 0.90 0.71 0.80 0.79 0.60 0.58 0.50 0.61 0.45 0.33 0.86 0.84 0.74 0.39 0.73 0.67 0.54 0.48 0.69 0.66 0.43 0.77 0.78 B 0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.99 0.95 0.89 0.82 0.56 0.31 0.75 0.81 0.91 0.72 0.51 0.55 0.42 0.57 0.41 0.49 0.96 0.88 0.46 0.87 0.90 0.71 0.80 0.79 0.60 0.58 0.50 0.61 0.45 0.33 0.86 0.84 0.74 0.39 0.73 0.67 0.54 0.48 0.69 0.66 0.43 0.77 0.78 Adapted from Derek Hoiem

Vectors and Matrices Vectors and matrices are just collections of ordered numbers that represent something: movements in space, scaling factors, word counts, movie ratings, pixel brightnesses, etc. We’ll define some common uses and standard operations on them. 14-Nov-18

Vector A column vector where A row vector where denotes the transpose operation 14-Nov-18

Vector You’ll want to keep track of the orientation of your vectors when programming in MATLAB. You can transpose a vector V in MATLAB by writing V’. 14-Nov-18

Vectors have two main uses Data can also be treated as a vector Such vectors don’t have a geometric interpretation, but calculations like “distance” still have value Vectors can represent an offset in 2D or 3D space Points are just vectors from the origin 14-Nov-18

Matrix A matrix is an array of numbers with size 𝑚↓ by 𝑛→, i.e. m rows and n columns. If , we say that is square. 14-Nov-18

Matrix Operations Addition Scaling Can only add matrices with matching dimensions, or a scalar to a matrix. Scaling 14-Nov-18

Matrix Operations Inner product (dot · product) of vectors Multiply corresponding entries of two vectors and add up the result We won’t worry about the geometric interpretation for now 14-Nov-18

Matrix Operations Multiplication The product AB is: Each entry in the result is (that row of A) dot product with (that column of B) 14-Nov-18

Matrix Operations Multiplication example: Each entry of the matrix product is made by taking the dot product of the corresponding row in the left matrix, with the corresponding column in the right one. 14-Nov-18

Matrix Operation Properties Matrix addition is commutative and associative A + B  =  B + A A + (B + C)  =  (A + B) + C Matrix multiplication is associative and distributive but not commutative A(B*C)  =  (A*B)C A(B + C)  =  A*B + A*C A*B != B*A

Matrix Operations Transpose – flip matrix, so row 1 becomes column 1 A useful identity: 14-Nov-18

Special Matrices Identity matrix I Diagonal matrix Square matrix, 1’s along diagonal, 0’s elsewhere I ∙ [another matrix] = [that matrix] Diagonal matrix Square matrix with numbers along diagonal, 0’s elsewhere A diagonal ∙ [another matrix] scales the rows of that matrix 14-Nov-18

Norms L1 norm L2 norm Lp norm (for real numbers p ≥ 1)

Matlab Tutorial http://www. cs. pitt. edu/~kovashka/cs2770/tutorial Matlab Tutorial http://www.cs.pitt.edu/~kovashka/cs2770/tutorial.m http://www.cs.pitt.edu/~kovashka/cs2770/myfunction.m http://www.cs.pitt.edu/~kovashka/cs2770/myotherfunction.m Please cover whatever we don’t finish at home.

Tutorials and Exercises https://people.cs.pitt.edu/~milos/courses/cs2750/Tutorial/ http://www.math.udel.edu/~braun/M349/Matlab_probs2.pdf http://www.facstaff.bucknell.edu/maneval/help211/basicexercises.html Do Problems 1-8, 12 Most also have solutions Ask the TA if you have any problems