71
COS 429: Computer Vision Texture Acknowledgment: slides from Antonio Torralba, Kristen Grauman, Jitendra Malik, Alyosha Efros, and Tom Funkhouser

Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

COS 429: Computer Vision

Texture

Acknowledgment: slides from Antonio Torralba, Kristen Grauman, Jitendra Malik, Alyosha Efros, and Tom Funkhouser

Page 2: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

What is a texture?

Torralba

Page 3: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

What is a texture?

Torralba

Page 4: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

What is a texture?

Torralba

Page 5: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

• Texture: stochastic pattern that is stationary (“looks the same” at all locations)

• May be structured or random

Wei & Levoy

Page 6: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

Stochastic Stationary

Page 7: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture

Stochastic Stationary

Page 8: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Goal

• Computational representation of texture – Textures generated by same stationary stochastic process

have same representation

– Perceptually similar textures have similar representations

5, 7, 34, 2, 199, 12 Hypothetical texture representation

Page 9: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Applications

• Segmentation

• 3D Reconstruction

• Classification

• Synthesis

http://animals.nationalgeographic.com/

Page 10: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Applications

• Segmentation

• 3D Reconstruction

• Classification

• Synthesis

Page 11: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Applications

• Segmentation

• 3D Reconstruction

• Classification

• Synthesis

Grauman

Page 12: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Applications

• Segmentation

• 3D Reconstruction

• Classification

• Synthesis

Grauman

Page 13: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Applications

• Segmentation

• 3D Reconstruction

• Classification

• Synthesis

Input Output Efros

Page 14: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture Representation?

• What makes a good texture representation? – Textures generated by same stationary stochastic process

have same representation

– Perceptually similar textures have similar representations

Page 15: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Approaches

• Statistics of filter banks

• Textons

• Markov Random Fields

Page 16: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Approaches

• Statistics of filter banks

• Textons

• Markov Random Fields

Page 17: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Filter-Based Texture Representation

• Research suggests that the human visual system performs local spatial frequency analysis (Gabor filters)

J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency relations in the receptive fields of simple cells in the visual cortex. Biol. Cybern, 43:187-198, 1982.

Page 18: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture Representation

• Analyze textures based on the responses of linear filters – Use filters that look like patterns

(spots, edges, bars, …)

– Compute magnitudes of filter responses

• Represent textures with statistics of filter responses within local windows – Histogram of feature responses for all pixels in window

Grauman

Page 19: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

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

Grauman

Page 20: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

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

Grauman

Page 21: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

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

Grauman

Page 22: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

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

ensio

n 2

(mea

n d/

dy v

alue

)

Grauman

Page 23: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

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

ensio

n 2

(mea

n d/

dy v

alue

)

Far: dissimilar textures

Close: similar textures

Grauman

Page 24: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Filter Banks

• Previous example used two filters, resulting in 2-dimensional feature vector – x and y derivatives revealed local structure

• Filter bank: many filters – Higher-dimensional feature space

– Distance still related to similarity of local structure

Grauman

Page 25: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Filter banks

• What filters to put in the bank? – Combination of different scales, orientations, patterns

scales

orientations

“Edges” “Bars”

“Spots”

Grauman

Page 26: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Imag

e fro

m h

ttp://

ww

w.te

xase

xplo

rer.c

om/a

ustin

cap2

.jpg

Grauman

Page 27: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Showing magnitude of responses

Grauman

Page 28: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 29: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 30: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 31: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 32: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 33: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 34: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 35: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 36: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 37: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 38: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 39: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 40: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 41: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 42: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 43: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 44: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 45: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Grauman

Page 46: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

You Try: Can you match the texture to the response?

Mean abs responses

Filters A

B

C

1

2

3

Derek Hoiem

Page 47: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Filter Bank Texture Representation

• Pass image through filter bank

• Analysis: Compile statistics of filter outputs – Mean

– Mean + variance

– Histogram

• Synthesis: – Start with random noise image

– Adjust histograms to match original image

– Re-synthesize image from filter outputs

Page 48: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Histogram Equalization

• Given: two histograms of intensity H1 and H2

• Goal: function that remaps intensities

to make new histogram H1’ equal H2

Intensity 1

#

Intensity 2

#

Intensity 1’

#

Intensity 1

Inte

nsity

1’

Page 49: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Histogram Equalization

1. Compute CDFs (integrals) of histograms

2. For each intensity, map through CDF 1 then look up inverse in CDF 2

Intensity 1

#

Intensity 2

#

CDF 1 CDF 2

CDF 1 CDF 2

Page 50: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Application: Texture Synthesis

Original Texture

Synthesized Texture

Heeger and Bergen

Page 51: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Application: Retrieval

• Retrieve similar images based on texture

Y. Rubner, C. Tomasi, and L. J. Guibas. The earth mover's distance as a metric for image retrieval. International Journal of Computer Vision, 40(2):99-121, November 2000,

Page 52: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Approaches

• Statistics of filter banks

• Textons

• Markov Random Fields

Page 53: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Textons

• Elements (“textons”) either identical or come from some statistical distribution

• Can analyze in natural images

Olhausen & Field

Page 54: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Clustering Textons

• Output of bank of n filters can be thought of as vector in n-dimensional space

• Can cluster these vectors using k-means [Malik et al.]

• Result: dictionary of most common textures

Page 55: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Clustering Textons

Image

Clustered Textons Texton to Pixel Mapping

Malik

Page 56: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Using Texture in Segmentation

• Compute histogram of how many times each of the k clusters occurs in a neighborhood

• Define similarity of histograms hi and hj using χ2

• Different histograms → separate regions

( )∑ +

−=

k ji

ji

khkhkhkh

)()()()( 2

2

21χ

Page 57: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Application: Segmentation

Malik

Page 58: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Approaches

• Statistics of filter banks

• Textons

• Markov Random Fields

Page 59: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Markov Random Fields

• Different way of thinking about textures

• Premise: probability distribution of a pixel depends on values of neighbors

• Probability the same throughout image – Extension of Markov chains

Page 60: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Motivation from Language

• Shannon (1948) proposed a way to synthesize new text using N-grams – Use a large text to compute probability distributions of

each letter given N–1 previous letters

– Starting from a seed repeatedly sample the conditional probabilities to generate new letters

– Can do this with image patches!

Efros

Page 61: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Texture Synthesis Based on MRF

• For each pixel in destination: – Take already-synthesized neighbors

– Find closest match in original texture

– Copy pixel to destination

• Efros & Leung 1999 – Speedup by Wei & Levoy 2000

– Extension to copying whole blocks by Efros & Freeman 2001

Wei & Levoy

Page 62: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

• Compute output pixels in scanline order (top-to-bottom, left-to-right)

Efros & Leung Algorithm

Efros

Page 63: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

• Find candidate pixels based on similarities of pixel features in neighborhoods

Efros & Leung Algorithm

Efros

Page 64: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Efros & Leung Algorithm

• Similarities of pixel neighborhoods can be computed with squared differences (SSD) of pixel colors and/or filter bank responses

||( – )||2

Efros

Page 65: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Efros & Leung Algorithm

• For each pixel p: – Find the best matching K windows from the input image

– Pick one matching window at random

– Assign p to be the center pixel of that window

input image

p

Efros

Page 66: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Synthesis Results

Efros

Page 67: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

white bread brick wall Synthesis Results

Efros

Page 68: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Synthesis Results: Homage to Shannon

Efros

Page 69: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Hole Filling

• Fill pixels in “onion skin” order – Within each “layer”, pixels with most neighbors

are synthesized first

– Normalize error by the number of known pixels

– If no close match can be found, the pixel is not synthesized until the end

Page 70: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Hole Filling

Efros

Page 71: Texture - cs.princeton.edu...performs local spatial frequency analysis (Gabor filters) J. J. Kulikowski, S. Marcelja, and P. Bishop. Theory of spatial position and spatial frequency

Extrapolation