segmentation - computer science & eyiannisr/590/2018/lectures/08-segmentation.pdf · •...

39
Ioannis Rekleitis Segmentation

Upload: others

Post on 11-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Ioannis Rekleitis

Segmentation

Page 2: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 3: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

MorphologicalSkeleton

𝑆↓𝑘 (𝐴)=(𝐴⊝𝑘𝐵)−(𝐴⊝𝑘𝐵)∘𝐵

𝐾=𝑚𝑎𝑥{𝑘|(𝐴⊝𝑘𝐵)≠∅}

𝐴=⋃𝑘=0↑𝐾▒(𝑆↓𝑘 (𝐴)⨁𝑘𝐵)  Reconstruct A from its skeleton

The kth erosion

CSCE 590: Introduction to Image Processing 3 Slides courtesy of Prof. Yan Tong

Page 4: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 5: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 6: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

ImageSegmenta6on–Applica6ons

•  Objectlocalization•  Objectrecognition•  Speciallyimportantformedicalimaging

CSCE 590: Introduction to Image Processing 6 Slides courtesy of Prof. Yan Tong

Page 7: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 8: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 9: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Edge-based and Region-based Segmentation

CSCE 590: Introduction to Image Processing 9 Slides courtesy of Prof. Yan Tong

Page 10: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 11: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 12: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 13: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

The Role of Noise in Image Thresholding

CSCE 590: Introduction to Image Processing 13 Slides courtesy of Prof. Yan Tong

Page 14: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

The Role of Illumination in Thresholding

CSCE 590: Introduction to Image Processing 14 Slides courtesy of Prof. Yan Tong

Page 15: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 16: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 17: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

An Example

CSCE 590: Introduction to Image Processing 17 Slides courtesy of Prof. Yan Tong

Page 18: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 19: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Region-BasedSegmenta6on

•  Regiongrowing•  Regionsplittingandmerging

CSCE 590: Introduction to Image Processing 19 Slides courtesy of Prof. Yan Tong

Page 20: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 21: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

An Example

𝑄={█𝑇𝑟𝑢𝑒&𝑖𝑓 |𝐼↓𝑠𝑒𝑒𝑑 −𝐼(𝑥,𝑦)|≤𝑇@𝐹𝑎𝑙𝑠𝑒&𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒  

CSCE 590: Introduction to Image Processing 21 Slides courtesy of Prof. Yan Tong

Page 22: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 23: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

An Example

⎩⎨⎧ <<>

=otherwiseFALSE

bmaifTRUEQ

0&σ

Extract the outer ring

CSCE 590: Introduction to Image Processing 23 Slides courtesy of Prof. Yan Tong

Page 24: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 25: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

MorphologicalImageProcessing–TechniquestoImproveImageSegmenta6on

•  Objective:Extractimagecomponentsforrepresentationanddescriptionofregionshapeincluding•  Boundaries•  Skeletons•  Convexhull

•  Applications:•  Edgedetection•  Blob/connectedcomponentdetection

CSCE 590: Introduction to Image Processing 25 Slides courtesy of Prof. Yan Tong

Page 26: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 27: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 28: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 29: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 30: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 31: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Proper6esofErosionandDila6on•  Dilationiscommutative

•  Dilationisassociative

•  Dilationisdistributiveovertheunionoperation

ABBA ⊕=⊕

( )CBACBA ⊕⊕=⊕⊕

𝐴⨁(𝐵∪𝐶)=(𝐴⊕𝐵)∪(𝐴⨁𝐶)

CSCE 590: Introduction to Image Processing 31 Slides courtesy of Prof. Yan Tong

Page 32: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Proper6esofErosionandDila6on

•  Erosion

•  Erosionanddilationaredualsofeachother

•  •  ifandonlyif

•  IfandBCBA ⊕⊆⊕,CA⊆ 𝐴⊝𝐵⊆𝐶⊝𝐵

𝐴⨁𝐵= (𝐴↑𝑐 ⊝ 𝐵 )↑𝑐 

𝐴⊆(𝐶⊝𝐵) (𝐴⨁𝐵)⊆𝐶

CSCE 590: Introduction to Image Processing 32 Slides courtesy of Prof. Yan Tong

Page 33: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 34: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Opening(Cont’d)Thin isthmus

Smoothed outer corners

Isthmus removed

CSCE 590: Introduction to Image Processing 34 Slides courtesy of Prof. Yan Tong

Page 35: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

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

Page 36: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Closing(Cont’d)

Smoothed inner corners

Eliminated thin gulf CSCE 590: Introduction to Image Processing 36 Slides courtesy of Prof. Yan Tong

Page 37: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Opening&Closing

𝐴⊝𝐵⊆𝐴∘𝐵⊆𝐴⊆ BABA ⊕⊆•

⊆ ⊆

⊆ ⊆

CSCE 590: Introduction to Image Processing 37 Slides courtesy of Prof. Yan Tong

Page 38: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

AnExampleofOpening&Closing

•  Anopeningremovesallnoise•  removingthewhite

noisebyerosion•  removingtheblack

noisebydilation•  Anadditionalclosing+ills

thegaps

CSCE 590: Introduction to Image Processing 38 Slides courtesy of Prof. Yan Tong

Page 39: Segmentation - Computer Science & Eyiannisr/590/2018/Lectures/08-Segmentation.pdf · • General-purpose image segmentation is far from well solved • It is still a research problem

Ques6ons?

CSCE 590: Introduction to Image Processing 39