image inpaintingreadmeWord文档下载推荐.docx
- 文档编号:20097281
- 上传时间:2023-01-16
- 格式:DOCX
- 页数:4
- 大小:16.21KB
image inpaintingreadmeWord文档下载推荐.docx
《image inpaintingreadmeWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《image inpaintingreadmeWord文档下载推荐.docx(4页珍藏版)》请在冰豆网上搜索。
thepicturewindowandtheconcolewindow.Theprimaryuseractivityisdrawingthemaskovertheareatoberepaired.Themaskisdrawnwiththeleftmousebuttonanderasedwiththerightmousebutton.WhenevertheuserinitiatesafileI/Ooperation,thefilenameistobetypedintotheconsolewindow.
leftmousedrag-drawmask
rightmousedrag-erasemask
'
C'
-clearmask
u'
-unlimitedundo(ofmaskdrawing)
r'
-redo(maskdrawing)
U'
-toggleundoon/off(offsavessomememory--notmuch)
b'
-brushsize(rotatebetweenthreesizes)
t'
-togglemaskdisplayon/off
c'
-cyclethroughmaskcolors
s'
-saveimage
M'
-savemask
L'
-loadmask
+'
-oneiterationofinpainting
d'
-oneiterationofanisotropicdiffusion
D'
-togglediffusionon/off
i'
-100iterations,followedbyastepofdiffusion,ifdiffusionison
I'
-2000iterations,followedbyastepofdiffusion,ifdiffusionison
V'
-specifyhowmanyblocksof100iterationsofinpaintingtodo,followedbyastepof
diffusion,ifdiffusionison
a'
-15iterationsofinpainting,followedby2stepsofdiffusion
A'
-specifyhowmanyblocksof15i/2d
INPAINTING:
Theinpaintingalgorithmmeasuresthesmoothnessoftheimageandusesthistodecidehowtoextendcontoursthroughthemaskedregion.ItusestheLaplacianasasmoothnessindicator.To
findedgecontours,weusavectorperpendiculartothegradient.Thegradientoftheimagepointsinthedirectionofgreatestincrease.Alongedges,thegradientpointsperpendiculartotheedgebecausethegreatestchangeinthevalueoftheimageisacrossanedge.
Imageinpaintingisaniterativealgorithmthatonlychangespixelsinthemask.Inordertogetfromstepntostepn+1:
defineL(x,y)=2DLaplacianatpixel(x,y)
dLisavector,thechangeinsmoothnesstotheleft,right,top,andbottomofthecurrentpixel
Nisavector,avectorperpendiculartothegradient
Gisascalar,ameasureofthelengthofthegradient
Updateisapixelarray
Imageisapixelarray,theimageatstepn
ImageNextisapixelarray,theimageatstepn+1
deltatisascalar,thestepsizeforupdatinganimage
foreverypixel(x,y)inthemask
dL(x,y)=(L(x+1,y)-L(x-1,y),L(x,y+1)-L(x,j-1))
N=normalizedvectorperpendiculartogradient
B=dL.N
G=length*(N)
Update(x,y)=B*G
ImageNext(x,y)=Image(x,y)+deltat*Update(x,y)
length*isaspecialmeasureoflengththatneedstobeusedinordertogetstableresults.Itis
definedas
_x-xdirection
_y-ydirection
_f-forwardderivative-calculatederivativeasdifferencebetweenpixelinfrontandcurrent
pixel
_b-backardderivative-calculatederivativeasdifferencebetweencurrentpixelandpixelin
back
_m-minimumofvalueand0
_M-maximumofvalueand0
if(B>
0)
length*=sqrt(Image_xbm^2+Image_xfM^2+Image_ybm^2+Image_yfM^2)
else
length*=sqrt(Image_xbM^2+Image_xfm^2+Image_ybM^2+Image_yfm^2)
ANISOTROPICDIFFUSION:
Aftereveryseveralstepsofinpainting,werunaniterationofanisotropicdiffusion.Anisotropic
diffusionisoneapproachtonoiseremovalbecauseittendstosharpenedgeswhilesmoothingover
continuousregions.Itisusedherefortworeasons.Ithelpstosmoothoversomeoftheparts
filledinbytheinpaintingalgorithm.Italsohelpstojoinedgesacrossthemaskastheyare
beingdrawninsothattheywillbecontinuous.WeadaptedRobertEstes'
s
MCDalgorithmforouruse.
OPTIMIZATIONS
Weimplementedanumberofoptimizationsinanefforttomaketheprogramfasterandmoreresponsive.TheimageiskeptinaformatthatGLcanreaddirectly(whichallowsforfairlyquickredraws).However,forlargeimages,eventhisincursanoticabledelay,soformostmaskandimagemanipulations,wedrawthechangedpixelsdirectlytothescreentoavoidwhole-imageredraws.Themaskitselfisstoredinabitfield,andwedevelopedfastalgorithmsforiterationandmodificationwhichutilizethefactthatthemaskisusuallysparse.
Undoandredoarealsomemory-efficient;
althoughwemustdynamicallyallocatememoryastheuserinteractswiththeprogram,weuseadynamic,scalablevectorclasswhichavoidscostlylinkedlistsandpointers.Asaresulteachpixelchangerequiresonlyabout10bytesofstorageonaverage(4eachfor
xandycoords,1forindicatingthetypeofoperation,and1[onaverage]forpointingtothenextvector).
Fortheinpaintinganddiffusionalgorithms,weusedinlinefunctionsandpass-by-referenceasmuchaspossible,andtriedtoavoidtediousiterationsoverthewholeimage.Diffusionisaverycostlyalgorithm;
ourcurrentimplementationrequiresabout3xasmuchmemorytorunastheoriginalimage.Therearelikelymoreefficientimplementationsoutthere,butwecouldn'
tthinkofabetterwaytoimplementitthatwouldstillbefast.
--------------------------------
PublishedPaper
psfile
OriginalPaper:
Preprint
http:
//www.ima.umn.edu/preprints/dec99/dec99.html
AnisotropicDiffusionCode
//info.cipic.ucdavis.edu/ftp/estes/
Implementationofinpainting
//www-users.itlabs.umn.edu/~rams0053/
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- image inpaintingreadme