segmentation - computer science & eyiannisr/590/2018/lectures/08-segmentation.pdf · •...
TRANSCRIPT
Ioannis Rekleitis
Segmentation
MorphologicalSkeleton• Skeleton(De+inedbycentersofmaximaldisks):
• Applications:anabstractshaperepresentationforhighlevelimageunderstanding,e.g.OpticalCharacterRecognition(OCR)
If a point Z belongs to the skeleton of A, we can find a maximal disk that entirely lies in A and touches the boundary of A at no less than two positions.
CSCE 590: Introduction to Image Processing 2 Slides courtesy of Prof. Yan Tong
MorphologicalSkeleton
𝑆↓𝑘 (𝐴)=(𝐴⊝𝑘𝐵)−(𝐴⊝𝑘𝐵)∘𝐵
𝐾=𝑚𝑎𝑥{𝑘|(𝐴⊝𝑘𝐵)≠∅}
𝐴=⋃𝑘=0↑𝐾▒(𝑆↓𝑘 (𝐴)⨁𝑘𝐵) Reconstruct A from its skeleton
The kth erosion
CSCE 590: Introduction to Image Processing 3 Slides courtesy of Prof. Yan Tong
Examples
http://homepages.inf.ed.ac.uk/rbf/HIPR2/skeleton.htm
Potential issues with skeleton?
Maragos and Schafer, “Morphological Skeleton Representation and Coding of Binary Images”, IEEE Trans. on Acoustics, Speech, and Signal Processing, Vol. 34, No. 5, 1986.
Sensitive to noise
CSCE 590: Introduction to Image Processing 4 Slides courtesy of Prof. Yan Tong
ImageSegmenta6on
Microsoft multiclass segmentation data set
nRRRR ,...,, subregions into partitions that processA 21
CSCE 590: Introduction to Image Processing 5 Slides courtesy of Prof. Yan Tong
ImageSegmenta6on–Applica6ons
• Objectlocalization• Objectrecognition• Speciallyimportantformedicalimaging
CSCE 590: Introduction to Image Processing 6 Slides courtesy of Prof. Yan Tong
BriefReviewofConnec6vity
• Path from p to q: a sequence of distinct pixels with coordinates
Starting point p ending point q
• p and q are connected: if there is a path from p to q in S • Connected component: all the pixels in S connected to p • Connected set: S has only one connected component • R is a region if R is a connected set • Ri and Rj are adjacent if is a connected set
adjacent
ji RR ∪
CSCE 590: Introduction to Image Processing 7 Slides courtesy of Prof. Yan Tong
Image Segmentation
jiji
i
ji
i
n
ii
RRFALSERRQTRUERQ
jiRR,...,ni,R
RR
and regionsadjacent for )( (e))( (d)
, (c)1set connecteda is (b)
(a)1
=∪
=
≠∀=∩
=
==
φ
∪
Two categories based on intensity properties: • Discontinuity – edge-based algorithms • Similarity – region-based algorithms
⋃𝑖=1↑𝑛▒𝑅↓𝑖 =𝑅
CSCE 590: Introduction to Image Processing 8 Slides courtesy of Prof. Yan Tong
Edge-based and Region-based Segmentation
CSCE 590: Introduction to Image Processing 9 Slides courtesy of Prof. Yan Tong
Edge-basedSegmenta6on
• Thresholdingisrequiredtogetedgepixelsandrealizeedge-basedsegmentation
• Boundarydetection(edgelinking)isstillahotresearchtopicinimageprocessingandcomputervision
• Incorporatedomainknowledge:• Psychologyrulesontheboundary:smooth,convex,symmetry,closed,complete,etc
• Templateshapeinformation:hand,stomach,lip,etc• Appearanceinformation:region-basedtexture,intensity/color,etc.
CSCE 590: Introduction to Image Processing 10 Slides courtesy of Prof. Yan Tong
Edge-based Segmentation -- Intensity Thresholding
⎩⎨⎧
≤
>=
TyxfTyxf
yxg),( if0),( if1
),(• AconstantT-globalthresholding• AvariableT-local/regionalthresholding;adaptivethresholding• MultipleT-multiplethresholding
Object/backgroundsegmentation:
CSCE 590: Introduction to Image Processing 11 Slides courtesy of Prof. Yan Tong
Key Factors Affect Thresholding
• Separation between peaks • Noise level • Relative sizes of objects and background • Uniformity of the illumination source • Uniformity of the reflectance of the image
CSCE 590: Introduction to Image Processing 12 Slides courtesy of Prof. Yan Tong
The Role of Noise in Image Thresholding
CSCE 590: Introduction to Image Processing 13 Slides courtesy of Prof. Yan Tong
The Role of Illumination in Thresholding
CSCE 590: Introduction to Image Processing 14 Slides courtesy of Prof. Yan Tong
HowtoPicktheThreshold
1. Selectaninitialestimatefortheglobalthreshold,T.
2. SegmenttheimageusingTbyproducingtwogroupsofpixels
3. Computethemeanofthesetwogroupsofpixels,saym1andm2.
4. UpdatethethresholdT=(m1+m2)/25. RepeatSteps2through4untilconvergence
T m1 m2 CSCE 590: Introduction to Image Processing 15 Slides courtesy of Prof. Yan Tong
HowtoPicktheThreshold
1. Selectaninitialestimatefortheglobalthreshold,T.
2. SegmenttheimageusingTbyproducingtwogroupsofpixels
3. Computethemeanofthesetwogroupsofpixels,saym1andm2.
4. UpdatethethresholdT=(m1+m2)/25. RepeatSteps2through4untilconvergence
m1 m2 T CSCE 590: Introduction to Image Processing 16 Slides courtesy of Prof. Yan Tong
An Example
CSCE 590: Introduction to Image Processing 17 Slides courtesy of Prof. Yan Tong
Image Segmentation
jiji
i
ji
i
n
ii
RRFALSERRQTRUERQ
jiRR,...,ni,R
RR
and regionsadjacent for )( (e))( (d)
, (c)1set connecteda is (b)
(a)1
=∪
=
≠∀=∩
=
==
φ
∪
Two categories based on intensity properties: • Discontinuity – edge-based algorithms • Similarity – region-based algorithms
⋃𝑖=1↑𝑛▒𝑅↓𝑖 =𝑅
CSCE 590: Introduction to Image Processing 18 Slides courtesy of Prof. Yan Tong
Region-BasedSegmenta6on
• Regiongrowing• Regionsplittingandmerging
CSCE 590: Introduction to Image Processing 19 Slides courtesy of Prof. Yan Tong
RegionGrowingAlgorithm
- Aprocedurethatgroupspixelsorsubregionsintolargerregionsbasedonprede+inedcriteriaforgrowth
- Startwithasetof“seed”pointsandgrowregionsbyappendingneighboringpixelsthatsatisfythegivencriteria- Connectivity- Stoppingrules
- Localcriteria:intensityvalues,textures,color- Priorknowledge:sizeandshapeoftheobject
CSCE 590: Introduction to Image Processing 20 Slides courtesy of Prof. Yan Tong
An Example
𝑄={█𝑇𝑟𝑢𝑒&𝑖𝑓 |𝐼↓𝑠𝑒𝑒𝑑 −𝐼(𝑥,𝑦)|≤𝑇@𝐹𝑎𝑙𝑠𝑒&𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
CSCE 590: Introduction to Image Processing 21 Slides courtesy of Prof. Yan Tong
Region-Splitting and Merging Algorithm
Step1: Keep splitting the region while and Step 2: Merge the subregions while
FALSERQ i =)( SizeRi min>
TRUERRQ ji =∪ )(
CSCE 590: Introduction to Image Processing 22 Slides courtesy of Prof. Yan Tong
An Example
⎩⎨⎧ <<>
=otherwiseFALSE
bmaifTRUEQ
0&σ
Extract the outer ring
CSCE 590: Introduction to Image Processing 23 Slides courtesy of Prof. Yan Tong
AdvancedApproachesforImageSegmenta6on
• General-purposeimagesegmentationisfarfromwellsolved
• Itisstillaresearchproblemthatisbeinginvestigatedbymanyresearchers
• ImagesegmentationbyK-meansclustering• ImagesegmentationwithGraphicModels(MRF,CRF,etc)
• SemanticSegmentationwithDeepLearning• http://blog.qure.ai/notes/semantic-segmentation-deep-learning-review
CSCE 590: Introduction to Image Processing 24 Slides courtesy of Prof. Yan Tong
MorphologicalImageProcessing–TechniquestoImproveImageSegmenta6on
• Objective:Extractimagecomponentsforrepresentationanddescriptionofregionshapeincluding• Boundaries• Skeletons• Convexhull
• Applications:• Edgedetection• Blob/connectedcomponentdetection
CSCE 590: Introduction to Image Processing 25 Slides courtesy of Prof. Yan Tong
BasicConcepts• Union,intersection,complement,difference• Setre+lection• Settranslation--movethecenter/
originofBbyzpixels
• Structureelements(SEs):smallsets/subimagesusedinmorphology
{ }BB z ∈+== bzbcc ,|)(
{ }BbbwwB ∈−== ,|ˆ
reflection
translation 2D
SEs
SEs for images
Blackdotsarecenters/originsofSE
CSCE 590: Introduction to Image Processing 26 Slides courtesy of Prof. Yan Tong
AnExampleofMorphology• CreateanewsetbyrunningBoverAsothattheoriginofBvisitseveryelementofA.
• Anexampleoferosion:IfBiscompletelycontainedinAforeachoperation,thenewelementisamemberofthenewset.
The shaded cell belongs to A/B
Erosion result CSCE 590: Introduction to Image Processing 27 Slides courtesy of Prof. Yan Tong
CommonMorphologicalOpera6ons
• Twobasicoperations• Erosion• Dilation• Otheroperations• Opening/closing• Hit-or-Misstransform• Thinning/thickening• Hole+illing
CSCE 590: Introduction to Image Processing 28 Slides courtesy of Prof. Yan Tong
Erosion
A { }ABzB z ⊆= )(| A { }0)(| =∩= cz ABzBor
Shrink or thin objects and remove the details smaller than the SE ∅
CSCE 590: Introduction to Image Processing 29 Slides courtesy of Prof. Yan Tong
Dila6on
{ }0)ˆ(| ≠∩=⊕ ABzBA z
Grows or thickens objects and remove the gaps smaller than the SE CSCE 590: Introduction to Image Processing 30 Slides courtesy of Prof. Yan Tong
Proper6esofErosionandDila6on• Dilationiscommutative
• Dilationisassociative
• Dilationisdistributiveovertheunionoperation
ABBA ⊕=⊕
( )CBACBA ⊕⊕=⊕⊕
𝐴⨁(𝐵∪𝐶)=(𝐴⊕𝐵)∪(𝐴⨁𝐶)
CSCE 590: Introduction to Image Processing 31 Slides courtesy of Prof. Yan Tong
Proper6esofErosionandDila6on
• Erosion
• Erosionanddilationaredualsofeachother
• • ifandonlyif
• IfandBCBA ⊕⊆⊕,CA⊆ 𝐴⊝𝐵⊆𝐶⊝𝐵
𝐴⨁𝐵= (𝐴↑𝑐 ⊝ 𝐵 )↑𝑐
𝐴⊆(𝐶⊝𝐵) (𝐴⨁𝐵)⊆𝐶
CSCE 590: Introduction to Image Processing 32 Slides courtesy of Prof. Yan Tong
Opening• Smooththecontourofanobject• Breaknarrowbridges• Eliminatethinprotrusions
ABA (=! BB ⊕)( ) BABBA !!! =( ) ABA ⊆! BCBACifA !! ⊆⊆ ,
The SE rolls within the boundary of A.
𝐴∘𝐵=∪{(𝐵)↓𝑧 | (𝐵)↓𝑧 ⊆𝐴}
CSCE 590: Introduction to Image Processing 33 Slides courtesy of Prof. Yan Tong
Opening(Cont’d)Thin isthmus
Smoothed outer corners
Isthmus removed
CSCE 590: Introduction to Image Processing 34 Slides courtesy of Prof. Yan Tong
Closing• Smooththecontourofanobject• Fillnarrowbreaksandgaps• Eliminatelongandthingulfs• Eliminatesmallholes
The SE rolls outside the boundary of A.
( ) BABBA •=••( )BAA •⊆ BCBACifA •⊆•⊆ ,
)( BABA ⊕=• B
cc BABA )ˆ( !=•Opening and closing are duals of each other
CSCE 590: Introduction to Image Processing 35 Slides courtesy of Prof. Yan Tong
Closing(Cont’d)
Smoothed inner corners
Eliminated thin gulf CSCE 590: Introduction to Image Processing 36 Slides courtesy of Prof. Yan Tong
Opening&Closing
𝐴⊝𝐵⊆𝐴∘𝐵⊆𝐴⊆ BABA ⊕⊆•
⊆ ⊆
⊆ ⊆
CSCE 590: Introduction to Image Processing 37 Slides courtesy of Prof. Yan Tong
AnExampleofOpening&Closing
• Anopeningremovesallnoise• removingthewhite
noisebyerosion• removingtheblack
noisebydilation• Anadditionalclosing+ills
thegaps
CSCE 590: Introduction to Image Processing 38 Slides courtesy of Prof. Yan Tong
Ques6ons?
CSCE 590: Introduction to Image Processing 39