FundamentaInformaticae41(2001)187{2281IOSPressTheWatershedTransform:Denitions,AlgorithmsandParallelizationStrategiesJosB.T.M.RoerdinkandArnoldMeijsterInstituteforMathematicsandComputingScienceUniversityofGroningenP.O.Box800,9700AVGroningen,TheNetherlandsEmail:roe@cs.rug.nl,a.meijster@rc.rug.nlAbstract.Thewatershedtransformisthemethodofchoiceforimagesegmentationintheeldofmathematicalmorphology.Wepresentacriticalreviewofseveraldenitionsofthewatershedtransformandtheassociatedsequentialalgorithms,anddiscussvariousissueswhichoftencauseconfusionintheliterature.Theneedtodistinguishbetweendenition,algorithmspecicationandalgorithmimplementationispointedout.Variousexamplesaregivenwhichillustratedierencesbetweenwatershedtransformsbasedondierentdenitionsand/orimplementations.Thesecondpartofthepapersurveysapproachesforparallelimplementationofsequentialwatershedalgorithms.Keywords:Mathematicalmorphology,watershedtransform,watersheddenition,se-quentialalgorithms,parallelimplementation.1.IntroductionIngreyscalemathematicalmorphologythewatershedtransform,originallyproposedbyDigabelandLantuejoul[9,20]andlaterimprovedbyBeucherandLantuejoul[4],isthemethodofchoiceforimagesegmentation[5,46,52].Generallyspoken,imagesegmentationistheprocessofisolatingobjectsintheimagefromthebackground,i.e.,partitioningtheimageintodisjointregions,suchthateachregionishomogeneouswithrespecttosomeproperty,suchasgreyvalueortexture[18].Thewatershedtransformcanbeclassiedasaregion-basedsegmentationapproach.Theintuitiveideaunderlyingthismethodcomesfromgeography:itisthatofalandscapeorto-pographicreliefwhichisoodedbywater,watershedsbeingthedividelinesofthedomainsofattractionofrainfallingovertheregion[46].Analternativeapproachistoimaginethelandscapebeingimmersedinalake,withholespiercedinlocalminima.Basins(alsocalled`catchment2J.B.T.M.RoerdinkandA.Meijster/TheWatershedTransformbasins')willllupwithwaterstartingattheselocalminima,and,atpointswherewatercomingfromdierentbasinswouldmeet,damsarebuilt.Whenthewaterlevelhasreachedthehighestpeakinthelandscape,theprocessisstopped.Asaresult,thelandscapeispartitionedintoregionsorbasinsseparatedbydams,calledwatershedlinesorsimplywatersheds.Whensimulatingthisprocessforimagesegmentation,twoapproachesmaybeused:eitheronerstndsbasins,thenwatershedsbytakingasetcomplement;oronecomputesacompletepartitionoftheimageintobasins,andsubsequentlyndsthewatershedsbyboundarydetection.Tobemoreexplicit,wewillusetheexpression`watershedtransform'todenotealabellingoftheimage,suchthatallpointsofagivencatchmentbasinhavethesameuniquelabel,andaspeciallabel,distinctfromallthelabelsofthecatchmentbasins,isassignedtoallpointsofthewatersheds.AnexampleofasimpleimagewithitswatershedtransformisgiveninFig.1(a-b).Wenoteinpassingthatinpracticeoneoftendoesnotapplythewatershedtransformtotheoriginalimage,buttoits(morphological)gradient[26].Thisproduceswatershedsatthepointsofgreyvaluediscontinuity,asiscommonlydesiredinimagesegmentation.Oneofthedicultieswiththisintuitiveconceptisthatitleavesroomforvariousformal-izations.Dierentwatersheddenitionsforcontinuousfunctionshavebeengiven,whichwillbebrieyreviewedinSection3.1.However,ourmaininteresthereisindigitalimages,forwhichthereisevenmorefreedomtodenewatersheds,sinceinthediscretecasethereisnouniquedenitionofthepathadropofwaterwouldfollow.Manysequentialalgorithmshavebeende-velopedtocomputewatershedtransforms,seee.g.[26,51]forasurvey.Theycanbedividedintotwoclasses,onebasedonthespecicationofarecursivealgorithmbyVincent&Soille[52],andanotherbasedondistancefunctionsbyMeyer[25].Inthecontextofparallelimplementationsthereexistsanotabletendencyforintroducingotherdenitionsofthewatershedtransform,enablingeasierparallelization.ExamplesarepresentedinSection5.(a)(b)(c)(d)Figure1.Examplesofwatershedsegmentationbyimmersion(seeDenition3.2).(a):syntheticimage;(b):watershedtransformof(a);(c):naturalimage;(d):watershedtransformof(c).Dierentbasinsareindicatedbydistinctgreyvalues.Theimpressionwhichthecurrentliteratureonwatershedalgorithmsmakesupontheunini-tiatedreadercanonlybeoneofgreatconfusion.Oftenitisuncertainexactlywhichdenitionforthewatershedtransformisused.SometimesthedenitiontakestheformofthespecicationJ.B.T.M.RoerdinkandA.Meijster/TheWatershedTransform3ofanalgorithm.Acarefuldistinctionbetweenalgorithmspecicationandimplementationisinmanycaseslacking.Withoutsuchaseparation,correctnessassessmentofproposedalgorithmsisimpossible.Evenwhenaspecicationisgiven,theimplementationoftendoesnotadheretoit.Adhocmodicationsaremadetoeliminate`undesirable'consequencesofawatersheddenition,butsuchchangestendtocreatenewproblemsbysolvinganoldone.Or`optimiza-tions'areintroduced,forgreaterspeedormemoryreduction,whichintheprocesschangetheoutcomeofthealgorithmaswell,althoughthismayoftengoundetectedinthecaseofnaturalimages.Thesequestionsarenotpurelyacademic,sincethealgorithmiswidelyusedine.g.medicalimageprocessingwhereunwantedsideeectsshouldbeavoided.Thepurposeofthispaperistwofold.Intherstpartwepresentacriticalreviewofseverald