Example: tourism industry

Lecture 3: Basic Morphological Image Processing

Lecture 3: Basic Morphological ImageProcessingHarvey RhodyChester F. Carlson Center for Imaging ScienceRochester Institute of 13, 2005 AbstractMorphological Processing is constructed with operations on sets ofpixels. Binary morphology uses only set membership and is indifferentto the value, such as gray level or color, of a pixel. We will examinesome Basic set operations and their usefulness in Image Lecture 3 Morphology and SetsWe will deal here only with Morphological operations for binary will provide a Basic understanding of the techniques. Morphologicalprocessing for gray scale images requires more sophisticated Processing is described almost entirely as operations on this discussion, a set is a collection of pixels in the context of an sets will be collections of points on an Image gridGof sizeN Lecture 31 Pixel LocationA setAof pixels inGcan be described by giving a list of the pixel locations can be given as a list of index positions fromGthat areincluded of sizeN Mthen the index positions are the integers in the range[0,MN 1].

Sep 13, 2005 · Morphological processing is described almost entirely as operations on sets. In this discussion, a set is a collection of pixels in the context of an image. Our sets will be collections of points on an image grid G of size N × M pixels. DIP Lecture 3 1. Pixel Location

Tags:

  Lecture, Basics, Image, Processing, Lecture 3, Morphological, Basic morphological image processing

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Lecture 3: Basic Morphological Image Processing

1 Lecture 3: Basic Morphological ImageProcessingHarvey RhodyChester F. Carlson Center for Imaging ScienceRochester Institute of 13, 2005 AbstractMorphological Processing is constructed with operations on sets ofpixels. Binary morphology uses only set membership and is indifferentto the value, such as gray level or color, of a pixel. We will examinesome Basic set operations and their usefulness in Image Lecture 3 Morphology and SetsWe will deal here only with Morphological operations for binary will provide a Basic understanding of the techniques. Morphologicalprocessing for gray scale images requires more sophisticated Processing is described almost entirely as operations on this discussion, a set is a collection of pixels in the context of an sets will be collections of points on an Image gridGof sizeN Lecture 31 Pixel LocationA setAof pixels inGcan be described by giving a list of the pixel locations can be given as a list of index positions fromGthat areincluded of sizeN Mthen the index positions are the integers in the range[0,MN 1].

2 For[N,M] = [7,3]the index grid isG=01234567891011121314151617181920A pixel in columnxand rowyhas indexp=x+Ny. Givenpone can findthe column and row coordinates byx=pmodNy=p/NDIP Lecture 32 Set OperationsLetAandBbe sets. Ifais the index of a pixel inA, then we writea not inAwe writea/ every element that is inAis also inBthenAis asubsetofB, writtenA BThis is equivalent to the statementa A a the collection of all elements that are in one orboth set. The union is the set represented byC=A B. We can writeC={p|p Aorp B(or both)}DIP Lecture 33 Set OperationsSetAis the white object in the blackbox on the right. The Image gridGis theN Mblack rectangle that holds the we write a setAas anarray whose background values are zeroand object values are not can find the coordinates of the objectbyp=WHERE(A)x=pmodNy=p/NDIP Lecture 34 Set Operations - UnionThe operationC=A Bproduces a set that containsthe elements of fact that some elementsare represented in both sets(red pixels) does not affect thatBitself containstwo disjoint (red)A BDIP Lecture 35 Set Operations (cont)Theintersectionof two setsAandBisD=A B={p|p Aandp B}It is possible thatAandBhave no common elements.

3 In that case, we saythat they aredisjointand writeA B= where is the name for the set with no a setAis the set of elements in the Image gridGthatare not inA:Ac={w|w Gandw/ A}DIP Lecture 36 Set Operations - IntersectionThe operationC=A Bproduces a set that containsthe elements that are in binary imagearrays, then the intersection iscomputed inIDLbyD=AANDBThe pixels in the intersectioncan be found byp=WHERE(A AND B)SetASetBOverlap (red)A BDIP Lecture 37 Set Operations - ComplementThe complementAcis theset of elements that are notcontained complement is computedinIDLbyAc=AEQ0 The pixels in the intersectioncan be found byp=WHERE(A EQ 0)SetASetAcDIP Lecture 38 Set Operations - DifferenceThedifferenceof two setsAandB, denoted byA BisA B={w|w Aandw/ B}=A BcThe set difference doesnotinvolve subtraction of pixels in the set can becomputed byp=WHERE(A AND (B EQ 0))

4 SetASetBSetBcA BDIP Lecture 39 Set Operations - ReflectionA standard Morphological operation is the reflectionof all of the points in a set about the origin of theset. The origin of a set is not necessarily the originof the at the right is an Image and its reflectionabout a point (shown in red), with the original imagein green and the reflected Image in ADIP Lecture 310 Set Operations - ReflectionThe reflected Image (white) may fall partially orentirely outside the Image grid as shown in the reflected Image (white) may overlap the originalimage (green) as shown in the lower figure. Theoverlap is Lecture 311 Set Operations - Reflection ProgramFUNCTION REFLECTION,k,kc,ncols,nrows,row=row,colu mn=column;+;khat=REFLECTION(k,kc,ncols,n rows) is the reflection of Image set k;about the origin represented by kc.

5 The number of columns and rows in the;base Image must be provided. Keywords /row and /column may be set to;reflect the Image around the row or column that contains kc instead of the point;kc.;;If the reflected set is empty then khat=-1 is returned.;;HISTORY;Default reflection written by HR Sept. 1999 for SIMG-782;Modified to reflect about row and column by JH Oct. 2000 for SIMG-782;-IF NPARAMS() LT 4 THEN MESSAGE, REFLECTION has too few arguments ;Find the rectangular coordinats of the set points and the MOD ncolsy=k/ncolsxc=kc MOD ncolsyc=kc/ncolsDIP Lecture 312 Set Operations - Reflection Program (cont);Check for keyword specifying desired reflection and then carry that reflection keywordset(row) then begin;Doing row reflectionxr=xyr=2*yc-yendif else beginif keywordset(column) then begin;Doing column reflctionxr=2*xc-xyr=yendif else begin;Reflect about the origin.

6 If x=xc + dx then xr=xc-dx=2*xc-x.;Same for *xc-xyr=2*yc-yendelseendelse;Keep the points that fall within the base Image (xr GE 0 AND xr LT ncols AND yr GE 0 and yr LT nrows)if min(is) ge 0 then khat=yr[is]*ncols+xr[is] else khat=-1 RETURN,khatENDDIP Lecture 313 Dilation and ErosionDilation and erosion are Basic Morphological Processing operations. Theyare defined in terms of more elementary set operations, but are employedas the Basic elements of many dilation and erosion are produced by the interaction of a set called astructuring elementwith a set of pixels of interest in the structuring element has both a shape and an a set of pixels and letBbe a structuring element. Let( B)sbethe reflection ofBabout its origin and followed by a shift bys. Dilation,writtenA B, is the set of all shifts that satisfy the following:A B={s|( B)s A6= }Equivalently,A B={s|(( B)s A) A}DIP Lecture 314 Morphological DilationAny pixel in the output imagetouched by the in the structuringelement is set to ON when anypoint of the structuring elementtouches a ON pixel in the tends to close up holes inan Image by expanding the ONregions.

7 It also makes that the result depends uponboth the shape of the structuringelement and the location of Lecture 315 Morphological ErosionAny pixel in the outputimage touched by the inthe structuring element isset to ON when everypoint of the structuringelement touches a ONpixel in the original tends to makesobjects smaller byremoving B={s|(B)s A}DIP Lecture 316 Morphological Erosion + DilationThe effect of erosion followed by dilation is illustrated Lecture 317 Fingerprint Image CleanupThe use ofERODE+DILATEis illustrated by this exampleDIP Lecture 318 Boundary ExtractionLetAbe anN Mbinary Image array with the background representedby the value 0. The goal of boundary extraction is to find the pixels thatare on the boundary of objects in the boundary pixels are the set (A)which can be found by (A) =A (A B)cwhereBis a3 3structuring extraction can be implemented with theIDLstatementB=A AND NOT ERODE(A,B)DIP Lecture 319 ExampleLetAbe the arrayA= 1110111110111011111011111111111111111111 1111111111 The object takes up most of the Image , with just four background , erode with a3 3structuring element.

8 The result isE=A B= 0000000000010001110001000111000111111110 0000000000 DIP Lecture 320 Example (cont)Ec= 1111111111101110001110111000111000000001 1111111111 A= 1110111110111011111011111111111111111111 1111111111 (A) =A Ec= 1110111110101010001010111000111000000001 1111111111 The boundary (A)is shown as an Image above. As a set, (A)is a list ofthe foreground pixels in the above Lecture 321 Example: Lincoln ImageThe following program reproduces the example in G&W Figure ;Demonstration of Boundary Extractionfname=datapath+ A=ReadImage(fname,rr,gg,bb)TVLCT,rr,gg,b bsa=Size(A,/DIM)Window,1,Xsize=sa[0],Ysi ze=2*sa[1]+1 Erase,255TV,A,0,sa[1]+1B=Replicate(1b,3, 3)A1=A AND NOT Erode(A,B)TV,A1 & WSHOWDIP Lecture 322 Example: G&W Problem an object represented by the white box from anoisy Image , represented by the a circular structuring element of radiusd=15(shown in lower left corner of the figure)d=15 & B=shift(dist(2*d+1),d,d) LE dPerform a sequence of erosions and dilations using thestructuring (A,B)A2=DILATE(A1,B)A3=DILATE(A2,B)A4=ER ODE(A3,B)DIP Lecture 323G&W Problem (cont)A1=ERODE(A,B) A2=DILATE(A1,B) A3=DILATE(A2,B) A4=ERODE(A3,B)The algorithm does a reasonable job of extracting the , note the rounded corners and small bumps on thesides of Image A4.

9 Compare to the original shown on the ImageDIP Lecture 324G&W Problem (cont)A1=ERODE(A,B) A2=DILATE(A1,B) A3=DILATE(A2,B) A4=ERODE(A3,B)Using a square structuring element of size 31x31 is animprovement. The white rectangle is now recovered ImageDIP Lecture 325 Region FillingDevelop an algorithm to fill in bounded regions of background a structuring element of typeN4,NdorN8, depending on thedesired a pixelpinside a background color be an array of background pixels exceptX0[p] = the iterationXk= (Xk 1 B) Acfork= 1,2,3,..untilXk=Xk Lecture 326 Region Filling ProgramFunction RegionFill,A,start,filter=B,maxiteration s=maxiterationsIF nparams() LT 2 THEN Message, Too Few Arguments to Function IF NOT KEYWORDSET(B) THEN B=[[0b,1b,0b],[1b,1b,1b],[0b,1b,0b]]IF NOT KEYWORDSET(maxiterations) THEN maxiterations=10000 Lsa=Size(A,/dim)X=BytArr(sa[0],sa[1]) & X[start]=1bY=BytArr(sa[0],sa[1])Ac=A EQ 0count=0 WHILE ((min(X EQ Y) EQ 0) AND (count LT maxiterations)) DO BEGIN count=count+1Y=XX=Dilate(Y,B) AND AcENDWHILERETURN,XENDDIP Lecture 327 Example: Connected Regions in MazeDIP Lecture 328 Example: Connected Regions in MazeDIP Lecture 329


Related search queries