Top Banner
Announcements • Class mailing list: send email to Hyoungjune Yi: aster@ cs .umd.edu • Homework at the end of class. • Text is on reserve in the CS library. • Powerpoint should be available by 10am class day.
35

Announcements Class mailing list: send email to Hyoungjune Yi: [email protected]@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Announcements

• Class mailing list: send email to

Hyoungjune Yi: [email protected]

• Homework at the end of class.

• Text is on reserve in the CS library.

• Powerpoint should be available by 10am class day.

Page 2: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matlab tutorial and Linear Algebra Review

• Today’s goals:• Learn enough matlab to get started.• Review some basics of Linear Algebra• Essential for geometry of points and lines.• But also, all math is linear algebra.• (ok slight exaggeration).• Many slides today adapted from Octavia

Camps, Penn State.

Page 3: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Starting Matlab

• For PCs, Matlab should be a program.

• For Sun’s:

Numerical

Analysis and Visualization

Matlab 6.1

Page 4: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Help

• help• help commandEg., help plus• Help on toolbar• demo• Tutorial:

http://amath.colorado.edu/scico/tutorials/matlab/

Page 5: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matlab interpreter

• Many common functions: see help ops

Page 6: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Vectors

• Ordered set of numbers: (1,2,3,4)

• Example: (x,y,z) coordinates of pt in space. runit vecto a is ,1 If

),(

1

2

,,21

vv

xv

xxxvn

i i

n

Page 7: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Indexing into vectors

Page 8: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Vector Addition

),(),(),( 22112121 yxyxyyxx wv

vvww

V+wV+w

Page 9: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Scalar Product

),(),( 2121 axaxxxaa v

vv

avav

Page 10: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Operations on vectors

• sum

• max, min, mean, sort, …

• Pointwise: .^

Page 11: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Inner (dot) Product

vv

ww

22112121 .),).(,(. yxyxyyxxwv

The inner product is a The inner product is a SCALAR!SCALAR!

cos||||||||),).(,(. 2121 wvyyxxwv

wvwv 0.

Page 12: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matrices

nmnn

m

m

m

mn

aaa

aaa

aaa

aaa

A

21

33231

22221

11211

mnmnmn BAC Sum:Sum:

ijijij bac

A and B must have the same A and B must have the same dimensionsdimensions

Page 13: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matrices

pmmnpn BAC Product:Product:

m

kkjikij bac

1

A and B must have A and B must have compatible dimensionscompatible dimensions

nnnnnnnn ABBA

Identity Matrix:

AAIIAI

100

010

001

Page 14: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matrices

mnT

nm AC Transpose:Transpose:

jiij ac TTT ABAB )(

TTT BABA )(

IfIf AAT A is symmetricA is symmetric

Page 15: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matrices

Determinant:Determinant: A must be squareA must be square

3231

222113

3331

232112

3332

232211

333231

232221

131211

detaa

aaa

aa

aaa

aa

aaa

aaa

aaa

aaa

122122112221

1211

2221

1211det aaaaaa

aa

aa

aa

Page 16: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Matrices

IAAAA nnnnnnnn

11

Inverse:Inverse: A must be squareA must be square

1121

1222

12212211

1

2221

1211 1

aa

aa

aaaaaa

aa

Page 17: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Indexing into matrices

Page 18: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Euclidean transformations

Page 19: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

2D Translation

tt

PP

P’P’

Page 20: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

2D Translation Equation

PP

xx

yy

ttxx

ttyy

P’P’tt

tPP ),(' yx tytx

),(

),(

yx tt

yx

t

P

Page 21: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

2D Translation using Matrices

PP

xx

yy

ttxx

ttyy

P’P’tt

),(

),(

yx tt

yx

t

P

1

1

0

0

1' y

x

t

t

ty

tx

y

x

y

xP

tt PP

Page 22: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Scaling

PP

P’P’

Page 23: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Scaling Equation

PP

xx

yy

s.xs.x

P’P’s.ys.y

),('

),(

sysx

yx

P

P

PP s'

y

x

s

s

sy

sx

0

0'P

SPSP '

Page 24: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Rotation

PP

PP’’

Page 25: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Rotation Equations

Counter-clockwise rotation by an angle Counter-clockwise rotation by an angle

y

x

y

x

cossin

sincos

'

'

PP

xx

Y’Y’PP’’

X’X’

yy R.PP'

Page 26: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Degrees of Freedom

R is 2x2 R is 2x2 4 elements4 elements

BUT! There is only 1 degree of freedom: BUT! There is only 1 degree of freedom:

1)det(

R

IRRRR TT

The 4 elements must satisfy the following constraints:The 4 elements must satisfy the following constraints:

y

x

y

x

cossin

sincos

'

'

Page 27: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Stretching Equation

PP

xx

yy

SSxx.x.x

P’P’SSyy.y.y

y

xs

s

ys

xs

y

x

y

x

0

0'P

),('

),(

ysxs

yx

yx

P

P

S

PSP '

Page 28: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Stretching = tilting and projecting(with weak perspective)

y

xs

s

sy

xs

s

ys

xsy

x

yy

x

y

x

10

00

0'P

Page 29: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Linear Transformation

y

xs

s

s

y

xs

s

y

x

dc

ba

y

x

y

y

x

sincos

cossin

10

0

sincos

cossin

sincos

cossin0

0

sincos

cossin

'PSVD

Page 30: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Affine Transformation

1

' y

x

tydc

txbaP

Page 31: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Files

Page 32: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Functions

• Format: function o = test(x,y)

• Name function and file the same.

• Only first function in file is visible outside the file.

Page 33: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Images

Page 34: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Debugging

• Add print statements to function by leaving off ;

• keyboard

• debug and breakpoint

Page 35: Announcements Class mailing list: send email to Hyoungjune Yi: aster@cs.umd.eduaster@cs.umd.edu Homework at the end of class. Text is on reserve in the.

Conclusions

• Quick tour of matlab, you should teach yourself the rest. We’ll give hints in problem sets.

• Linear algebra allows geometric manipulation of points.

• Learn to love SVD.