Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

25
Lecture 6-1 CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999

Transcript of Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Page 1: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

I can see clearly now

May 4th, 1999

Page 2: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Announcements

• Assignment 4– Canny detector

• Next assignment

• Project

• Next topic?

Page 3: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

What’s the plan?

• Build on a set of primitives– Edges– Lines– Segments– Regions– Depth– Objects

• Construct a representation of a 3D scene

Page 4: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Page 5: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Threshold

Page 6: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Page 7: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Another Edge Finder

Page 8: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Wagon Wheel (From UBC)

Page 9: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Page 10: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Why bother?

• Split into signal (time) and frequency domains– Operations performed in one domain have

corresponding operations in the other

– Convolution operation in time is multiplication in the frequency domain:

)()()()( sGsFxgxf

Page 11: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Back to Discrete Edges

• Use discrete approximations

),(),1(),(),( yxfyxfyxfyxfx x

),()1,(),(),( yxfyxfyxfyxfy y

),(),1(2),2()(22

2

yxfyxfyxfffx

fxxx

Page 12: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

We have Edges -- Now What?

• Recognize objects in images

• Correlation– How closely related are two functions

(usually R.V.’s)?– Varies from -1 (perfect negative) through 0

(no correlation) to 1

1 1 22

1 2

2121

2121

n n nn

n n

,nn,nn

,nn,nn

r22 BA

BA A & B must be the same size

Page 13: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Using Correlation

Page 14: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Hough Transform

• Parameterize– What’s a line?

• Use parameterization to look for curves/shapes

Page 15: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Hough Transform Example

Suppose we are looking for straight lines in an image.

Start with a point (x',y') in the image,

all lines which pass through that pixel have the form:

cxmy

Page 16: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Hough Transform ExampleTreat x’ and y’ as constants (fix the point under consideration)

Each line through the point (x’, y’) is a point on the (m, c) line

yxmc

Page 17: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Hough Transform Example

Back to the image: Consider two pixels p and q that lie on the same line in the image

p

q

x

y

p

q

m

c

For each pixel, all of the possible lines through it are represented by a single line in (m,c) space.

Single line in (x,y) space which goes through both pixels lies on the intersection of the two lines representing p and q in (m,c) space

Page 18: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Hough Conclusion

• All pixels which lie on the same line in (x,y) space are represented by lines which all pass through a single point in (m,c) space– Single point through which they all pass

gives the values of m and c in the equation of the line y=mx+c.

Page 19: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Properties of the Hough Transform

• What kinds of lines can be detected?

)sin()cos( 11 θyθx

• What’s the range of m?Number of unknown parameters increases the amount of processing increases exponentially.

Page 20: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Image Segmentation

• Break an image into homogeneous segments

• What’s a segment?– No abrupt changes in intensity across

interior– Edge detection can do this, but doesn’t

have to

Page 21: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Segmentation Techniques

• Pixel classification

• Splitting and merging

• Relaxation

Page 22: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Pixel Classification

• Partition the gray scale into intervals– 0 to 31, 32 to 63, 64 to 95, 96 to …– Each interval maps to a class

• Quick and dirty, but:– Ignores pixel location in image– Works better for color

Page 23: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Splitting & Merging• Start with an image, I, and split into

subsections, Si, where i = 1 .. M

• Define a predicate, H– Checks whether a subsection is

homogeneous

• Four conditions:

i

m

iSI

1 jiSS ji ,

iSH i , jiSSAdjacentSSH jiji ),,(,

1)

3)

2)

4)

Page 24: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Split, Merge or Both

• Merge: Start with condition 3 and begin merging– Individual pixels satisfy 3

• Split: Start with condition 4 and begin splitting– Whole image satisfies 4

Page 25: Lecture 6-1CS251: Intro to AI/Lisp II I can see clearly now May 4th, 1999.

Lecture 6-1 CS251: Intro to AI/Lisp II

Relaxation

• Iterative process of labeling

• Reinforce or inhibit confidence of labeling

• Keep doing it

• Convergence?