upsampling and interpolationguerzhoy/320/lec/upsampling.pdfimage interpolation recall how a digital...

14
CSC320: Introduction to Visual Computing Michael Guerzhoy Many slides from Steve Marschner, Alexei Efros, Noah Snavely Upsampling and Interpolation Nearest-neighbor interpolation hq3x interpolation (ZSNES) http://en.wikipedia.org/wiki/Hqx

Upload: others

Post on 29-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

CSC320: Introduction to Visual Computing

Michael GuerzhoyMany slides from

Steve Marschner, Alexei Efros, Noah Snavely

Upsampling and Interpolation

Nearest-neighbor interpolation

hq3x interpolation (ZSNES) http://en.wikipedia.org/wiki/Hqx

Page 2: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Last time: Non-Maximum SuppressionAt q, we have a

maximum if the

value is larger than

those at both p and

at r. Interpolate to

get these values.

Source: D. Forsyth

Page 3: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Interpolation

• See blackboard

Page 4: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Bilinear Interpolation: Summary

Page 5: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Bilinear Interpolation

• Not actually linear

– If you fix x it’s linear in y. If you fix y, it’s linear in x.

Page 6: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Upsampling

• This image is too small for this screen:

• How can we make it 10 times as big?

• Simplest approach:

repeat each row

and column 10 times

• (“Nearest neighbor

interpolation”)

Page 7: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

Recall how a digital image is formed

• It is a discrete point-sampling of a continuous function

• If we could somehow reconstruct the original function, any new image could be generated, at any resolution and scale

1 2 3 4 5

Adapted from: S. Seitz

d = 1 in this

example

Page 8: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

1 2 3 4 5

d = 1 in this

example

Recall how a digital image is formed

• It is a discrete point-sampling of a continuous function

• If we could somehow reconstruct the original function, any new image could be generated, at any resolution and scale

Adapted from: S. Seitz

Page 9: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

1 2 3 4 52.5

1

• Convert to a continuous function:

• Reconstruct by convolution with a reconstruction filter, h

• What if we don’t know ?• Guess an approximation:

• Can be done in a principled way: filtering

d = 1 in this

example.

Note: this is linear interpolation!

Adapted from: S. Seitz

Page 10: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

“Ideal” reconstruction

Nearest-neighbor interpolation

Linear interpolation

Gaussian reconstruction

Source: B. Curless

Page 11: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Reconstruction filters• What does the 2D version of this hat function look like?

Better filters give better resampled images

• Bicubic is common choice

performs linear interpolation

(tent function) performs bilinear interpolation

Cubic reconstruction filter

Page 12: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Upsampling

• The empty pixels are initially set to 0

• Convolve with a (Gaussian, or another) filter

• If the filter sums to 1, multiply the result by 4

• ¾ of the new image was initially 0

Page 13: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

Nearest-neighbor interpolation Bilinear interpolation Bicubic interpolation

Original image: x 10

Page 14: Upsampling and Interpolationguerzhoy/320/lec/upsampling.pdfImage interpolation Recall how a digital image is formed •It is a discrete point-sampling of a continuous function •If

Image interpolation

Also used for resampling