1、Digital Image ProcessingChapter 9Morphological Image Processing2019.10Morphological operations come from the word“morphing”in Biology which means“changing a shape”.MorphingImage morphological operations are used to manipulateobject shapes such as thinning,thickening,and filling.Binary morphological
2、operations are derived fromset operations.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Concept of a set in binary image morphology:Each set may represent one object.Each pixel(x,y)has its status:belong to a set or not belong to a set.A(A)zz=(z1,z2)Translatio
3、nReflectionBBBbbwwBfor ,AazaccAzfor ,(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.*For binary images only(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.ABzBAz=Empty setA=Object to be dilatedB=Structuring elementDilate
4、means“extend”StructuringElement(B)Original image(A)BReflectionIntersect pixelCenter pixelResult of DilationBoundary of the“center pixels”where intersects A zB(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.“Repair”broken characters(Images from Rafael C.Gonzalez
5、 and Richard E.Wood,Digital Image Processing,2nd Edition.ABzBAz A=Object to be erodedB=Structuring elementErosion means“trim”StructuringElement(B)Original image(A)Intersect pixelCenter pixelResult of ErosionBoundary of the“center pixels”where B is inside A(Images from Rafael C.Gonzalez and Richard E
6、.Wood,Digital Image Processing,2nd Edition.Remove small objects such as noiseBABAcc)(Proof:where c=complement BAABzABzABzBAcczcczczc )(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.BBABA)(ABBBAzzor=Combination of all parts of A that can completely contain B Op
7、ening eliminates narrow and small details and corners.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.BBBA )A(Closing fills narrow gaps and notches(Images from Rafael C.Gonza
8、lez and Richard E.Wood,Digital Image Processing,2nd Edition.BABAccBABBABDBCDCABA .3 then If 2.1BABBABDBCDCBAA .3 then If 2.1Idem potent property:cant change any more(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Finger print enhancement(Images from Rafael C.Go
9、nzalez and Richard E.Wood,Digital Image Processing,2nd Edition.BAA(A)Original imageBoundary(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.ckkABXX1Original imageResults of region fillingwhere X0=seed pixel p(Images from Rafael C.Gonzalez and Richard E.Wood,Digi
10、tal Image Processing,2nd Edition.ABXXkk1where X0=seed pixel pX-ray imageof bonesThresholdedimageConnectedcomponents(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Brief Description General binary morphological operation that can be used to look for particular p
11、atterns in an image.A tool for shape detection Basic operation for binary morphology Almost all the other binary morphological operators can be derived from Hit-and-Miss Transform.Common names:How It Works The structuring element used in the hit-and-miss can contain both foreground and background pi
12、xels.Operations If the foreground and background pixels in the structuring element exactly match foreground and background pixels in the image,then the pixel underneath the origin of the structuring element is set to the foreground color.If it doesnt match,then that pixel is set to the background co
13、lor.Effect of the hit-and-miss based right angle convex corner detector After obtaining the locations of corners in each orientation,we can then simply OR all these images together to get the final result.Four structuring elements used for corner finding in binary images Guidelines for Use The hit-a
14、nd-miss transform is used to look for occurrences of particular binary patterns.It can be used to look for several patterns.Simply by running successive transforms using different structuring elements,and then ORing the results together.The operations of erosion,dilation,opening,closing,thinning and
15、 thickening can all be derived from the hit-and-miss transform in conjunction with simple set operations.Some structuring elements that can be used for locating various binary features 1)is used to locate isolated points in a binary image.2)is used to locate the end points on a binary skeleton.Note
16、that this structuring element must be used in all its orientations,and thus the four hit-and-miss passes are required.3a)and 3b)are used to locate the triple points on a skeleton.Both structuring elements must be run in all orientations so eight hit-and-miss passes are required.Some applications of
17、the hit-and-miss transform The triple points(points where three lines meet)of the skeleton The hit-and-miss transform outputs single foreground pixels at each triple point by structuring elements 3a)and 3b).This image was dilated once using a cross-shaped structuring element in order to mark these i
18、solated points clearly,and this was then ORed with the original skeleton.The end points of the skeleton The hit-and-miss transform outputs single foreground pixels at each end point by structuring element 2).This image was dilated once using a square-shaped structuring element,and this was then ORed
19、 with the original skeleton.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.)(XWAXAXAc*where X=shape to be detected W=window that can contain X)(XWABABAc*(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael
20、C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.iiDAC41)(4,3,2,1 ,1iABXXikik*iconviXD Convex hull has no concave part.Convex hullAlgorithm:where(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gonzalez and Richard E.Wood,
21、Digital Image Processing,2nd Edition.cBAABAABA)()(*).)(.(21nBBBABA(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Make an object thinner.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.*)(BAABA.).)(.(21nBBBABA.Make an obje
22、ct thicker*(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Dot lines are skeletons of thisstructure)()(0ASASkKkwithwhere .)(.(BBBAkB)ABkB)AkB)AASk ()(k timesandkBAkK max(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Imag
23、es from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.BAX1AHXX)(23)(1812kkBXX*314XXX=thinning=finding end points=dilation at end points=Pruned resultOriginal imagePruned resultAfter Thinning3 timesEnd pointsDilationof end points(Tables from Rafael C.Gonzalez and Richard E
24、.Wood,Digital Image Processing,2nd Edition.(Tables from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Tables from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Tables from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edit
25、ion.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.x=dont care(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.bfDyxDytxsyxbytxsfbf),(;)(),(|),(),(maxbfDxDxsxbxsfbf and )(|)()(max2-D Case1-D CaseSubimageOriginal imageMovin
26、g windowMaxOutput image+Reflectionof BStructuring element BNote:B can be any shape and subimage must have the same shape as reflection of B.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.bfDyxDytxsyxbytxsfbf),(;)(),(|),(),(min2-D Case1-D CasebfDxDxsxbxsfbf and
27、 )(|)()(minSubimageOriginal imageMoving windowMinOutput image-BStructuring element BNote:B can be any shape and subimage must have the same shape as B.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Original imageAfter dilationAfter erosionDarkerBrighter(Images
28、 from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.bbfbf)(Opening cuts peaks(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.bbfbf)(Closing fills valleys(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd E
29、dition.Original imageAfter closingAfter openingReduce whiteobjectsReduce darkobjects(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Smoothing:Perform opening followed by closingOriginal imageAfter smoothing(Images from Rafael C.Gonzalez and Richard E.Wood,Digit
30、al Image Processing,2nd Edition.Original imageMorphological Gradient)()(bfbfg(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.Original imageResults of top-hat transform)(bffh(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.A
31、lgorithm:1.Perform closing on the image by using successively larger structuring elements until small blobs are vanished.2.Perform opening to join large blobs together3.Perform intensity thresholdingOriginal imageSegmented resultSmall blobLarge blob(Images from Rafael C.Gonzalez and Richard E.Wood,D
32、igital Image Processing,2nd Edition.Objective:to count the number of particles of each sizeMethod:1.Perform opening using structuring elements of increasing size2.Compute the difference between the original image and the result after each opening operation3.The differenced image obtained in Step 2 a
33、re normalized and used to construct the size-distribution graph.Original imageSize distribution graph(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gon
34、zalez and Richard E.Wood,Digital Image Processing,2nd Edition.Surface of P at edges looklike mountain ridges.POriginalimageP(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.(Images from Rafael C.Gonzalez and Richard E.Wood,Digital Image Processing,2nd Edition.