Transcription of Digital Image Processing - University of …
1 , , ( ).2 Solutions(Students) ,x,oftheretinalimagecorrespondingtothedo tisobtainedfromsimilartriangles, ,(d=2)0:2=(x=2)0:014whichgivesx=0 ,andtakingsomelibertiesofinterpretation, wecanthinkofthefoveaasasquaresensorarray havingontheorderof337,000elements,whicht ranslatesintoanarrayofsize580 , [(1:5mm)=1;159]=1:3 10 (onthefovea)oftheimageddotislessthanthes izeofasingleresolutionelement, ,theeyewillnotdetectadotifitsdiameter,d, issuchthat0:07(d)<1:3 10 6m,ord<18:6 10 (Students) =c=v=2:998 108(m/s)=60(1/s)=4:99 106m= ,agreen,andabluepass , ,eachequippedwithanindividual , eldofviewofthecamera(s)issuchthatitiscom pletely lledbyauniformcolor[ ,thecamera(s)is(are) ,whichisallthatisofinterestinsolvingthis problem]. (a)Thetotalamountofdata(includingthestar tandstopbit)inan8-bit,1024 1024image,is(1024)2 [8+2] (1024)2 [8+2]=56000=187 (b) ,(a)S1andS2arenot4-connectedbecauseqisno tinthesetN4(p)u(b)S1andS2are8-connectedb ecauseqisinthesetN8(p)u(c)S1andS2arem-co nnectedbecause(i)qisinND(p),and(ii)these tN4(p)\N4(q) ningallpossibleneighborhoodshapestogofro madiagonalsegmenttoacorresponding4-conne ctedsegment, (a)WhenV=f0;1g,4-pathdoesnotexistbetween pandqbecauseitisimpossibleto6 Chapter 2 Solutions (Students)get fromptoqby traveling along points that are both 4-adjacent and also have valuesfromV.
2 Figure (a) shows this conditionuit is not possible to get toq. The shortest8-path is shown in Fig. (b)uits length is 4. The length of shortestm- path (showndashed) is 5. Both of these shortest paths are unique in this case. (b) One possibility forthe shortest 4-path whenV=f1;2gis shown in Fig. (c)uits length is 6. It is easilyveri ed that another 4-path of the same length exists betweenpandq. One possibilityfor the shortest 8-path (it is not unique) is shown in Fig. (d)uits length is 4. Thelength of a shortestm-path (shoen dashed) is 6. This path is not (a) A shortest 4-path between a pointpwith coordinates(x; y)and a pointqwith coor-dinates(s; t)is shown in Fig. , where the assumption is that all points along thepath are fromV. The length of the segments of the path arejx sjandjy tj, respec-tively.
3 The total path length isjx sj+jy tj, which we recognize as the de nitionof theD4distance, as given in Eq. ( ). (Recall that this distance is independent ofany paths that may exist between the points.) TheD4distance obviously is equal to thelength of the shortest 4-path when the length of the path isjx sj+jy tj. This oc-curs whenever we can get fromptoqby following a path whose elements (1) are fromV;and (2) are arranged in such a way that we can traverse the path fromptoqby mak-ing turns in at most two directions ( , right and up). (b) The path may of may not beunique, depending onVand the values of the points along the ( ),letHdenotetheneighborhoodsumoperator,l etS1andS2denotetwodifferentsmallsubimage areasofthesamesize,andletS1+S2denotethec orrespondingpixel-by-pixelsumoftheelemen tsinS1andS2, ( ,numberofpixels) ,H(aS1+bS2)means:(1)multiplyingthepixels ineachofthesubimageareasbytheconstantssh own,(2)addingthepixel-by-pixelvaluesfrom S1andS2(whichproducesasinglesubimagearea ),and(3) (butcorresponding)pixelsfromaS1+ (aS1+bS2)=Xp12S1andp22S2ap1+bp2=Xp12S1ap 1+Xp22S2bp2=aXp12S1p1+bXp22S2p2=aH(S1)+b H(S2)which,accordingtoEq.
4 ( ), (Students) (a)s=T(r)=11+(m=r) (a)Thenumberofpixelshavingdifferentgrayl evelvalueswoulddecrease, , , ( at)histogramwouldrequireingeneralthatpix elintensitiesbeactuallyredistributedsoth atthereareLgroupsofn=Lpixelswiththesamei ntensity, (arti cial) (a).Aplotofthetrans-formationT(r)inEq.( ) (b).Becausepr(r)isaprobabilitydensityfun ctionweknowfromthediscussion10 Chapter3 Solutions(Students) (r)satis esconditions(a)and(b) , (b)thattheinversetransformationfromsback torisnotsinglevalued,asthereareanin nitenumberofpossiblemappingsfroms=1= (r)intheinterval[1=4;3=4]. (c)Ifnoneofthegraylevelsrk;k=1;2;:::;L 1;are0,thenT(rk) (rk)= ;2;:::;K 1;wherenkisthenumberofpixelshavinggrayle velvaluerk,nisthetotalnumberofpixelsinth eneighborhood, (rk)=1n[nk nLk+nRk]fork=0;1;:::;K 1, (rk)=pr(rk)+1n[nRk nLk]fork=0;1;:::;K 1:Thesameconceptappliestoothermodesofnei ghborhoodmotion:p0r(rk)=pr(rk)+1n[bk ak]fork=0;1;:::;K 1,whereakisthenumberofpixelswithvaluerki ntheneighbor-hoodareadeletedbythemove,an dbkisthecorrespondingnumberintroducedbyt hemove.
5 2g= 2f+1K2[ 2 1+ 2 2+ + 2 K]The 2 iaresimplysamplesofthenoise,whichishasva riance 2 .Thus, 2 i= 2 andwehave 2g=KK2 2 =1K 2 whichprovesthevalidityofEq.( ). (x;y)denotethegoldenimage,andletf(x;y) (x;y)=g(x;y) f(x;y).Theresultingimaged(x;y) (x;y)is}closeenough}tothegoldenimageifal lthepixelsind(x;y)fallwithinaspeci edthresholdband[Tmin;Tmax] ,thesamevalueofthresholdis12 Chapter3 Solutions(Students)usedforbothnegativean dpositivedifferences,inwhichcasewehaveab and[ T;T]inwhichallpixelsofd(x;y)mustfallinor derforf(x;y) (x;y) ,sowewillconcentrateonthe :(1)properregistration,(2)controlledillu mination,and(3) ,butiftheyaredisplacedwithrespecttoeacho ther, ,specialmarkingsaremanufacturedintothepr oductformechanicalorimage-basedalignment Controlledillumination(notethat|illumina tion}isnotlimitedtovisiblelight) ,theproductscouldhaveoneormoresmallpatch esofatightlycontrolledcolor,andtheintens ity(andperhapsevencolor)ofeachpixelsinth eentireimagewouldbemodi , (sometimescomplementary)approachistoimpl ementimageprocessingtechniques( ,imageaveraging) , (usuallymorethanone)testsineachoftheregi ons, (a)Considera3 3mask cientsare1(weareignoringthe1 )
6 ,theneteffectofthelowpass , ,whenthemaskmovesonepixellocationtotheri ght, C1+C3whereC1isthesumofpixelsunderthe rstcolumnofthemaskbeforeitwasmoved, 3maskittakes2additionstogetC3(C1wasalrea dycomputed). , ,wemovedownonepixel(thenatureofthecomput ationisthesame) n,(n 1)additionsareneededtoobtainC3,plusthesi nglesubtractionandadditionneededtoobtain Rnew,whichgivesatotalof(n+1) (a)Therearen2pointsinann nmedian ,themedianvalue, ,issuchthatthereare(n2 1)=2pointswithvalueslessthanorequalto andthesamenumberwithvaluesgreaterthanore qualto .However,sincetheareaA(numberofpoints)in theclusterislessthanonehalfn2,andAandnar eintegers,itfollowsthatAisalwayslessthan orequalto(n2 1)= ,evenintheextremecasewhenallclusterpoint sareencompassedbythe ltermask,therearenotenoughpointsintheclu sterforanyofthemtobeequaltothevalueofthe median(remember,weareassumingthatallclus terpointsarelighterordarkerthanthebackgr oundpoints).
7 Therefore,ifthecenterpointinthemaskisacl usterpoint,itwillbesettothemedianvalue,w hichisabackgroundshade,andthusitwillbe|e liminated} (Students) (a) =[(n2+1)=2]-thlargestvalue.(b)Oncetheval ueshavebeensortedonetime, ,theverticalbarsare5pixelswide,100pixels high, , (inpixels)betweentheonsetofonebarandtheo nsetofthenextone(say,toitsright) ,itlosesonvalueoftheverticalbarontheleft ,butitpicksupanidenticaloneontheright, ,thenumberofpixelsbelongingtothevertical barsandcontainedwithinthemaskdoesnotchan ge,regardlessofwherethemaskislocated(asl ongasitiscontainedwithinthebars,andnotne artheedgesofthesetofbars). 23orthe45 45masksbecausetheyarenot}synchronized} nedasr2f=@2f@x2+@2f@y2fortheunrotatedcoo rdinatesandasr2f=@2f@x02+@ y0sin andy=x0sin +y0cos where @f@x0=@f@x@x@x0+@f@y@y@x0=@f@xcos +@f@ysin Takingthepartialderivativeofthisexpressi onagainwithrespecttox0yields@2f@x02=@2f@ x2cos2 +@@x @f@y sin cos +@@y @f@x cos sin +@2f@y2sin2 Next,wecompute@f@y0=@f@x@x@y0+@f@y@y@y0= @f@xsin +@f@ycos Takingthederivativeofthisexpressionagain withrespecttoy0gives@2f@y02=@2f@x2sin2 @@x @f@y cos sin @@y @f@x sin cos +@2f@y2cos2 Addingthetwoexpressionsforthesecondderiv ativesyields@2f@x02+@2f@y02=@2f@x2+@ r2f(x;y)=f(x;y) [f(x+1;y)+f(x 1;y)+f(x;y+1)+f(x;y 1) 4f(x;y)]=6f(x;y) [f(x+1;y)+f(x 1;y)+f(x;y+1)+f(x;y 1)+f(x;y)]=5f1:2f(x;y) 15[f(x+1;y)+f(x 1;y)+f(x;y+1)+f(x;y 1)+f(x;y)]g=5 1:2f(x;y) f(x.)
8 Y) wheref(x;y)denotestheaverageoff(x;y)inap rede nedneighborhoodthatiscen-teredat(x;y) ,wemaywritef(x;y) r2f(x;y)sf(x;y) f(x;y):Therightsideofthisequationisrecog nizedasthede nitionofunsharpmaskinggiveninEq.( ).Thus, (Students) (x)[Eq.( )]intoF(u)[Eq.( )]:F(u)=1MM 1Xx=0"M 1Xr=0F(r)ej2 rx=M#e j2 ux=M=1MM 1Xr=0F(r)M 1Xx=0ej2 rx=Me j2 ux=M=1MF(u)[M]=F(u) (u)intof(x) (u2+v2)canbereplacedbythedistancesquared ,D2(u;v).Thisreducestheproblemtoonevari- able, ,wede new2,D2(u;v)=(u2+v2).Thenweproceedasfoll ows:H(w)=e w2=2 2:TheinverseFouriertransformish(z)=Z1 1H(w)ej2 wzdw=Z1 1e w2=2 2ej2 wzdw=Z1 1e 12 2[w2 j4 2wz]dw:18 Chapter4 Solutions(Students)Wenowmakeuseoftheiden titye (2 )2z2 22e(2 )2z2 22=1:Insertingthisidentityinthepreceding integralyieldsh(z)=e (2 )2z2 22Z1 1e 12 2[w2 j4 2wz (2 )2 4z2]dw=e (2 )2z2 22Z1 1e 12 2[w j2 2z]2dw:Nextwemakethechangeofvariabler=w j2 ,dr=dwandtheaboveintegralbecomesh(z)==e (2 )2z2 22Z1 1e r22 2dr:Finally,wemultiplyanddividetherights ideofthisequationbyp2 :h(z)=p2 e (2 )2z2 22 1p2 Z1 1e r22 2dr :Theexpressioninsidethebracketsisrecogni zedasaGaussianprobabilitydensityfunc-tio n,whoseintegralfrom ,h(z)=p2 e (2 )2z2 22:Goingbacktotwospatialvariablesgivesth e nalresult:h(x.
9 Y)=p2 e 2 2 2(x2+y2) (a)Wenote rstthat( 1)x+y=ej (x+y).Then,=hf(x;y)ej (x+y)i=1 MNM 1Xx=0N 1Xy=0hf(x;y)ej (x+y)ie j2 (ux=M+vy=N)=1 MNM 1Xx=0N 1Xy=0hf(x;y)e j2 ( xM2M yN2N)ie j2 (ux=M+vy=N)=1 MNM 1Xx=0N 1Xy=0f(x;y)e j2 (x[u M2]=M+y[v N2]=N)=F(u M=2;v N=2) ( ),allthehighpass lter( ).TheinverseFouriertransformof1givesanim pulseattheorigininthehighpassspatial ( ),weeasily ndtheexpressionforthede nitionofcontinuousconvolutioninonedimens ion:f(x) g(x)=Z1 1f( )g(x )d :TheFouriertransformofthisexpressionis=[ f(x) g(x)]=Z1 1 Z1 1f( )g(x )d e j2 uxdx=Z1 1f( ) Z1 1g(x )e j2 uxdx d :TheterminsidetheinnerbracketsistheFouri ertransformofg(x ).But,=[g(x )]=G(u)e j2 u so=[f(x) g(x)]=Z1 1f( ) G(u)e j2 u d =G(u)Z1 1f( )e j2 u d =G(u)F(u) (a)Oneapplicationofthe ltergives:G(u;v)=H(u;v)F(u;v)=e D2(u;v)=2D20F(u;v):Similarly,Kapplicatio nsofthe lterwouldgiveGK(u;v)=e KD2(u;v)=2D20F(u;v):TheinverseDFTofGK(u; v)wouldgivetheimageresultingfromKpasseso ftheGaussian |largeenough,}theGaussianLPFwillbecomean otchpass lter,passingonlyF(0;0).
10 ,thereisavalueofKafterwhichtheresultofre peatedlowpass ltering20 Chapter4 Solutions(Students) lterwillapproachanimpulseattheorigin,and thiswouldstillgiveusF(0;0)astheresultof lteredfunctioninthespatialdomainthenis:g (x;y)=f(x;y) f(x+1;y)+f(x;y) f(x;y+1):FromEq.( ),G(u;v)=F(u;v) F(u;v)ej2 u=M+F(u;v) F(u;v)ej2 v=N=[1 ej2 u=M]F(u;v)+[1 ej2 v=N]F(u;v)=H(u;v)F(u;v);whereH(u;v)isthe lterfunction:H(u;v)= 2jhsin( u=M)ej u=M+sin( v=N)ej v=Ni:(b)Toseethatthisisahighpass lter,ithelpstoexpressthe lterfunctionintheformofourfamiliarcenter edfunctions:H(u;v)= 2jhsin( [u M=2]=M)ej u=M+sin( [v N=2]=N)ej v= ,H(u;v)startsatitsmaximum(complex)valueo f2jforu= (thecenteroftheshiftedfunction), (u;v)startsincreasingagainandachievesthe maximumvalueof2jagainwhenu= ,this , ( ), ,squareroot, }buffer} ,witheachsquarebeinginthecheckerboardbei ngtheimage(andtheblackextensions).