Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Basedonaverysimpleidea:Findthe
thresholdthatminimizestheweighted
withinclassvariance.
Thisturnsouttobethesameasmaximizing
thebetweenclassvariance.
Operatesdirectlyonthegraylevel
histogram[e.g.256numbers,P(i)],soits
fast(oncethehistogramiscomputed).
Otsu:Assumptions
Histogram(andtheimage)arebimodal.
Nouseofspatialcoherence,noranyother
notionofobjectstructure.
Assumesstationarystatistics,butcanbe
modifiedtobelocallyadaptive.(exercises)
Assumesuniformillumination(implicitly),
sothebimodalbrightnessbehaviorarises
fromobjectappearancedifferencesonly.
Theweightedwithinclassvarianceis:
2
1
2
2
Wheretheclassprobabilitiesareestimatedas:
t
q1 (t) P(i)
q2 (t)
i 1
P(i)
i t 1
Andtheclassmeansaregivenby:
I
iP(i)
1 (t)
i 1 q1 (t)
iP(i)
2 (t)
i t 1 q2 (t )
Finally,theindividualclassvariancesare:
t
P(i)
(t) [i 1 (t)]
q1 (t)
i1
2
1
P(i)
(t) [i 2 (t)]
q2 (t)
i t 1
2
2
Now,wecouldactuallystophere.Allweneedtodoisjust
runthroughthefullrangeoftvalues[1,256]andpickthe
w2 (t)
valuethatminimizes.
Buttherelationshipbetweenthewithinclassandbetween
classvariancescanbeexploitedtogeneratearecursion
relationthatpermitsamuchfastercalculation.
Between/Within/TotalVariance
Thebookgivesthedetails,butthebasic
ideaisthatthetotalvariancedoesnot
dependonthreshold(obviously).
Foranygiventhreshold,thetotalvarianceis
thesumofthewithinclassvariances
(weighted)andthebetweenclassvariance,
whichisthesumofweightedsquared
distancesbetweentheclassmeansandthe
grandmean.
Aftersomealgebra,wecanexpressthetotalvarianceas...
2
w
Withinclass,
frombefore
2
Betweenclass, B (t)
Sincethetotalisconstantandindependentoft,theeffectof
changingthethresholdismerelytomovethecontributionsof
thetwotermsbackandforth.
So,minimizingthewithinclassvarianceisthesameas
maximizingthebetweenclassvariance.
Thenicethingaboutthisisthatwecancomputethequantities
2
inrecursivelyaswerunthroughtherangeoftvalues.
B (t)
Finally...
Initialization...
Recursion...
q1 (t 1) q1 (t) P(t 1)
q1 (t 1)1 (t 1)
2 (t 1)
1 q1 (t 1)