CSE 473/573 Computer Vision and Image Processing (CVIP)

55
CSE 473/573 Computer Vision and Image Processing (CVIP) Ifeoma Nwogu [email protected] Lecture 13 + 14 Texture 1

description

CSE 473/573 Computer Vision and Image Processing (CVIP). Ifeoma Nwogu [email protected] Lecture 13 + 14 – Texture. Schedule. Last class We finished local features Today Textures Readings for today: Forsyth and Ponce Chapter 6.1 – 6.4. Texture. From F & P, used with permission. - PowerPoint PPT Presentation

Transcript of CSE 473/573 Computer Vision and Image Processing (CVIP)

Page 1: CSE 473/573  Computer Vision and Image Processing (CVIP)

CSE 473/573 Computer Vision and Image Processing (CVIP)

Ifeoma [email protected]

Lecture 13 + 14 – Texture

1

Page 2: CSE 473/573  Computer Vision and Image Processing (CVIP)

Schedule

• Last class – We finished local features

• Today– Textures

• Readings for today: Forsyth and Ponce Chapter 6.1 – 6.4

2

Page 3: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture

From F & P, used with permission

Page 4: CSE 473/573  Computer Vision and Image Processing (CVIP)

What is texture?

• Patterns of structure from– changes in surface albedo (eg printed cloth)– changes in surface shape (eg bark)– many small surface patches (eg leaves on a bush)

• Hard to define; but texture tells us– what a surface is like– (sometimes) object identity– (sometimes) surface shape

Page 5: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture and Material

http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

Page 6: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture and Orientation

http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

Page 7: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture and Scale

http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

Page 8: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture: Core Problems

• Represent complex surface textures to recognize – objects– materials– textures

• Synthesize texture from examples– to create big textures for computer graphics– to fill in holes in images caused by editing

Page 9: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation

• Core idea: Textures consist of– a set of elements– repeated in some way

• Representations– identify the elements– summarize the repetition

Page 10: CSE 473/573  Computer Vision and Image Processing (CVIP)

Notice how the change in pattern elements and repetitions is the main

difference between differenttextured surfaces

(the plants, the ground, etc.)

Page 11: CSE 473/573  Computer Vision and Image Processing (CVIP)

Different materials tendto have different textures

Page 12: CSE 473/573  Computer Vision and Image Processing (CVIP)

Filter based texture representations• Choose a set of filters, each representing a pattern

element– typically a spot and some oriented bars

• Apply all the filter the image at a variety of scales• Rectify the filtered images

– typically half wave, to avoid averaging contrast reversals• e.g. should not average dark spot on light background, light spot on dark

background to zero

• Compute summaries of rectified filtered images– e.g. smoothed average– at a variety of scales to capture

• nearby pattern elements and general picture of pattern elements

• Now describe each pixel by vector of summaries– which could be very long

Page 13: CSE 473/573  Computer Vision and Image Processing (CVIP)
Page 14: CSE 473/573  Computer Vision and Image Processing (CVIP)

How can we represent texture?

• Compute responses of blobs and edges at various orientations and scales

Page 15: CSE 473/573  Computer Vision and Image Processing (CVIP)

Overcomplete representation: filter banks

LM Filter Bank

Code for filter banks: www.robots.ox.ac.uk/~vgg/research/texclass/filters.html

Page 16: CSE 473/573  Computer Vision and Image Processing (CVIP)

Filter banks• Process image with each filter and keep

responses (or squared/abs responses)

Page 17: CSE 473/573  Computer Vision and Image Processing (CVIP)

Representing texture• Take the vectors of filter responses at each pixel and cluster

them, then take histograms

Page 18: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation• Textures are made up of repeated local

patterns, so:– Find the patterns

• Use filters that look like patterns (spots, bars, raw patches…)

• Consider magnitude of response

– Describe their statistics within each local window• Mean, standard deviation• Histogram• Histogram of “prototypical” feature occurrences

Page 19: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

original image

derivative filter responses, squared

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Page 20: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

original image

derivative filter responses, squared

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Page 21: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

original image

derivative filter responses, squared

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Page 22: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

original image

derivative filter responses, squared

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Win.#9 20

20

Page 23: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Win.#9 20

20

Dimension 1 (mean d/dx value)

Dim

ensi

on 2

(mea

n d/

dy v

alue

)

Page 24: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Win.#9 20

20

Dimension 1 (mean d/dx value)

Dim

ensi

on 2

(mea

n d/

dy v

alue

)

Windows with small gradient in both directions

Windows with primarily vertical edges

Windows with primarily horizontal edges

Both

Page 25: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

original image

derivative filter responses, squared

visualization of the assignment to texture

“types”

Page 26: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representation: example

statistics to summarize patterns in small

windows

mean d/dx

value

mean d/dy

value

Win. #1 4 10

Win.#2 18 7

Win.#9 20

20

Dimension 1 (mean d/dx value)

Dim

ensi

on 2

(mea

n d/

dy v

alue

)

Far: dissimilar textures

Close: similar textures

Page 27: CSE 473/573  Computer Vision and Image Processing (CVIP)

Example based texture representations

Q: how does one choose the filters?• Responses to over-complete filter banks

– build histograms over filter responses– describe textures using clusters of responses

• Alternative – build a vocabulary of pattern elements from

pictures– describe textures using this vocabulary

Page 28: CSE 473/573  Computer Vision and Image Processing (CVIP)

Building a vocabulary

• There are 2 steps to building a pooled texture representation for texture in an image domain.1. Build a dictionary representing the range of possible pattern

elements, using a large number of texture patches2. Vectorize the patches in images using the clusters learned

Page 29: CSE 473/573  Computer Vision and Image Processing (CVIP)

Building a dictionary

• Collect many training example textures• Construct the vectors x for the relevant pixels;

these could be a reshaping of a patch around the pixel or a vector of filter outputs computed at the pixel

• Obtain k cluster centers c for these examples

29

Page 30: CSE 473/573  Computer Vision and Image Processing (CVIP)

Representing an image domain

• For each relevant pixel pixel I in the image– Compute the vector representation xi for that

pixel– Obtain j, the index of the cluster center cj closest

to that pixel– Insert j into a histogram for that domain

30

Page 31: CSE 473/573  Computer Vision and Image Processing (CVIP)

Clustering the examples• For using k-means we can represent patches

with– intensity vector– vector of filter responses over pixel/patch

Page 32: CSE 473/573  Computer Vision and Image Processing (CVIP)

Representing a region• Vector Quantization

– Represent a high-dimensional data item with a single number• Find the number of the nearest cluster center in dictionary• Use that to represent the cluster

• Summarize the pattern of patches– Cut region into patches– Vector quantize - vector quantized image patches are

sometimes called visual words– Build histogram of resulting numbers

Page 33: CSE 473/573  Computer Vision and Image Processing (CVIP)
Page 34: CSE 473/573  Computer Vision and Image Processing (CVIP)
Page 35: CSE 473/573  Computer Vision and Image Processing (CVIP)
Page 36: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture representations

• A vector summarizing the trends in pattern elements– either overall trend in filter responses– or histogram of vector quantized patches

• At a pixel– compute representations for domains centered on

the pixel• For a region

– compute representations the whole region

Page 37: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture synthesis• Problem:

– Take a small example image of pure texture– Use this to produce a large domain of “similar” texture

• Why:– Computer graphics demands lots of realistic texture, hard

to find– Fill in holes in images created by removing objects

• Simple case:– Assume we must synthesize a single pixel in a large image– Approach:

• Match the window around that pixel to other windows in the image

• Choose a value from the matching windows– most likely, uniformly and at random

Page 38: CSE 473/573  Computer Vision and Image Processing (CVIP)

Just like copying…• but not just repetition

38Pattern repeated

Photo

Page 39: CSE 473/573  Computer Vision and Image Processing (CVIP)

ApproachesGenerate new examples of a texture.• Original approach: Use the same representation for

analysis and synthesis– This can produce good results for random textures, but

fails to account for some regularities

• Recent approach: Use an image of the texture as the source of a probability model– This draws samples directly from the actual texture, so can

account for more types of structure– Very simple to implement– However, depends on choosing a correct distance

parameter39

Page 40: CSE 473/573  Computer Vision and Image Processing (CVIP)

Other more recent approaches

• Matching methods • Find another patch that looks a lot like the boundary hole• Place that patch over the hole and blend (segmentation)

the patch and hole together

• Boundary hole filling• Coherence methods (applying cost function +

constraints)• Variational methods (for non-texture holes)

40

Page 41: CSE 473/573  Computer Vision and Image Processing (CVIP)

Efros and Leung method

• For each new pixel p (select p on boundary of texture):– Match a window around p to sample texture, and select several

closest matches• Matching minimizes sum of squared differences of each pixel in the

window (Gaussian weighted)• Give zero weight to empty pixels in the window

– Select one of the closest matches at random and use its center value for p

– Size and shape of the neighborhood matter41

Page 42: CSE 473/573  Computer Vision and Image Processing (CVIP)

Initial conditions for E & L

• If no initial conditions are specified, just pick a patch from the texture at random

• To fill in an empty region within an existing texture:– Grow away from pixels that are on the boundary

of the existing texture

42

Page 43: CSE 473/573  Computer Vision and Image Processing (CVIP)

Usefulness of boundary edges

Page 44: CSE 473/573  Computer Vision and Image Processing (CVIP)

Window size parameter

44

Page 45: CSE 473/573  Computer Vision and Image Processing (CVIP)

More results – window size

45

Page 46: CSE 473/573  Computer Vision and Image Processing (CVIP)

Image extrapolation

46

Page 47: CSE 473/573  Computer Vision and Image Processing (CVIP)

Image extension results…..

47

Page 48: CSE 473/573  Computer Vision and Image Processing (CVIP)

Failures

48

Page 49: CSE 473/573  Computer Vision and Image Processing (CVIP)

Fill in holes by looking for examplepatches in the image.

If needed, rectify faces (lower images).

Page 50: CSE 473/573  Computer Vision and Image Processing (CVIP)

State of the art in image fill-in is very

good. This usestexture synthesis

and other methods.

Page 51: CSE 473/573  Computer Vision and Image Processing (CVIP)

Texture: crucial points• Texture is the result of repetition of pattern

elements• Representation of textures

– vocabulary of pattern elements• either filters or visual words

– summary of how they repeat• local averages of rectified filter responses or histograms

• Synthesis of texture – Good, relatively simple procedures are available

• Texture reveals shape

Page 52: CSE 473/573  Computer Vision and Image Processing (CVIP)

Assignment 2???

52

Task:Make the donkey vanish

Fill in the black hole using texture from the white box region

Page 53: CSE 473/573  Computer Vision and Image Processing (CVIP)

Slide Credits

• David A. Forsyth - UIUC• Derek Hoeim – UIUC• Jana Kosecka - GMU

53

Page 54: CSE 473/573  Computer Vision and Image Processing (CVIP)

Next class

• PCA (lectures by Devansh)• Readings for next lecture:

– Please review your basic linear algebra• Readings for today:

– Forsyth and Ponce 6.1 - 6.4

54

Page 55: CSE 473/573  Computer Vision and Image Processing (CVIP)

Questions

55