# ECSE4540: Homework#5 solution

\$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

## Description

5/5 - (1 vote)

1. (10points.) Considertheimagegivenintheﬁle market.png. (a) Determine the gradient, its magnitude, and its angle at the point (205,696), using the estimate df dx = f (x+1,y)− f (x,y)(andsimilarlyfor df dy ). Throughoutthisproblem,interpretthexdirectionaspointingdowntherowsandthey directionaspointingacrossthecolumns(i.e.,Matlab/imagecoordinates). (b) Determine the gradient, its magnitude, and its angle at the point (205,696), using the Sobel operators divided by 8 to estimatethederivatives.
2. (15 points.) Use the Sobel operators divided by 8 to estimate the magnitude and angle of the gradient over the entire marketimage;thatis,createtwonewimagesmagandangcontainingtheestimatedgradientmagnitudeandangleateach pixel.
(a) Displayandinterprettheresultsofthebinaryimagecreatedbyﬁndingthepixelswhosemagnitudeisabove50. (b) Displayandinterprettheresultsofthebinaryimagecreatedbyﬁndingthepixelswhoseangleiswithin20◦ of45◦ (on eitherside). (c) DisplayandinterprettheresultsofthelogicalANDoftheprevioustwoimages.
3. (30points.) Here,we’lltrytoﬁndthelonglinesinthe deck.png image.
(a) (5points.) First,extracttheCannyedges(usingthedefaultMatlabthresholds). Whatdoestheedgemaplooklike? (b) (10points.) Usetheseedgesastheinputtothe hough functiontoreturntheHougharrayandcorresponding ρ and θ vectors. Then use the houghpeaks function to ﬁnd at most 50 highest peaks. Determine how to superimpose these linesontotheoriginalimageandreturntheresult. (c) (5points.) Dotheselinesmakesense? Whyorwhynot? Whyaretheremanylinesdetectedat±45◦? (d) (5points.) Now,extractedgesusingtheSobeloptiontotheedgecommand,insteadofCanny,andrepeattheprocess inpart(b)(again,usingallofMatlab’sdefaultthresholds). Explainwhatyousee. Isthisbetterthanpart(c)andwhy? (e) (5points.) Tunethethresholdoptiontohoughpeaksuntilyou’reabletoextractallthemajorlines(withoutdetecting anyspuriouslines). Howlowdidyouneedtosetthethresholdtogettothispoint?
4. (15 points.) The command imfindcirlces uses a Hough-transform-like method to ﬁnd circles in an image. Load up the image curling.jpg and tweak the parameters to ﬁnd as many circles as you can (without generating any spurious circles). You can try changing the objectpolarity and edgethreshold inputs, as well as trying different color channels oftheinputimage(e.g.,theredringwillstandoutbetterinthebluechannel). Describethesettingsyoueventuallyarrived at to get the best result. Note that you will need several calls to imfindcirlces with different radii since the function will complainifyouusetoowidearange.
5. (15points.) Thresholdthe important.png imagetoﬁndpixelsaboveagrayscalelevelof180. Displaytheresultingimage. Use bwlabel and regionprops to automatically isolate the white region with the largest area, and display this as a new image.
6. (15points.) Considertheimagein page.png. Use graythresh toﬁndOtsu’sthresholdandapplyittotheimage(i.e.,turn everythingdarkerthanthethresholdtowhite). Howdoesitlook? Whyisaglobalthresholdsuboptimalforthistask? Now, use the blockproc command to process each 60×60 block of the image separately, returning white pixels where the pixelintensity p<µ−2σ,where µ isthemeanintensityoftheblockand σ isthestandarddeviationoftheblock. Interpret theresults. Whydoesthelocalthresholdworkbetter?