《数字图像处理冈萨雷斯N04.pptx》由会员分享,可在线阅读,更多相关《数字图像处理冈萨雷斯N04.pptx(20页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Some Basic Relationships between PixelsPixel Operations no.1(a)N4(p)4-neighborsofp(verticalandhorizontal),(x+1,y),(x-1,y),(x,y+1),(x,y-1)(b)ND(p)fourdiagonal neighborsofp,(x+1,y+1),(x+1,y-1),(x-1,y+1),(x-1,y-1)(c)N8(p)8-neighborsofp,both(a)and(b)together.NeighborsofaPixel第1页/共20页ConnectivityPixel Op
2、erations no.2Let Vbethesetofgray-levelvaluesusedtodefineconnectivity,suchasV=1,orV=32,33,64,twopixelpandqbothhavethevaluesfromV,wehave,(a)4-connectivity,ifqandpareinN4(p).(b)8-connectivity,ifqandpareinN8(p).(c)m-connectivity,ifqisinN4(p)orqisinND(p)andN4(p)N4(q)isempty.(Toeliminatemultiplepath)第2页/共
3、20页Adjacent,Path,Connected ComponentPixel Operations no.3(a)Adjacent,ifqandpareconnected.(b)Path,ifthereisasequenceofdistinctadjacent pixelsfromqtop.(c)Connectedcomponent,qandpareinanimagesubsetS,ifthereisapathfromqtopconsistingentirelyofpixelsinS.第3页/共20页Arithmetic OperationsArithmeticOperationsoft
4、wopixels:Addition:p+q;Subtractionp q;Multiplicationpq;Divisionpq.(usedforaveragingtoreducenoise,removestaticscene,correctshading,etc.)Pixel Operations no.24第4页/共20页An Example of Arithmetic OperationPixel Operations no.25第5页/共20页Logic OperationsLogicOperationsoftwopixels:AND,OR,Complement.p AND q,p O
5、R q,NOT q.(onlyforbinaryimages,usedformasking,featuredetection,andshapeanalysis)Pixel Operations no.26Which is 0/1(white or black)?第6页/共20页An Example of Logic OperationWhich is 0 or 1?第7页/共20页Mask OperationLetthevalueassignedtoapixelbeafunctionofitsgraylevelandgraylevelofitsneighbors.Averagez=1/9(z1
6、+z2+z9)=1/9zi,i=1,29Generallinearoperation,addtogethercoefficientmultipliedneighbors.z=1/9(w1z1+w2z2+w9z9)=1/9wizi,i=1,29Pixel Operations no.27第8页/共20页Region labeling and countingHowmanybacteriaarethereinthispicture?Whichpixelsbelongtothesameobject(regionlabeling)?Howlargeiseachobject(regioncounting
7、)?OriginalBacteria imageafterthresholdingPixel Operations no.4第9页/共20页4-connected and 8-connected neighborhoodsDefinition:aregion isasetofpixels,whereeachpixelcanbereachedfromanyotherpixelintheregionbyafinitenumberofsteps,whereeachstepstartsatapixelandendsintheneighborhoodofthepixel.Typically,leadst
8、othesameregions,exceptwhenaregionisonlyconnectedacrossdiagonallyadjacentpixels.Pixel Operations no.5第10页/共20页Region labeling algorithm(4-neighborhood)Loopthroughallpixelsf(x,y),lefttoright,toptobottomIff(x,y)=0,donothing.Iff(x,y)=1,distinguish4casesSecondpassthroughimagetoreplaceequivalentlabelbythe
9、samelabel.Pixel Operations no.6第11页/共20页Example:region labelingPixel Operations no.7第12页/共20页Region counting algorithmMeasuresthesizeofeachregionInitializecounter(label)=0 foralllabelLoopthroughallpixelsf(x,y),lefttoright,toptobottomIff(x,y)=0,donothing.Iff(x,y)=1,incrementcounter(label(x,y)Pixel Op
10、erations no.8第13页/共20页Small region removalLoopthroughallpixelsf(x,y),lefttoright,toptobottomIff(x,y)=0,donothing.Iff(x,y)=1 andcounter(label(x,y)S,thensetf(x,y)=0RemovesallregionssmallerthanS pixelsPixel Operations no.9第14页/共20页Assignment 1Developaprogramfora.)regionlabeling,b.)countingandc.)smallre
11、gionremoval.Note:HandinyourVCprojectinadisk(removetheDebugdirectorytosavespace).第15页/共20页*.bmp file formatBITMAPFILEHEADERbfType=“BM”(WORD)bfSize(DWORD)bfReserved1(WORD)bfReserved2(WORD)bfOffBits(DWORD)第16页/共20页*.bmp file formatBITMAPINFOHEADERbiSizebiWidthbiHeightbiPlanebiBitCountbiCompressionbiSizeImage(biWidth*biHeight)biXPelsPerMeterbiYPelsPerMeterbiClrUsedbiClrImportant第17页/共20页ReviewQuestionsnWhat is mask operation?nWhat is bmp file format?第18页/共20页Recommended ReadingGonzalez+Woods:Chapter2Thats all for todayThats all for today第19页/共20页感谢您的观看!第20页/共20页