You are on page 1of 22

20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Rex'sTribeofImage Searchthissite

Processing
Navigation ChanVeseActiveContours>
Aboutthiswebsite
TraditionalImage
ASIMPLEINTRODUCTIONOFACTIVECONTOUR
Processing WITHOUTEDGES
LevelSetsandActive postedMar25,2009,7:38AMbyYueWu[updatedSep16,2009,4:11AM]
ContoursRelated
ChanVeseActive
Contours
ASIMPLE
INTRODUCTIONOF
ACTIVECONTOURWITHOUT
ACTIVECONTOUR
WITHOUTEDGES EDGES
SometipsofChan
vese

MATLABCODES
FORACTIVE
Lastupdated03/23/2009
CONTOURS
Imageinpainting ByYueWu
Anexampleofhow
todoimage AllRightsreserved
inpainting

Newphotoshop
Sitemap
1.ProblemIntroduction
Recentsiteactivity
Adifferentinterpretationof 2.MathematicalDescription
ChanVeseActiveContour
fromtheviewofOptimal 3.NumericalAlgorithm
GlobalThresholding
createdbyRexWu 4.Evaluationsonrealimages
Aboutthiswebsite
editedbyRexWu 5.Differencesbetweenmethods
ChaosandFractals
editedbyRexWu
6.Reference

Chaoticmap
createdbyRexWu

Imageinpainting
editedbyRexWu
1.ProblemIntroduction
ViewAll
Simplyspeakingtheproblemis:givenanimageI,howtofindand
whatISitssegmentationandhowtofindit.
Forexample,ifafollowingbrainimageisgiven,theproblemcould
bedescribedto"whatistheimagecomponentinsideoftheskull",i.e.
"howtotruncatethepartofthebrainimageboundedbythe
'white'skullcontours".

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 1/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

fig.1OriginalMRIbrainimage

Therearemanyapproachesforyoutogetthesegmentationofthe
skullshape.Eventhosesimpleones,likeasimplesobelmask,will
giveyougooddetectiononthecontouroftheskull.Inordertogeta
betteredgemap,youmayuseCannyEdgedetector.Furthermore,
youcangetasegmentationbelow.

fig.2Skullsegmentationofthebrainimage

Ofcourse,theabovedescriptionofsegmentationforthisbrianimage
isnotthatprecisely,becausewewanttoknowthedetailsofthe
brainbutnoteverythinginsideoftheskull.However,thesegment
ofbrainisnotaeasyproblem.Althoughyoucoulduse'highedge
value'and'lowedgevalue'todistinguishthecontouroftheskulland
thatofthebrain,themethodusedhereiscalledactivecontours,
morepreciselyChanVeseActiveContourswithoutedges.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 2/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

fig.3Brainsegmentationofthebrainimage

Clearlylatersegmenttellsmuchmoreusefulinformationanditgives
moredetails.

Inthispassage,wemainlytalkabouttheidea,algorithm,and
realizationofthisChanVeseActiveContour.

2.MathematicalDescription
CHANVESEactivecontouralgorithmcomesfromsegmentation
problemformulatedbyMumfordandShah.Asaresultoflacking
formulainputtoolsinthissiteIuseimagefileforthoseformulasand
Greeksymbols.

MumfordandShahsminimizationproblem:

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 3/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

ChanVeseactivecontourswithoutedges

Inordertounderstandwhat'sgoingonwith
thisidea,let'sseesomefiguresfromtheoriginalpaper.
Inthepaper:Activecontourswithoutedges[1],
thefirsttwotermshavebeeninterpretedtotwo
forces.Thefirsttermistheforcetoshrinkthe
contour.Thesecondtermistheforcetoexpandthe
contour.Thesetwoforcesgetbalancedwhenthe
contourreachestheboundaryofourinterested
object.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 4/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Forexample,let'sseethefollowingfourcases.
Simplydefineeverythinginblack=1and
everythingingray=1.Andherec1andc2couldbe
interpretedtobethemeanvalueofeverything
insideofthecontourCandthemeanvalueof
everythingoutsideofthecontourC,respectively.
Hereu0standsfortheentireimage.

Caseone:
theinitialcontourcoversthewholeobject(1)and
somegrayregion(+1).Thusc1isaboutzero
somethingandc2is1.Noticetheintegralabove
isonlyrespecttoinsideregionofu0oroutside
region.Clearly,ifuseeverythingoutsideofthe
contourtominusc2,wewillgetzero.Hencethe
secondtermF2iszero.Becausec1isabout
zero,whenweuseeverythinginsideofthecontour
tominusc1andfindthesumofthesquaresasthe
formulashowed,wewillreachsomebigpositive
number.SoF1>0.
NowF1>0butF2=0.Therefore,thecontourwill
shrinkitselfinthenextstep.
Nowyoumightbeabletoexplainwhat'sgoingon
withthecontoursinothercases.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 5/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Finally,whenourcontourCreachestheboundary
oftheobject,ascasefourshows,F1=0andF2=0.
Asaresult,thecontourCreachesitsequilibrium.
Hencewefindthecontouroftheobjectandthuswe
couldgetitssegmentation.

Levelsetformulation

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 6/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

3.NumericalAlgorithms
AnalyticapproximationsforHeavisideandDiracdelta
functions

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 7/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Note:therearemanydifferentwaystogeta
'continuous'versionofHeavisidefunctionandits
correspondingdeltafunction.
FormoreinformationpleaseseeWikipedia.

Analyticapproximationsforimagecurvature

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 8/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

ApproximationonPhi
Actuallythereareseveralwaystoachievethe
approximationofthisPhi(levelset0function).
Onewayisdiscussedinthepaper,formoredetails,
pleasecheckthereference.
Breiflyspeaking,bydiscretizingPhi,theauthor
achievedfollowingequation.Asyoucansee,thisis
animplictequationabout
Phi(n+1).Goodnewsisthatthisequationisstill
linearandthusitissolvable.However,badnewsis
itneedsmorestepsandmorecomplicated
calculations.



Ifyouwanttosolvetheequationviathisway,please
checkthepaperandithasallnecessarysteps.
Allinall,finallythisequationissolvableandthus
wecangetPhi(n+1)andtheproblemsolved.
(BecausePhiwillstoptoevolveonceitreachedthe
boundariesofourinterestedobject.)

4.Evaluationonrealimages
ChanVeseactivecontourswithoutedges[1]ongrayscale
image

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 9/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Ifyouinterestedinhowtogettheseresultsand
whataretheirMatlabcodes,pleasecheckthepage:
MATLABCODESFORACTIVECONTOURS
HereisavideocliponYouTubeuploadedbyme.
Inthisclip,youwillseehowwefindthesketchof
theMicky.

Micky

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 10/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

ChanVeseactivecontourswithoutedgesforvector
image[2]

Activecontourswithoutedgesforvectorimage[2]is
similartoactivecontourswithoutedges[1].

Themajordifferenceis:

Herec(i)justdefinedtodifferentimage
components.LikeinRGBimage,thereareR,G,B
threecolorcomponents.Thesec(i),i.e.meanvalue
ofthecontourforeachcolorcomponent.

InpreviousChanVeseactivecontourswithout
edges,weonlyapplythose'forcebalance'thingsto
one2Dimage.However,nowforChanVeseactive
contourswithoutedgesforvectorimage,weapply
thesamealgorithmtoone3Dimage,whichcouldbe
considertobe32Dimage.Becausethealgorithm
workswellon2Dimage,wecannotdealwith3D
image.

Youmightthinkweshouldapplythealgorithmon
eachcomponentandthenwewillreachanice
contour.Unfortunately,ifyoudothat,youwillget
Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 11/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

onecontouroneachcomponent(2Dimage).And
probablythesethreearenotidentical.

Thereforetherightwaytoapplythe2Dalgorithmto
3Dproblemhereisnotlikeabove.Recall
ourobjectiveanditisstilltogetoneand
onlyoneneatcontour(s)aboutourinterested
objects.

Asyouseeintheformulaabove,theforcething
couldbeperfectlyinterpretedinDynamics.Weare
stilllookingfortwoforces:onetendingtoshrinkthe
contourandtheothertendingtoexpandthe
contour.Insteadofhavingonlyonecomponent,
nowwehavethree.Wefirstlyfindthecomponentof
forcesonthesethree2Dimages.Andthenwe
calculatetheirresultantforces.Finally,theresultant
forcescontrolthemovementofourcontour.

Thisapproachisverygoodtomanynoisyimage,
wheresomeormanypixelsoftheimagehavebeen
addednoises.Generalspeaking,manyedge
detectionalgorithmwillmistakenlycatchthose
noise,asaresultofthesenoisypixelsarenot
distinguishablefromthoseinformation
pixels.However,inthisalgorithm,unlessthenoise
contaminatedallthreecomponentsatthesame
pixel,wecanresistthenoiseinfluencetoouredge
detection.

Hereisanexample,rightimagehavebeenadded
twotypesofnoisesintwocomponentsandbecome
reallynoisy.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 12/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

WeapplyChanVeseactivecontourswithoutedges
forthisnoisyimageandfollowingthinsareour
result.

Theresultisreallynice.

MultiphaseChanVeseactivecontourswithoutedges[3]

Simplyspeaking,inprevioustwoapproacheswe
discussedabove,weonlytrytofindone'active
contour'.Aswecanseefromtheresult,oneactive
contourcanonlytellustwothings:whatisthe
foregroundoftheimageandwhatisthe
background.Formoredetails,theyfailtotell.
Therefore,foranyimagewhichhasmorethantwo
colors,previousapproachcannotdistinguishthem.
Theywilleithergettwocolorsinforegroundor
catchtwocolorsinbackground.

Howtosolvetheproblemabove?Naturallywewill
thinkaboutgettingmorecontours.Ifwehave'N'
contours,weshouldbeabletodistinguish2^N
colors.

Ishouldbeabletoaddmoreinformationforthis
topiclater.

Ifyouareinterestedinthispart,pleaseseeits
referencepaper.
Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 13/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Herearetwoexamples:

Followingimagehasseveralcomplicatedstructures:
triplejunction,quadruplejunction,differentcolors
anddifferentshapes.Onephaseactivecontours
cannotdistinguishallobjectsintheimage,while
twophasesactivecontourscouldachievethisgoal.

Aboveresultshowsthatmultiphaseactivecontours
could distinguish much more objects and
automaticallydetecteveryedgeintheinputimage.
Thismethodcaneasilyhandledifferentcomplicated
topologicalchanges.

4Colors

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 14/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

In this photo image, background is sky and


foregroundistworedandtwoyellowflowers.

By using multiphase active contour, we can get the


segmentationasfollows.

Reallycool,isn'tit?

owers2

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 15/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

5.Differencesbetween
methods
Althoughwetalkedsomethingaboutthedifference
betweenthesemethods,youmightstillwonder
whatareexactlydifferencesbetweenabove
methods?Whichonegivesthebestqualityand
whichoneworksfastest?Thissectionistryingto
showyoutheirdifferences.

1.GrayimageorColorimage?

Treatingimageasagrayimageoracolorimagewill
leadustotwodifferentapproaches.
Ifyoutreatanimagetoagrayone,thenweonly
needtocareabouttwoimageforcesaswe
mentionedinprevioussection.
However,ifyou'dliketotreattheimagetoacolor
one,thenyouhavetoapplytheideaforvector
images,whichwillcalculateallcomponentsof
forces.
Generallyspeaking,consideringtheimagetoagray
onewillsimplifythesegmentationquestionand
leadtosimplecalumniationbutlosesomeimage
information.
Consideringtheimagetoacoloronewillbehelpful
todenoisetheimagebutleadtomorecalculations.

Therefore,ifyouhaveacleanimage,whichmeans
nonoise,thenprobablyyoucantreatitasagray
image.Otherwise,Iwilltreatittoavectorimagefor
tradingcalculationcomplexityforbetterdenoising
ability.

Recalltheexampleinsection4aboutdenoising.
Let'sseewhathappenswhenwetreatingthesame
imageasagrayone.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 16/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing


Itisnothardtoconvinceyourselfwhywegeta
resultabove,isn'tit?
However,whenweconsiderittoavectorimage,the
strongdenoisingabilityshows.

Wegetaveryneatsegmentationimagecomparing
tothenoisyinputimage.Andthissegmentation
Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 17/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

imageisalmostperfectmatchtheoriginalclean
image.

2.Singlephaseormultiphases?

Treatingaimagetosinglephasemeansyoucould
only'divide'theoriginalimageintotwoparts(No
matterhowyouinterpretedhere,i.e.twocolors,
backgroundandforeground,etc.).
Treatingaimagetomultiphasemeansyoucould
'divide'theoriginalimageintomoreparts,more
precisely2^Nparts,whereNisthenumberof
phases.
Soiftheobjectsyouareinterestedinarenotthat
'simple'(likeasingleobject,ahomogeneousregion
andetc),probablyyoushouldapplymultiphasefor
betterresults.Howeveryouhavetotradetimeoff
Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 18/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

formultiphase.Ifyoudonothaveafastmachine,it
willbeareallypainfulexperiencetowaittheresult.
Butifyouonlywantdetecthomogeneousregion,
liketextsegmentation,singlephaseisagoodchoice
forthiskindoftask.

Hereistheresultifweapplysinglephaseactive
contourto'flowers.jpg'.

Aswementionedbefore,singlephasecouldonly
'divide'imageintotwoparts.Inaboveresult,wesee
finallythealgorithmrecognizeevery'bright'thing
tothebackgroundandevery'dark'thingtothe
foreground.Thereforesome'highlights'onthestem
andtheflowershavebeenreorganizedtothe
background.However,wecanstillrecognize
'flowers'intheresult,atleastthealgorithm
separatedtheskyandtheflowers.
Moreprecisely,thereareatleast5colorsinthe
originalimage,blue,white,red,yellowandgreen.
However,weonlyhaveonephaseandthealgorithm
havetogroupthesefiveregionstotworegions.How
thealgorithmdoesthisprocedure?Basically,the
algorithmwillgrouptheseregionsrespecttotheir
different'meanvalue'.Iftworegionshaveaclose
meanvaluethanothercolors,thesetwocolorwillbe
groupedintoone.Clearly,themeansvalueofwhite
andskybluearemuchcloserthanothers,andthus
thesetwocolorregionsgotooneinthefinal
segmentation.

Butwithmultiphase,wecangetmoreinformation.
Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 19/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Notjustdividetheimageto'black'and'white'
regionsbuttomorecolorsregions.


Althoughyoumayarguethattheresultisstillnot
perfect,formeit'salreadygoodenough.Asaresult
oftwophases,wecanonlydivideimagetofour
regions(oryoucansayfourcolors).Nowwe
successfullydistinguishedthecolorsaboutthe
flowers,whicharegroupedintooneregionina
singlephasecase.However,westillfailedto
distinguish'white'in'skyblue'.Why?Becausewe
onlyhavetwophasesandconsequentlywecanonly
distinguishfourregionsatmost.Thereisnowayto
detectafivecolorimagebyfourcolordetection
algorithm.

YoumayalsoaskCanwedistinguish'white'and'sky
blue'butnot'yellow'and'red'orothercolorpairs.
Orifwerunthealgorithminadifferentwayisit
possibleforustogetasegmentationwhich
distinguishes'white'and'skyblue'butleavesother
twocolorstogether.TheanswerisYES.

Thereasonwhyitispossibletogetasegmentation
distinguishing'white'and'skyblue'withtwophases
isbecauseouralgorithmisavariancebased
algorithm.

Approximatemeanvalueforeachcoloronallthree
components:
RGBR+G+B Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 20/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

Red:212,3,3(218)
Green:30,28,20(78)
Yellow:197,172,1(370)
White:214,227,241(682)
SkyBlue:157,190,211(585)

Clearly,bothskyblueandwhitehavethree
components'meanabove120.Otherthreecolors
sharethefeatureofaverylow'B'value.
Moreprecisely,becauseweuseequalweightsfor
RGBimage,R+G+Bcouldstandfortheiroverall
meanvalue.Withnodoubt,ifweneeddivideabove
fivenumberstotwomostdifferentgroupsinmean,
weshouldpickWhiteandSkyBlueinonegroup
andleavetheotherthreecolorstotheothergroup.
Thisisthereasonwhysinglephasecase,the
algorithmgroupedRed,GreenandYellowtoone
groupbutWhiteandSkybluetotheother.

Furthermore,intwophasecase,RedGreenand
Yellowhavemoresalientdifferencesintheirmean
valuesthanWhiteandSkyblue.SayRed,Greenand
YellowfirstinonegroupandWhiteandSkyBluein
theother,letseethecostfordistinguisheachofit.
Notethecloserdistancetotheaverage,thehigher
costis.

Average(Red+Green+Yellow)=222

R+G+Bdistancefromthe
average
Red:2184
Green:78144
Yellow:370148

Average(White+SkyBlue)=633.5

R+G+Bdistancefromthe
average
White:68248.5
SkyBlue:58548.5

Aswecanseehere,itcostlesstodistinguishGreen
andYellowoutofthe(Red+Green+Yellow)group
thantodistinguishWhiteorSkyBlue.

Note:theactualsituationmightnotbeexactlythe
same,becausetheactivecontourmightalsogeta
differentsegmentationasaresultofdifferentinitial
conditions.

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 21/22
20/02/2017 ASIMPLEINTRODUCTIONOFACTIVECONTOURWITHOUTEDGESRex'sTribeofImageProcessing

6.Reference

1.Chan,T.F.,&Vese,L.A.(2001).Activecontours
withoutedges.IEEETransactionsonImage
Processing,10(2),266277.

2.Chan,T.F.,&SandbergY.B(2000).Active
contourswithoutedgesforVectorvaluedImage.
JournalofVisualCommunicationandImage
Representation11,130141(2000)

3.Chan,T.F.,&Vese,L.A.(2002).AMultiphase
levelsetframeworkforimagesegmentationusing
theMumfordandShahmodel.International
JournalofComputerVision50(3),271293,(2002)

4.Kass,M.,Witkin,A.,&Terzopoulos,D.(1988).
Snakes:Activecontourmodels.International
JournalofComputerVision,1(4),321331.

5.J.A.Sethian,LevelSetMethodsandFast
MarchingMethods:EvolvingInterfacesin
ComputationalGeometry,FluidMechanics,
ComputerVision,andMaterialsScience
(Cambridge...onAppliedandComputational
Mathematics),CambridgeUniversityPress2
edition(1999)

6.MatlabHelp,MathworksInc.

7.http://www.wikipedia.com

8.ShawnLankton,ActiveContourMatlabCode
Demo,
http://www.shawnlankton.com/?s=active+contour

Commentaires

Lescommentairesonttdsactivsenraisond'uneerreurrseau.Veuillez
actualiserlapage.

Vousn'tespasautorisajouterdescommentaires.

Seconnecter | Activitsrcentessurlesite | Signalerunabus | Imprimerlapage | Aveclatechnologiede GoogleSites

Traduire
https://sites.google.com/site/rexstribeofimageprocessing/chanveseactivecontours/wubiaotitiezi 22/22

You might also like