You are on page 1of 6

Pattern Recognition, Vol. 25, No. 8, pp.

803-808, 1992
Printed in Gr eat Britain
0031-3203/92 $5.00 + .00
Pergamon Press Ltd
1992 Pattern Recognition Society
THRES HOL DI NG OF DI GI TAL IMAGES USING TWO-
DI MENSI ONAL ENTROPIES
A. D. BRINK
Department of Computational and Applied Mathematics, University of the Witwatersrand,
Johannesburg 2050, South Africa
(Received 18 April 1991; in revised form 30 September 1991; received for publication 1 l December 1991)
Abstraet--Thresholding is an important form of image segmentation and is a first step in the processing
of images for many applications. The selection of suitable thresholds is ideally an automatic process,
requiring the use of some criterion on which to base the selection. One such criterion is the maximization
of the information theoretic entropy of the resulting background and object probability distributions.
Most processes using this concept have made use of the one-dimensional (1D) grey-level histogram of
the image. In an effort to use more of the information available in the image, the present approach
evaluates two-dimensional (2D) entropies based on the 2D (grey-level/local average grey-level) "his-
togram" or scatterplot. The 2D threshold vector that maximizes both background and object class
entropies is selected.
Thresholding Entropy Segmentation
1. I N TR ODUC TI ON
Thr es hol di ng is an i mpor t a nt f or m of i mage seg-
me nt a t i on whe r e one wi shes t o i dent i f y and ext r act
obj e c t r egi ons f r om t hei r ba c kgr ound on t he basi s of
di ffer i ng br i ght nes s or gr ey l evel s. Ma ny me t hods
for t he a ut oma t i c s el ect i on of t hr es hol ds have be e n
proposed.C1,2) Mos t of t hes e me t hods bas e t hei r sel ec-
t i on on t he opt i mi za t i on of s ome t hr e s hol d- de pe n-
dent c r i t e r i on f unct i on whi ch is s ome how r e l a t e d t o
t he i mage and i t s pr ope r t i e s .
One useful f unct i on is t he e nt r opy me a s ur e f r om
i nf or mat i on t heor y. Ge n e r a l l y t he me t hods ma ki ng
use of t hi s f unct i on have f ol l owed a one - di me ns i ona l
(1D) a ppr oa c h ba s e d on t he e nt r opy of t he i mage (o,ol
gr ey- l evel hi s t ogr am. The ai m is t o s e pa r a t e t he a
pr i or i pr oba bi l i t y di s t r i but i on ( hi s t ogr am) i nt o t wo
i nde pe nde nt cl ass di s t r i but i ons by me a ns of a
t hr es hol d whi ch is s el ect ed in such a wa y t hat t he
ent r opi es of bot h di s t r i but i ons , a nd hence t hei r i nfor -
mat i on c ont e nt , a r e maxi mi zed. The me t hod of
Ka pur et al . (3) is t ypi cal of t hi s a ppr oa c h.
By usi ng onl y t he gr ey- l evel hi s t ogr a m much i nfor -
mat i on c ont a i ne d i n t he i ma ge is l ost whi ch, i f us ed, 5"
coul d r esul t in a much be t t e r s e gme nt a t i on. Two-
di mens i onal ( 2D) e nt r opi c t echni ques usi ng l ocal
ne i ghbour hood as wel l as poi nt pi xel i nf or mat i on
have been p r o p o s e d f or t hi s r eas on. Abut a l e b (a)
makes use of t he 2D ( gr e y- l e ve l / l oc a l aver age gr ey-
l evel ) "hi s t ogr a m" or s c a t t e r pi ot . Pal and Pal (5) have
used a gr ey- l evel co- occur r ence mat r i x. It shoul d be j
not ed t hat whi l e t he l a t t e r me t ho d st i l l sel ect s a
si ngl e- val ued ( es s ent i al l y 1D) t hr e s hol d, use of t he
2D hi s t ogr am r esul t s i n a 2D t hr e s hol d vect or , a
poi nt c oor di na t e i n 2D ( gr ey- l evel / l ocal a ve r a ge )
space.
In t he p r o p o s e d t e c hni que use is agai n . made of t he
2D hi st ogr am. The 2D e nt r opi e s of t he di s t r i but i ons
r esul t i ng f r om each t hr e s hol d pa i r a r e e va l ua t e d and
t he i mage is t hr e s hol de d at t he poi nt whi ch mos t
near l y maxi mi zes bot h t he ba c kgr ound and t he ob-
j ect class e nt r opi e s , usi ng a "ma xi mi n" opt i mi zat i on
pr ocedur e.
In Sect i on 2 t he 2D e nt r opi e s ar e defi ned. In
Sect i on 3 t he me t ho d p r o p o s e d by Abut a l e b (4) is
out l i ned and t he new t echni que is des cr i bed. Sect i on
7 "
/
( n - I , n - I )
Fig. 1. Quadrants in the 2D histogram resulting from
thresholding at (T, S).
803
804 A. D. BRINK
4 cont ai ns r epr es ent at i ve resul t s, di scussi on and con-
clusions.
2. TWO- DIMENSIONAL ENTROPIES
Each bi n of t he 2D hi s t ogr am is r el at ed t o t he
fr equency of occur r ence of each (gr ey- l evel , local
aver age) pai r. The s e bi ns f or m a sur face wi t h i deal l y
t wo pe a ks cor r es pondi ng t o ba c kgr ound and obj ect
regi ons. The bul k of t he hi s t ogr am, i ncl udi ng t he
peaks, lies on or ne a r t he l eadi ng di agonal of t he
scat t er pl ot , off- di agonal bi ns bei ng cont r i but ed by
edges and noi se in t he i mage. For an n grey-l evel
i mage t her e ar e obvi ousl y n 2 bins.
The a pr i or i pr obabi l i t y pq of a pai r (i, j ) is gi ven
by t he t ot al n umbe r of occur r ences of t he pai r , Aj,
di vi ded by t he t ot al n umbe r of pi xel s, N M (for an
i mage of size N x M)
Pi j = f i j / N M , i and j = 0 . . . . . n - 1. (1)
The t ot al e nt r opy f or t he 2D hi s t ogr am is gi ven by
n - l n - 1
H t = - ~ ~ , Pi j l ogpq. (2)
j = 0 i = 0
By means of t wo t hr eshol ds S and T t he hi st ogr am
is di vi ded i nt o f our quadr ant s (Fig. 1).
Since t he s haded quadr ant s of Fig. 1 will in gener al
cont ai n i nf or mat i on onl y a bout edges and noi se t hey
(a)
(b) (c)
Fig. 2. (a) Clean video image of a dog, (b) result of thresholding with H0 + H1, (c) result of thresholding
using maximin.
Thresholding of digital images 805
are i gnor ed in t he cal cul at i on. The quadr ant s 0 and
1 cont ai n t he di st ri but i ons cor r espondi ng t o t he back-
gr ound and obj ect classes. As t hey are t o be r egar ded
as i ndependent di st ri but i ons, t he probabi l i t y values
in each class must be nor mal i zed using t he a pos-
teriori class probabi l i t i es
$ T
P0(T, S) = ~ ~ Pij (3)
j=0i~0
n - 1 n - I
P~(T, S) = ~ ~, Pii (4)
j = S+l i = T +I
in or der t hat each has uni t t ot al probabi l i t y. The
class ent ropi es are t hus defi ned as
s T
H o ( T , S) = _ X f , xf, Pij , Pij
j---'0 i70 P0(T, S) l og P 0 - - ~ , S) (5)
n - l n - 1
~ , Pij , Pij
n0(T, s ) = -s+~ ~" W~P~(T, s),og~). ( 6 )
It shoul d be not ed t hat Abutaleb(*) appr oxi mat es
PI(T , S) as
PI(T, S) = 1 - t0(T, S) (7)
based on t he assumpt i on t hat in general t he con-
t ri but i on f r om t he shaded quadr ant s is negligible.
(a)
(b) (c)
Fig. 3. (a) Infra-red image of a road, (b) result of thresholding with H0 + Hi, (c) result of thresholding
using maximin.
806 A. D. BRINK
Whi l e this is t r ue f or t hr es hol ds lying on or ne a r t he
di agonal , t he as s umpt i on is not val i d f or t hr eshol ds
far of f t he di agonal .
3. THRESHOLDING METHODS
3.1. Maximization of total entropy
Abut a l e b, t4J fol l owi ng t he t echni que of Ka p ur et
al.,(3) defi nes an ent r opi c cr i t er i on funct i on
~p(T,S) = Ho(T, S) + HI(T, S) (8)
wher e Ho(T, S) and HI(T, S) ar e gi ven by equat i ons
(5) and (6). Thi s me t hod has been t est ed usi ng bot h
Abut a l e b' s appr oxi mat i on (7) f or PI(T, S) and t he
correct f or mul a (4). The resul t s obt ai ned gener al l y
di ffer significantly, wi t h equat i on (4) yi el di ng t he
bet t er resul t al t hough t he comput at i onal t i me is
slightly l onger.
3.2. Maximization of class entropies
The pr es ent me t hod a t t e mpt s by me a ns of a single
t hr eshol d vect or t o maxi mi ze bot h Ho(T, S) and
HI(T, S). It is cl ear t hat , unl ess t hei r ma xi ma happen
t o coi nci de, such a sel ect i on i nvol ves a t r ade- off.
When deal i ng wi t h t wo funct i ons in this way, t he
maxi mi n pr oc e dur e f r om opt i mi zat i on t heor y can be
used. In this case t he pr ocess i nvol ves finding a
( a)
(b) (c)
Fig. 4. (a) Aerial photograph of farmland, (b) result of thresholding with H0 + HI, (c) result of
thresholding using maximin.
Thresholding of digital images 807
t hreshol d vect or (3, o) whi ch maxi mi zes t he smaller
value of Ho(T, S) and Hi(T, S), t hat is
H( ~, o ) = max / mi n {Ho(T,S),HI(T,S)}" L
T = O . . . n - l [ T = O . . . n - I
I
S~ O . . . n - l k S= O . . . n - 1
(9)
This t hreshol d vect or is sel ect ed t o per f or m t he seg-
ment at i on.
4 . R ES UL TS
Some r epr esent at i ve results appear in Figs 2- 5,
t oget her with t he cor r espondi ng results f or t he stand-
ard met hod out l i ned in Sect i on 3.1 above for corn-
parison. The bl ack and whi t e regi ons in t hese results
cor r espond t o t he quadr ant s 0 and 1 in Fig. 1, while
t he grey areas are due t o t he unclassified pixels in
t he off-di agonal quadr ant s.
5 . DI S C US S I ON
Based on a subject i ve eval uat i on of t he "r ecog-
nizability" of t he resulting bi nary i mages, t he new
appr oach using t he maxi mi n of t he class ent ropi es
per for ms bet t er on most of t he i mages t est ed. How-
ever, it shoul d be poi nt ed out t hat no single met hod
can pr oduce results universally accept abl e for all
applications or i mage t ypes and hence for some
~ ~ ? 5 i
( a)
(b) (c)
Fig. 5. (a) Low contrast video image of part of a printed page, (b) result of thresholding with H0 + H1,
(c) result of thresholding using maximin.
808 A. D. BRINK
processes t he maxi mi zed sum of t he ent ropi es may
yield a mor e useful result, as in t he i nfra-red i mage
of Fig. 3, for exampl e.
The remai ni ng unclassified pixels can be assigned
t o 0 or 1 in several ways. Usual l y t hese are simply
assigned using t he grey-l evel t hr eshol d T onl y. A
mor e el abor at e scheme coul d be used wher eby each
of t he unclassified quadr ant s is also t hr eshol ded using
this t echni que. Thi s process is r epeat ed until no
unclassified pixels remai n.
The t echni que coul d be ext ended t o multi-
t hreshol di ng by r egar di ng each of t he t wo classes
pr oduced by bi nary t hreshol di ng as an i ndependent
distribution. These can each be bi nari zed using t he
same appr oach, resulting in a four-class i mage. The
splitting can be cont i nued as far as desi red, al t hough
i nfor mat i on is lost in t he unused quadr ant s at each
stage. However , t hese quadr ant s can be used and
r egar ded as classes in t hei r own ri ght ("light edge"
and "dar k edge", f or exampl e).
6. S UMMAR Y
An ent r opi c t hr eshol d sel ect i on t echni que using
t he 2D (grey-l evel / l ocal aver age grey-level) scat-
t erpl ot is descri bed.
A t hreshol d vect or (T, S) divides t he scat t erpl ot
i nt o four quadr ant s, t wo of whi ch cont ai n mai nl y
edge and noise i nfor mat i on. The ot her t wo quadr ant s
0 and 1, cor r espond t o t he classes "backgr ound" and
"obj ect ". The 2D ent r opi es of t hese classes are given
by
S T
Ho(T, S) =-____~. ~, ~ . Pii
i=0 i=0 Po(T, S) l og ~ S)
n - 1 n - I
s~ + Pi/ pq
~" PI(T,S-----~Igp1(T,S)
H I(T , S) = -j =
1 I = T+ I
where Po(T, S) and PI(T, S) are t he a post eri ori class
probabilities.
A t hreshol d (r, a) is sel ect ed such t hat t hese class
ent ropi es are maxi mi zed. Thi s involves finding t he
maximin of t he ent r opi es by i t erat i on:
/ -t ( r , o )
= max / mi n {H0 ( T, S) , HI( T, S) }~.
T = O . . . n - 1 ~ T= 0 , , , n - 1
1
S = 0 . . . n - 1 \ S= O . . . n - 1
Subjectively t he results obt ai ned are encouragi ng.
As this is a gl obal t echni que, pr obl ems such as
uneven illumination can result in less t han opt i mum
segment at i on. However , t he use of a 2D scat t erpl ot
does lead t o bet t er results t han t hose obt ai nabl e
using onl y t he hi st ogram.
R EFER EN C ES
1. R. M. Haralick and L. G. Shapiro, Image segmentation
techniques, Comput. Vision Graphics Image Process.
29, 100-132 (1985).
2. P. K. Sahoo, S. Soltani, A. K. C. Wong and Y. Chen,
A survey of thresholding techniques, Comput. Vision
Graphics Image Process. 41,233-260 (1988).
3. J. N. Kapur, P. K. Sahoo and A. K. C. Wong, A new
method for grey-level picture thresholding using the
entropy of the histogram, Comput. Vision Graphics
Image Process. 29, 273-285 (1985).
4. A. S. Abutaleb, Automatic thresholding of grey-level
pictures using two-dimensional entropy, Comput. Vision
Graphics Image Process. 47, 22-32 (1989).
5. N. R. Pal and S. K. Pal, Entropic thresholding, Signal
Process. 16, 97-108 (1989).
Abo ut the AUthOr---ANTON BRINK received B.Sc. and Honours degrees in physics and electronics and
an M.Sc. degree in image processing from Rhodes University in 1983, 1984 and 1986, respectively. He
is currently employed as a Junior Lecturer in the Department of Computational and Applied Mathematics
at the University of the Witwatersrand while studying for a Ph.D. degree in image segmentation.