DigitalImageProcessingSecondEditionProblemSolutionswStudentSetRafaelC.GonzalezRichardE.WoodsPrenticeHallUpperSaddleRiver,NJ07458°19922002byRafaelC.GonzalezandRichardE.Woods1PrefaceThisabbreviatedmanualcontainsdetailedsolutionstoallproblemsmarkedwithastarinDigitalImageProcessing,2ndEdition.Thesesolutionscanalsobedownloadedfromthebookwebsite().2Solutions(Students)Problem2.1Thediameter,x,oftheretinalimagecorrespondingtothedotisobtainedfromsimilartriangles,asshowninFig.P2.1.Thatis,(d=2)0:2=(x=2)0:014whichgivesx=0:07d.FromthediscussioninSection2.1.1,andtakingsomelibertiesofinterpretation,wecanthinkofthefoveaasasquaresensorarrayhavingontheorderof337,000elements,whichtranslatesintoanarrayofsize580£580elements.Assumingequalspacingbetweenelements,thisgives580elementsand579spacesonaline1.5mmlong.Thesizeofeachelementandeachspaceisthens=[(1:5mm)=1;159]=1:3£10¡6m.Ifthesize(onthefovea)oftheimageddotislessthanthesizeofasingleresolutionelement,weassumethatthedotwillbeinvisibletotheeye.Inotherwords,theeyewillnotdetectadotifitsdiameter,d,issuchthat0:07(d)1:3£10¡6m,ord18:6£10¡6m.FigureP2.14Chapter2Solutions(Students)Problem2.3¸=c=v=2:998£108(m/s)=60(1/s)=4:99£106m=5000Km.Problem2.6Onepossiblesolutionistoequipamonochromecamerawithamechanicaldevicethatsequentiallyplacesared,agreen,andabluepass®lterinfrontofthelens.Thestrongestcameraresponsedeterminesthecolor.Ifallthreeresponsesareapproximatelyequal,theobjectiswhite.Afastersystemwouldutilizethreedifferentcameras,eachequippedwithanindividual®lter.Theanalysiswouldbethenbasedonpollingtheresponseofeachcamera.Thissystemwouldbealittlemoreexpensive,butitwouldbefasterandmorereliable.Notethatbothsolutionsassumethatthe®eldofviewofthecamera(s)issuchthatitiscompletely®lledbyauniformcolor[i.e.,thecamera(s)is(are)focusedonapartofthevehiclewhereonlyitscolorisseen.Otherwisefurtheranalysiswouldberequiredtoisolatetheregionofuniformcolor,whichisallthatisofinterestinsolvingthisproblem].Problem2.9(a)Thetotalamountofdata(includingthestartandstopbit)inan8bit,1024£1024image,is(1024)2£[8+2]bits.ThetotaltimerequiredtotransmitthisimageoveraAt56Kbaudlinkis(1024)2£[8+2]=56000=187:25secorabout3.1min.(b)At750Kthistimegoesdowntoabout14sec.Problem2.11LetpandqbeasshowninFig.P2.11.Then,(a)S1andS2arenot4connectedbecauseqisnotinthesetN4(p)u(b)S1andS2are8connectedbecauseqisinthesetN8(p)u(c)S1andS2aremconnectedbecause(i)qisinND(p),and(ii)thesetN4(p)\N4(q)isempty.Problem2.125FigureP2.11Problem2.12Thesolutiontothisproblemconsistsofde®ningallpossibleneighborhoodshapestogofromadiagonalsegmenttoacorresponding4connectedsegment,asshowninFig.P2.12.Thealgorithmthensimplylooksfortheappropriatematcheverytimeadiagonalsegmentisencounteredintheboundary.FigureP2.12Problem2.15(a)WhenV=f0;1g,4pathdoesnotexistbetweenpandqbecauseitisimpossibleto6Chapter2Solutions(Students)getfromptoqbytravelingalongpointsthatareboth4adjacentandalsohavevaluesfromV.FigureP2.15(a)showsthisconditionuitisnotpossibletogettoq.Theshortest8pathisshowninFig.P2.15(b)uitslengthis4.Thelengthofshortestmpath(showndashed)is5.Bothoftheseshortestpathsareuniqueinthiscase.(b)Onepossibilityfortheshortest4pathwhenV=f1;2gisshowninFig.P2.15(c)uitslengthis6.Itiseasilyveri®edthatanother4pathofthesamelengthexistsbetweenpandq.Onepossibilityfortheshortest8path(itisnotunique)isshowninFig.P2.15(d)uitslengthis4.Thelengthofashortestmpath(shoendashed)is6.Thispathisnotunique.FigureP2.15Problem2.16(a)Ashortest4pathbetweenapointpwithcoordinates(x;y)andapointqwithcoordinates(s;t)isshowninFig.P2.16,wheretheassumptionisthatallpointsalongthepatharefromV.Thelengthofthesegmentsofthepatharejx¡sjandjy¡tj,respectively.Thetotalpathlengthisjx¡sj+jy¡tj,whichwerecognizeasthede®nitionoftheD4distance,asgiveninEq.(2.516).(Recallthatthisdistanceisindependentofanypathsthatmayexistbetweenthepoints.)TheD4distanceobviouslyisequaltothelengthoftheshortest4pathwhenthelengthofthepathisjx¡sj+jy¡tj.Thisoccurswheneverwecangetfromptoqbyfollowingapathwhoseelements(1)arefromV;and(2)arearrangedinsuchawaythatwecantraversethepathfromptoqbymakingturnsinatmosttwodirections(e.g.,rightandup).(b)Thepathmayofmaynotbeunique,dependingonVandthevaluesofthepointsalongtheway.Problem2.187FigureP2.16Problem2.18WithreferencetoEq.(2.61),letHdenotetheneighborhoodsumoperator,letS1andS2denotetwodifferentsmallsubimageareasofthesamesize,andletS1+S2denotethecorrespondingpixelbypixelsumoftheelementsinS1andS2,asexplainedinSection2.5.4.Notethatthesizeoftheneighborhood(i.e.,numberofpixels)isnotchangedbythispixelbypixelsum.TheoperatorHcomputesthesumofpixelvaluesisagivenneighborhood.Then,H(aS1+bS2)means:(1)multiplyingthepixelsineachofthesubimageareasbytheconstantsshown,(2)addingthepixelbypixelvaluesfromS1andS2(whichproducesasinglesubimagearea),and(3)computingthesumofthevaluesofallthepixelsinthatsinglesubimagearea.Letap1andbp2denotetwoarbitrary(butcorresponding)pixelsfromaS1+bS2.ThenwecanwriteH(aS1+