數(shù)字視頻特效處理lec05-morphing圖像變形_第1頁
數(shù)字視頻特效處理lec05-morphing圖像變形_第2頁
數(shù)字視頻特效處理lec05-morphing圖像變形_第3頁
數(shù)字視頻特效處理lec05-morphing圖像變形_第4頁
數(shù)字視頻特效處理lec05-morphing圖像變形_第5頁
已閱讀5頁,還剩97頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

Imagewarping/morphingDigitalVisualEffectsYung-YuChuangwithslidesbyRichardSzeliski,SteveSeitz,TomFunkhouserandAlexeiEfrosImagewarpingImageformationABSamplingandquantizationWhatisanimageWecanthinkofanimageasafunction,f:R2

R:f(x,y)givestheintensityatposition(x,y)definedoverarectangle,withafiniterange:f:[a,b]x[c,d]

[0,1]AcolorimagexyfAdigitalimageWeusuallyoperateondigital(discrete)

images:Samplethe2DspaceonaregulargridQuantizeeachsample(roundtonearestinteger)IfoursamplesareDapart,wecanwritethisas:

f[i,j]=Quantize{f(iD,jD)}TheimagecannowberepresentedasamatrixofintegervaluesImagewarpingimagefiltering:changerangeofimageg(x)=h(f(x))fxhgxfxhgximagewarping:changedomainofimageg(x)=f(h(x))h(y)=0.5y+0.5h(y)=2yImagewarpinghhffggimagefiltering:changerangeofimageg(x)=h(f(x))imagewarping:changedomainofimageg(x)=f(h(x))h(y)=0.5y+0.5h([x,y])=[x,y/2]Parametric(global)warpingtranslationrotationaspectaffineperspectivecylindricalExamplesofparametricwarps:Parametric(global)warpingTransformationTisacoordinate-changingmachine:p’=T(p)WhatdoesitmeanthatTisglobal?Isthesameforanypointpcanbedescribedbyjustafewnumbers(parameters)RepresentTasamatrix:p’=M*pTp=(x,y)p’=(x’,y’)ScalingScalingacoordinatemeansmultiplyingeachofitscomponentsbyascalarUniformscalingmeansthisscalaristhesameforallcomponents:

2fgNon-uniformscaling:differentscalarspercomponent:Scalingx2,

y

0.5ScalingScalingoperation:Or,inmatrixform:scalingmatrixSWhat’sinverseofS?2-DRotationThisiseasytocaptureinmatrixform:Eventhoughsin(q)andcos(q)arenonlineartoq,x’isalinearcombinationofxandyy’isalinearcombinationofxandyWhatistheinversetransformation?Rotationby–qForrotationmatrices,det(R)=1soR2x2MatricesWhattypesoftransformationscanbe

representedwitha2x2matrix?2DIdentity?2DScalearound(0,0)?2x2MatricesWhattypesoftransformationscanbe

representedwitha2x2matrix?2DRotatearound(0,0)?2DShear?2x2MatricesWhattypesoftransformationscanbe

representedwitha2x2matrix?2DMirroraboutYaxis?2DMirrorover(0,0)?All2DLinearTransformationsLineartransformationsarecombinationsof…Scale,Rotation,Shear,andMirrorPropertiesoflineartransformations:OriginmapstooriginLinesmaptolinesParallellinesremainparallelRatiosarepreservedClosedundercomposition2x2MatricesWhattypesoftransformationscannotbe

representedwitha2x2matrix?2DTranslation?Onlylinear2Dtransformationscanberepresentedwitha2x2matrixNO!TranslationExampleoftranslationtx=2

ty

=1HomogeneousCoordinatesAffineTransformationsAffinetransformationsarecombinationsof…Lineartransformations,andTranslationsPropertiesofaffinetransformations:OrigindoesnotnecessarilymaptooriginLinesmaptolinesParallellinesremainparallelRatiosarepreservedClosedundercompositionModelschangeofbasisProjectiveTransformationsProjectivetransformations…Affinetransformations,andProjectivewarpsPropertiesofprojectivetransformations:OrigindoesnotnecessarilymaptooriginLinesmaptolinesParallellinesdonotnecessarilyremainparallelRatiosarenotpreservedClosedundercompositionModelschangeofbasisImagewarpingGivenacoordinatetransformx’

=T(x)andasourceimageI(x),howdowecomputeatransformedimageI’(x’)

=

I(T(x))?I(x)I’(x’)xx’T(x)ForwardwarpingSendeachpixelI(x)toitscorrespondinglocationx’

=

T(x)inI’(x’)I(x)I’(x’)xx’T(x)Forwardwarpingfwarp(I,I’,T){for(y=0;y<I.height;y++)for(x=0;x<I.width;x++){(x’,y’)=T(x,y);I’(x’,y’)=I(x,y);}}II’xx’TForwardwarpingSomedestinationmaynotbecoveredManysourcepixelscouldmaptothesamedestinationForwardwarpingSendeachpixelI(x)toitscorrespondinglocationx’

=

T(x)inI’(x’)f(x)g(x’)xx’h(x)Whatifpixellands“between”twopixels?Willbethereholes?Answer:add“contribution”toseveralpixels,normalizelater(splatting)Forwardwarpingfwarp(I,I’,T){for(y=0;y<I.height;y++)for(x=0;x<I.width;x++){(x’,y’)=T(x,y);

Splatting(I’,x’,y’,I(x,y),kernel);}}II’xx’TInversewarpingGeteachpixelI’(x’)fromitscorrespondinglocationx

=

T-1(x’)inI(x)I(x)I’(x’)xx’T-1(x’)Inversewarpingiwarp(I,I’,T){for(y=0;y<I’.height;y++)for(x=0;x<I’.width;x++){(x,y)=T-1(x’,y’);I’(x’,y’)=I(x,y);}}II’xx’T-1InversewarpingGeteachpixelI’(x’)fromitscorrespondinglocationx

=

T-1(x’)inI(x)Whatifpixelcomesfrom“between”twopixels?Answer:resamplecolorvaluefrominterpolated(prefiltered)sourceimagef(x)g(x’)xx’Inversewarpingiwarp(I,I’,T){for(y=0;y<I’.height;y++)for(x=0;x<I’.width;x++){(x,y)=T-1(x’,y’);

I’(x’,y’)=Reconstruct(I,x,y,kernel);}}II’xx’T-1InversewarpingNohole,butmustresampleWhatvalueshouldyoutakefornon-integercoordinate?Closestone?InversewarpingItcouldcausealiasingReconstructionReconstructiongeneratesanapproximationtotheoriginalfunction.Erroriscalledaliasing.samplepositionsamplevaluesamplingreconstructionReconstructionComputedweightedsumofpixelneighborhood;outputisweightedaverageofinput,whereweightsarenormalizedvaluesoffilterkernelkwidthdcolor=0;weights=0;forallq’sdist<widthd=dist(p,q);w=kernel(d);color+=w*q.color;weights+=w;p.Color=color/weights;

pqTrianglefilterGaussianfilterSamplingbandlimitedReconstructionThereconstructedfunctionisobtainedbyinterpolatingamongthesamplesinsomemannerReconstruction(interpolation)Possiblereconstructionfilters(kernels):nearestneighborbilinearbicubicsinc(optimalreconstruction)Bilinearinterpolation(trianglefilter)AsimplemethodforresamplingimagesNon-parametricimagewarpingSpecifyamoredetailedwarpfunctionSplines,meshes,opticalflow(per-pixelmotion)Non-parametricimagewarpingMappingsimpliedbycorrespondencesInversewarpingP’?Non-parametricimagewarpingP’BarycentriccoordinatePBarycentriccoordinatesNon-parametricimagewarpingBarycentriccoordinateNon-parametricimagewarpingradialbasisfunctionGaussianthinplatesplineImagewarpingWarpingisausefuloperationformosaics,videomatching,viewinterpolationandsoon.Anapplicationofimagewarping:

facebeautificationData-drivenfacialbeautificationFacialbeautificationFacialbeautificationFacialbeautificationTrainingsetFaceimages92youngCaucasianfemale33youngCaucasianmaleFeatureextractionFeatureextractionExtract84featurepointsbyBTSMDelaunaytriangulation->234Ddistancevector(normalizedbythesquarerootoffacearea)BTSMscatterplotforalltrainingfaces234DvectorBeautificationengineSupportvectorregression(SVR)SimilarconcepttoSVM,butforregressionRBFkernelsfb(v)BeautificationprocessGiventhenormalizeddistancevectorv,generateanearbyvectorv’sothatfb(v’)>fb(v)TwooptionsKNN-basedSVR-basedKNN-basedbeautification4.34.55.13.14.65.3vv'SVR-basedbeautificationDirectlyusefbtoseekv’Usestandardno-derivativedirectionsetmethodforminimizationFeatureswerereducedto35DbyPCASVR-basedbeautificationProblems:itsometimesyieldsdistancevectorscorrespondingtoinvalidhumanfaceSolution:addlog-likelihoodterm(LP)LPisapproximatedbymodelingfacespaceasamultivariateGaussiandistributionu’sprojectioninPCAspace’si-thcomponenti-theigenvaluePCAλ1λ2EmbeddingandwarpingDistanceembeddingConvertmodifieddistancevectorv’toanewfacelandmarkAgraphdrawingproblemreferredtoasastressminimizationproblem,solvedbyLMalgorithmfornon-linearminimization1ifiandjbelongtodifferentfacialfeatures10otherwiseDistanceembeddingPostprocessingtoenforcesimilaritytransformforfeaturesoneyesbyminimizingOriginalK=3K=5SVRResults(intrainingset)UserstudyResults(notintrainingset)BypartsfullmoutheyesDifferentdegrees50%100%FacialcollageImagemorphingImagemorphingThegoalistosynthesizeafluidtransformationfromoneimagetoanother.image#1image#2dissolvingCrossdissolvingisacommontransitionbetweencuts,butitisnotgoodformorphingbecauseoftheghostingeffects.Artifactsofcross-dissolving/ImagemorphingWhyghosting?Morphing=warping+cross-dissolvingshape(geometric)color(photometric)morphingcross-dissolvingImagemorphingimage#1image#2warpwarpMorphingsequenceFaceaveragingbymorphingaveragefacesImagemorphingcreateamorphingsequence:foreachtimetCreateanintermediatewarpingfield(byinterpolation)WarpbothimagestowardsitCross-dissolvethecolorsinthenewlywarpedimagest=0t=1t=0.33Anidealexample(in2004)t=0t=1t=0.25t=0.5t=0.75morphingAnidealexamplemiddleface(t=0.5)t=0t=1Warpspecification(meshwarping)Howcanwespecifythewarp?1.Specifycorrespondingsplinecontrolpointsinterpolatetoacompletewarpingfunctioneasytoimplement,butlessexpressiveWarpspecificationHowcanwespecifythewarp2.SpecifycorrespondingpointsinterpolatetoacompletewarpingfunctionSolution:converttomeshwarpingDefineatriangularmeshoverthepointsSamemeshinbothimages!Nowwehavetriangle-to-trianglecorrespondencesWarpeachtriangleseparatelyfromsourcetodestinationHowdowewarpatriangle?3points=affinewarp!JustliketexturemappingWarpspecification(fieldwarping)Howcanwespecifythewarp?SpecifycorrespondingvectorsinterpolatetoacompletewarpingfunctionTheBeier&NeelyAlgorithm

Beier&Neely(SIGGRAPH1992)Singleline-pairPQtoP’Q’:Algorithm(singleline-pair)ForeachXinthedestinationimage:Findthecorrespondingu,vFindX’inthesourceimageforthatu,vdestinationImage(X)=sourceImage(X’)Examples:AffinetransformationMultipleLineslength=lengthofthelinesegment,dist=distancetolinesegmentTheinfluenceofa,p,b.ThesameastheaverageofXi’FullAlgorithmResultingwarpComparisontomeshmorphingPros:moreexpressiveCons:speedandcontrolWarpinterpolationHowdowecreateanintermediatewarpattimet?li

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論