CPSC 4040/6040 Computer Graphics Images Joshua Levine - - PowerPoint PPT Presentation

cpsc 4040 6040 computer graphics images
SMART_READER_LITE
LIVE PREVIEW

CPSC 4040/6040 Computer Graphics Images Joshua Levine - - PowerPoint PPT Presentation

CPSC 4040/6040 Computer Graphics Images Joshua Levine levinej@clemson.edu Lecture 20 Removing Warp Artifacts Nov. 5, 2015 Slide Credits: Szymon Rusinkiewicz Agenda Refresher from Lec19 Projective Warps What is the matrix? What the


slide-1
SLIDE 1

CPSC 4040/6040 Computer Graphics Images

Joshua Levine levinej@clemson.edu

slide-2
SLIDE 2

Lecture 20 Removing Warp Artifacts

  • Nov. 5, 2015

Slide Credits: Szymon Rusinkiewicz

slide-3
SLIDE 3

Agenda

slide-4
SLIDE 4

Refresher from Lec19

slide-5
SLIDE 5

Projective Warps

  • What is the matrix?
  • What the knowns? Unknowns? How many?
slide-6
SLIDE 6

Algebra

  • A general 3x3 matrix can express this entire class of warps (9 unknowns)
  • a33 acts as a global scale parameter, so we can always set it to 1

without losing generality

  • The remaining 8 unknowns can be solved by 4 pairs of equations using

the 8 known xi, yi values and the 8 known ui, vi values

  • Solving these 8 equations gives the 8 remaining aij unknowns
slide-7
SLIDE 7

Bilinear Warping

  • Key Idea: Instead of

using bilinear interpolation for pixel color values, we can use it to interpolate the positions in the warped image

slide-8
SLIDE 8

Step 2: Forward Warp with u,v offsets

slide-9
SLIDE 9

Inverse Bilinear Warp Can Be Computed from the Forward Warp

  • Forward warp for a pixel (s, t) is equivalent to the following equations:
  • where (s0, t0) is the lower left of the image, (s1, t1) is the upper right of

the image, and (effectively normalizing)

slide-10
SLIDE 10

Inverse Bilinear Warp Can Be Computed from the Forward Warp

  • Taking the inverse of
  • Leads to
  • Where 0<u<1, 0<v<1, and
slide-11
SLIDE 11

Recall: Converting Between Image Domains

  • When an image is acquired,

an image is taken from some continuous domain to a discrete domain.

  • Reconstruction converts

digital back to continuous through interpolation.

  • The reconstructed image can

then be resampled and quantized back to the discrete domain.

slide-12
SLIDE 12

Fixing Jaggies / Magnification Artifacts

slide-13
SLIDE 13

Reconstruction Artifacts

  • Leads to staircasing or “jaggies”
slide-14
SLIDE 14

Do a Better Reconstruction?

  • Basic Idea: If we interpolate the data samples

better we will have a superior reconstruction

  • How? Bilinear Interpolation, Bicubic, etc.
slide-15
SLIDE 15

Recall: Nearest Neighbor

slide-16
SLIDE 16

Recall Bilinear Example

slide-17
SLIDE 17

Recall Bicubic (from Photoshop)

Ignore small color issues

slide-18
SLIDE 18

Fixing Aliasing / Minification Artifacts:

slide-19
SLIDE 19

Aliasing Artifacts

  • Aliasing leads

to missing and/

  • r unwanted

features

  • Example:

12x12 images scaled to a 4x4 image.

slide-20
SLIDE 20

Aliasing

  • When we minify, we use only a few samples to represent lots of data
  • High frequencies “masquerade” as low ones
  • Images look “ropey”. This is not jaggies!
  • (Barely) adequate sampling

Inadequate sampling

slide-21
SLIDE 21

Aliasing Described by Sampling Theory

  • What happens if we use too few samples?
  • Aliasing: when high frequencies masquerade as low ones
slide-22
SLIDE 22

How many samples are enough to avoid aliasing?

How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?

slide-23
SLIDE 23

How many samples are enough to avoid aliasing?

How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?

slide-24
SLIDE 24

How many samples are enough to avoid aliasing?

How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?

slide-25
SLIDE 25

How many samples are enough to avoid aliasing?

How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?

slide-26
SLIDE 26

How many samples are enough to avoid aliasing?

How many samples are required to represent a given signal without loss of information? What signals can be reconstructed without loss for a given sampling rate?

slide-27
SLIDE 27

Antialiasing Filters

  • Basic Idea: Smooth the image first to reduce the
  • verall frequency
  • How? Use filters!
slide-28
SLIDE 28

Resampling with Filters

  • Output is weighted average of inputs:

float Resample(src, u, v, k, w) { float dst = 0; float ksum = 0; int ulo = u - w; etc. for (int iu = ulo; iu < uhi; iu++) { for (int iv = vlo; iv < vhi; iv++) { dst += k(u,v,iu,iv,w) * src(u,v) ksum += k(u,v,iu,iv,w); } } return dst / ksum; } Source image Destination image f (u,v) (ix,iy)

slide-29
SLIDE 29

Local Convolution?

  • Compute weighted sum of pixel neighborhood

Output is weighted average of input, where weights are normalized values of filter kernel (k)

(u,v)

k(ix,iy) represented by gray value

dst(ix,iy) = 0; for (ix = u-w; ix <= u+w; ix++) for (iy = v-w; iy <= v+w; iy++) d = dist (ix,iy) dst(ix,iy) += k(ix,iy)*src(ix,iy);

w (ix,iy) d

slide-30
SLIDE 30

Smoothing an Image in This Way Limits the Frequency Bands

Point Sampled: Aliasing! Correctly Bandlimited

slide-31
SLIDE 31

Another Approach

  • Instead of

smoothing, we can also sample better and then aggregate the samples

slide-32
SLIDE 32
slide-33
SLIDE 33

Artifact “Free” Warping Pipeline

slide-34
SLIDE 34
slide-35
SLIDE 35
  • Ideal resampling

requires correct filtering to avoid artifacts

  • Reconstruction filter

especially important when magnifying

  • Bandlimiting filter

especially important when minifying

Sample Real world Reconstruct Discrete samples (pixels) Transform Reconstructed function Filter Transformed function Sample Bandlimited function Reconstruct Discrete samples (pixels) Display

Warping Pipeline

slide-36
SLIDE 36

Lec21 Required Reading

slide-37
SLIDE 37
  • House, Ch. 13
slide-38
SLIDE 38

Feature-Based Image Metamorphosis

Comtruter GraDhics, 262, Julv 1992 7’llcI1ldljll\ Bcicr Silicon Graphics C’(mlpulcr Systc]ms 201 I Shorclirm Blvd. Moun(ain View CA 94043

.$//1 /)4’11

/v(’(’/v Pxi tic Ekild lnlagc~ I 1I 1 Karlstxi Drive. Sunny\alc CA 94)X9

1

Abstract Kc>u cwds: (’tnnpulcr Aninwi(m. Interpolation. lnwgc f%~ccsilng. Sh;ipc ‘1’r~illit(~rlll:ilit)ll.

2

Introduction 2.1 Conventional Metamorphosis Techniques Mc[:ml(wpht)iii twlween lWo or mor’c imafys (wer lime i) u uwi’ul \ i~u;ii tcchniquc. (Jflen uwd f’orCducaliomd (n’tMCid;liMll Cnt pur- pt>wi. ‘1’l-:idi(ional Iilmmahing techniques for (his cflcc[ include ~’lckcrc’ut~(iuc’h LIS u chwwwr cxhibi(ing ch:mgm while running thr(mgll ;! toreil and prosing behind several trws ) tind op[ic:d cro\\- diswdv<’. in which onc image is f:ide(i out while wwther is sinwlt:l- nLNNI\l)f’:idcdin (Mith makeup ch:mge. tippliwcm,

  • r nhjecl subs[i -

[u[I(m ). Sc\’~’riilclawic horror lilm~ illu$tfiite [he process: who ctwld

hnycl ~hcb:lir-tai~ing (fiiniform;ilml

  • f the Woitman. or the drw

m:itic lllct;itll(~rpll(~sii from Dr. Jchyll [o Mr. Hyde’? This pupcr prcwmls ii c(mtcnlp{mmy w~lu(i(mto the vi~u:d translonmrtion pnh lL’nl.

‘fiIh In: the cutIIng

appro:~~h to Ihc limit giws us the techniqw 01” il(q>-nl~xi(m :minmtion. in which the subject is progres~ively tran\- I’[mncd mrd ph(~togr:tphed tme fr:mw at a ;imc. This process c:m give the Ixmcrl’ul illusi(m of cmltinu(ms rnetamwphosis. but it require~ much skill and IS\cr! tedi~ms worh. Moreover. stop-motion tr~uully wfl”cm t’r(mlthe prt~hlcm ()( \ iiu;il itrobing by not prm iding the nl~~li~m blur n(mn:lll! :i~w}ciatcd wi(h rowing film suh,jecls. A m(~- lmn-c~mlrt)lled variwrt ctillcd gmm{)ti{m (In which the frame-h) f’rmnc \uhjccl) art! photogrtiphcd while mwlrrg) can provide [he pr{)permotion Murtocretite timorc ntitwd effect. but the cornplcxlty (i the m(deli. moti(m hfirdww. wrd required skill$ hecnmc~ mm ~,rcaw. > 2.2 3D Computer Graphics Techniques We ctin uw technology in other V.U!SI(}help build u rnc[amorphoii~ 1(x)1.For cxwnplc, w can usc computer gruphic~ to rnodcl and rcndcl- lm;igcs which trim~fornl ()~cr time.

  • nc ~ippr(xich in~(~lwi the reprcwntatlon
  • f a pair ot threc-dtmen-

\ioniil

[~biects ;ISa collecti(m (}Ipol}gon~. The vcrticw of the first

  • h,jec( :Ir; then d]splwwd (wr

time to coincldc in po~ition u Ith ~x~rrcsponding icrtice~ of the wumd (hject, v.ith color and olhcr :ittrihutes similwl~ irwrpnltitcd. The chief prohlern wlth (his [cuh- n]quc ii the difficulty in eittiblishing a de~lrahle YWCAc(m_c\fx)n-

dcncc: thii ~)f’tcn

impow inconvenient cmrstrainti on the gw]mclric rcprcwntu{inn of the objects, wch ;is requiring the wrne number of pt~l}g(nli in c;lch model. Even rf thtw c(mditions tire met. problems ilill :mw when the (npologief ~)lthc two objects Lliffcr{\uch tI\ when [me (~bject hiis ii hole thrnugh it ),{mwhen the features mu~t M(W in a comple~ vii! (such m ~iiding al(mg [he object wrf;w lrom back I()t’r(mt). This direct point-lntcrp{)ltitlon” technique can be effective, ht~wckcr. for transformations in which the data corre~pondcncc and lntcrpol; ition p;lths are slmplc. For cxtimplc, the technique wiL\ \uccc\\t’ully used for the in[erpolatlon

  • f ~ regular grid nf 31>

warmed dirto in “Star Trek IV: The Voyage Home” I I3). Methods tt)r oul(muitic:illy gener:itin.g ctmwptmdlng vertices orpol}gon~ for lnicrpol:ili(m ha~c been dcteloped. [.$1161 [)thcr cnmputcr gr:iphics techniques which ctin hc uwd for object mctarnnrphosii include WIid def(mnati[ms I I j [ l?] and purtlcle i} s[em~ {I()). In cuch u:iw ihc 31) model of the first object ii trwwf(mned I{)h:i~e the shape wrd Surt,icc prnpertie~ of the wcond

  • mwicl. and the rcwlting

imimutilm is rcnderwl :md rec(mied. 2.3 2D Computer Graphics Techniques While three-ciirllcn~ion:tl ohjwt rnctumorphoiis i\ Anatural wdutmn whcn both (~hjccti tire cwil} rnodelcd for (hc cornputcr. ()!tcn the complexly

  • f the wbjccts

makes this tipprntich imprxtical. F“nr e~imlplc. men} tipplications ot the CI”!CCI require lrwrif{mrn;i[i(ms hetwcen c(mlplcx ohject~ wch :ii anirnfili. In this caw it is often cwicr to m:inipulate wwrned phot~)griiphf of the went u~lrlg IWO dirncnsi(mul image pmccssing techniques than to attempt to model ;ind render the dct:lils of the anirn:il’s tippewmce for rhe computer. The stmplcit method for changing tmc digital image Into another i~ \Impl> to croswliswl~c Iwv.wn

  • Ihcm. The colnr nf c:ich prxcl if

35