数字视频特效处理lec05-morphing图像变形_第1页
数字视频特效处理lec05-morphing图像变形_第2页
数字视频特效处理lec05-morphing图像变形_第3页
数字视频特效处理lec05-morphing图像变形_第4页
数字视频特效处理lec05-morphing图像变形_第5页
已阅读5页,还剩97页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论