On the use of fuzzy sets in histogram equalization

On the use of fuzzy sets in histogram equalization

Fuzzy Sets and Systems 45 (1992) 271-278 North-Holland 271 On the use of fuzzy sets in histogram equalization M . Schneider and M . Craig Departm...

598KB Sizes 31 Downloads 81 Views



Fuzzy Sets and Systems 45 (1992) 271-278 North-Holland

271

On the use of fuzzy sets in histogram equalization M . Schneider and M . Craig Department of Computer Science, The Florida Institute of Technology, Melbourne, FL 32901-6988, USA Received April 1990 Revised July 1990 Abstract: The main objective of image enhancement is to generate a new image such that the new image is more suitable for an application than the original image . One of the methods for image enhancement is histogram equalization . In this paper, an algorithm for histogram equalization is presented, based on probability . Then a new algorithm based on fuzzy sets is presented . The new method, denoted by fuzzy histogram equalization (FHE), generates images which are sharper than the images produced by the classical approach of histogram equalization . Keywords : Fuzzy expected value ; weighted fuzzy expected value ; most typical value ; fuzzy sets ; histogram equalization : fuzzy histogram equalization ; distance function ; probability .

2 . The histogram equalization Let the variable g represent the gray level of a pixel in an image and let r be the mapping of g into the interval [0, 1] . Thus 0--r--1,

(1)

where 0 represent black and I represent white in the gray scale . We are interested in the transformation

1 . Introduction Enhancement techniques deal with the improvement of a given image for human or machine perception [1, 2] . There are several techniques for enhancement . In this paper we concentrate on image enhancement via histogram equalization . The definition above suggests that we want to improve the image . What does improvement mean? Does it mean to sharpen the image? Does it mean to smooth the image? Is it possible to utilize one technique that will satisfy all applications? It is our understanding that enhancement should generate distinct regions . The identification of distinct regions is part of autonomous pattern recognition . In other words, we want to generate an image which will display different configurations of gray levels so that the resulting image will be clearer and easier to work with (either in pattern recognition or any other application in image processing) . (1165-0114/92/$05 .(10 © 1992-Elsevier Science Publishers

The histogram equalization technique, as presented in the literature, is based on probability . This technique is described in Section 2. Then we introduce the fuzzy histogram equalization technique (FHE) . The FHE technique is based on the measure of typicality . First we describe the measure that is utilized by the FHE, and then proceed to describe the FHE algorithm .

n .V.

s = T (r)

(2)

which generates gray level s for every r in the image . The inverse transformation from s to r is denoted by r = T '(s) .

(3)

Now, let s=T(r)=

P(w)dw, 10

0--r_1 .

(4)

The right hand side of the equation denotes the cumulative distribution function [3 .4] . In order to implement (4) on a computer we convert it to a discrete form [5, 61 : nk P(rk)= n ,

O-- rk sl,k=Q l, . . .,L-l, (5)

where L is the number of gray levels, .) P,(, is the probability of the k-th gray level, n k is the All rights reserved



M . Schneider, M . Craig I Fuzzy sets in histogram equalization

272

Tab] level

rk

nk

P(rk)

0

0.00

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0.03 0.06 0.10 0.13 0.16 0.19 0.23 0.26 0.29 0.32 0.35 0.39 0.42 0.45 0.48

178 108 174 170 169 208 173 175 210 19 .5 161 172 161 149 139 114

0 .04 0 .03 0 .04 0 .04 0 .04 0 .05 0 .04 0 .04 0 .05 0 .05 0 .04 0 .04 0 .04 0 .04 0 .03 0 .03

- nkln

number of occurrences of k and n is the total number of pixels in the image . Thus, the discrete form of the histogram equalization is given by the relation

Level

rk

it,

P(rk)

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

0 .52 0 .55 0.58 0.61 0.65 0.68 0.71 0.74 0.77 0.81 0 .84 0.87 0.90 0.94 0 .97 1 .00

106 102 110 117 88 79 84 51 49 29 18 15 7 4 6 575

0 .03 0 .02 0.03 0.03 0.02 0 .02 0.02 0.01 0.01 0.01 0.00 000 0.(X) 0.00 0 .00 0.14

= nkIn

levels : so

=T(r„)_

" P,(r,) = P,(ro) = 0.04, 1

k

Sk = T(rk) =

Z

RI=

j° 0 n

.07, 51=T(ri)=>P(ri)=P(rn)+P,(rl)=0 J-0

k

>P(rl)r

(6) etc . But, since only 32 gray levels are available, we have to assign the new level to the closest existing gray level :

°0

where 0 _ rk 51 and k = 0, 1, . . . , L - 1.

Example . Assume we have a 64 x 64, 32 gray level image with the distribution given in Table 1 . Using (6), we evaluate the transformed gray

sn = 0.04 ~ 0.03, s, = 0 .07 0.06, etc . The histogram equalization method is shown in Figure 1 . The {D} indicate the original gray

Prabablllty 0 6 0 4 012 01 008 006 0 04 0 02 0 0

6

10

15

20

25

Gray Level Fig . 1 . Histogram equalization method .

30

35



M . Schneider, M . Craig / Fuzzy sets in histogram equalization

273

its function in constructing the algorithm for the fuzzy histogram equalization . In order to compute the weighted fuzzy expected value, we need to describe the fuzzy expected value . Finally we provide the algorithm for the fuzzy histogram equalization . 3. 1. Fuzzy sets Conventional set theory was designed to establish and utilize any possible systematic relations among the items within the same set as well as members of various sets . A set is defined as any number of definite, well distinguished objects (elements of the set) grouped together . Within the framework of classical set theory, a given object may be either a member of the set or completely excluded from the set . Let A be a set and let x be an item, then x EA

Fig . 2 . (a) Image of famous woman ; (b) after histogram equalization .

level distribution whereas the {*} indicate the equalized histogram . Close observation of the results shows that we were able to reduce the number of gray levels from 32 to 24 . Figure 2(a) is an original image (256 x 256) with 256 gray levels and Figure 2(b) shows the enhanced image of Figure 2(a) .

3 . The fuzzy histogram equalization The underlying philosophy behind the concept of fuzzy histogram equalization is the utilization of fuzzy sets [7, 8] . First we provide a formal definition of fuzzy sets and show how it can be used in histogram equalization . Then, we describe the weighted fuzzy expected value and

iff all membership requirements are satisfied completely . (7)

In the case of many real world problems, to classify data and knowledge based on classical set theory tends to lead to distortion in the interpretation of the data and the knowledge . In the real world, the transition from membership in one set to membership in another set is in most cases not abrupt, but gradual . This reality often leads to arbitrarly drawn boundaires among sets or subsets, if those sets are treated as being crisp . The problem is even more severe in those cases where the information available for the decision making process is extremely difficult to obtain in precise mathematical form due to the complexities involved . Therefore the decision must be made based on data containing some degree of error . The problems described above led to the development of fuzzy set theory . Fuzzy set theory differs from conventional set theory in one crucial concept : it allows each element of a given set to belong to that set to some degree . According to fuzzy set theory, an element can belong completely to the set, or be completely excluded from that set, or it can belong to that set to any intermediate degree between these extremes . The degree to which an element belongs to a given set is called its grade of membership . In mathematical terms, fuzzy set theory can be expressed as the following : if X is a collection



M. Schneider, M. Craig / Fuzzy sets in histogram equalization

274

(set) of objects denoted by x, then a fuzzy set in X is a set of ordered pairs : F= {(x, X F (x))

I

X E

X},

F

(8)

where XF (X) is the membership function of x in F which maps x to the membership space [0, 1] . We may utilize fuzzy sets in the following way : Let F be a fuzzy set `white color', and x be any gray level . Then we can assign membership grade to each gray level according to some membership function . In this paper we have chosen a simple membership function in the form XF(X)

=

L

,

(9)

where L is the total number of gray levels . Using (9) we can see that gray level 0 (black) has no membership in the fuzzy set F, gray level 25 has a 0 .78 degree of membership and the gray level 31 has the grade of membership of 1 . If we let N be the total number of pixels in the image, then F is a fuzzy set containing N pixels (members) each with its own grade of membership . 3.2. The

fuzzy

expected value

The fuzzy expected value (FEV) [10-14,1618], is meant to replace the mean value (arithmetic mean) and the median, in studying and treating fuzzy sets . Rather than calculating the `average' of a given set of numbers, we are interested in evaluating the most `representative' or `typical' value of that set, as a measure of general tendency . The original idea behind the FEV's definition was to present a new quantity that more than the mean value or the median, would indicate the most typical grade of membership of a given fuzzy set . Consider a fuzzy relation defined over the universe X. It yields a fuzzy set F with a membership function XF that satisfies 0--XF(X),1, Let

X E

X.

~r={xIXF(x)-T},

0ET ~- 1,

threshold and let t be a fuzzy measure defined over subsets of F,

(10)

be a subset which represents the number of elements in the set above or equal to some

- [number of elements x : XF (x)-T] µ(QT)

(11)

N

where N is the total number of elements in the set. The fuzzy expected value of X F, over F, is defined by FEV=- sup {min[T, P(QT)11, ocT~1

(12)

where T F (T) is the function of the threshold T. It can be shown that FEV is the intersection of the curves T and f, (T) . µ(4

) =

f

Example . Using Table 1, it is our intent to compute the FEV . First we have to assign grades of membership to each gray level . Using (9) we compute XF (x)=x/L=rk . Thus the first column in Table 2 represents the grade of membership for each gray level. n k is the number of pixels with the same gray levels which imply that they have the same membership grade (column 2) . The evaulation of column 3 in Table 2 is based on (10) . If we let T be the gray level at each level, then using (10) we get ~ 0 =4096, 4, = 4096 - 178 = 3918, etc . (column 3) . This column displays the number of pixels which are greater than or equal to a certain gray level . Observing the membership function as defined by (9), we can see that all pixels are at least dark Table 2 rk

nk

bT

µ(S7 )

r,

0.00 0.03 0.06 6.10 0.13 0.16 0 .19 0.23 0 .26 0.29 0.32 0.35 0.39 0.42 0.45 0.48

178 108 174 170 169 208 173 175 210 195 161 172 161 149 139 114

4096 3918 3810 3636 3466 3297 3089 2916 2741 2531 2336 2175 2003 1842 1693 1554

1 .00 0 .95 0 .93 0 .88 0 .84 0 .80 0 .75 0 .71 0 .67 0 .62 0 .57 0 .53 0 .49 0 .45 0.41 0 .38

0 .52 0 .55 0 .58 0 .61 0 .65 0 .68 0 .71 0 .74 0 .77 0 .81 0 .84 0.87 0.90 0.94 0.97 1 .00

nk

7T

P(9T)

106 102 110 117 88 79 84 51 49 29 18 15 7

1440 1334 1232 1122 1005 917 838 754 703 654 625 607 592

4

585

6 575

581 575

0.35 0.32 0.30 0.27 0.24 0.22 0 .20 0.18 0.17 0.16 0.15 0.15 0.14 0.14 0.14 0.14



M, Schneider, M . Craig / Fuzzy sets in histogram equalization

(have at least the gray level of 0), 3918 pixels have the lightness of at least 1 (i .e ., gray level 1) and only 575 pixels are totally white (gray level 31) . Column 4 represent the evaluation of (11) . Using (12), first we compute min(T, µ(Q,)) (i .e ., columns I and 4) . Then we compute the max over all the minima . The result is the FEV which in this case is 0 .42 (gray level 13) . The evaluation of the FEV is shown in Figure 3 . The intersection of the two curves is the FEV . It can be shown that in some cases, the FEV does not generate the best typical value . To overcome this deficiency, the weighted fuzzy expected value was developed . 3.3. Weighted fuzzy expected value

Our objective is to try and define the `most typical value' of a given membership function XF. We shall refer to this value as the `weighted fuzzy expected value' (WFEV) and start by formulating two principles by which we derive it . (1) Population effectiveness : Let A be some weight and n be a population . Then, A may affect the weight of the population by setting W(ni, A)=ni .

(13)

Assume we have two populations (n 1 = 10, X, = 0 .8 and n, = 2, X, = 0 .5) . Using the regular weighted average we get 10*0 .8+2*0 .5

weighted average such that, 10 2 *0 .8+2 2 *0 .5 -0 .79102 + 22 As can be seen, applying A as the weight, brings the typical value closer to the X, which corresponds to a larger population . Thus X measures the population's density effect on WFEV . By controlling X, we can control the weight of a certain population in the evaluation of the WFEV . (2) Distance from the mean value : Here the idea is to let the X's closer to the WFEV have greater weight than the ones on the extreme ends . Thus, the effect of this population on the WFEV should be a decreasing monotonic function . Let D(X,) be the distance function such that D(x,,0,s) = exp(- f3(IXi - sD)),

(1 4)

where /3 > 0 is some constant which determines the slope of D(xi , 0, s) and s is the most typical value . Using the above principles we can define the following : Definition . Let W(ni , A) and D(X„ /3, s) be non-negative monotonic functions defined over the interval [0, 11 . The solution s of m

E

= 0.75 .

275

X,D(X1, l1, s)W(ni, A)

S= (15)

10+2

E

Now, if we let k = 2, then we can change the

D(X„

0,

s)W(ni, A)

08 06 04

S

02 0+ 0

5

10

16

20

26

Gray Levels Fig . 3 . Evaluation of the FEV .

30



M . Schneider, M . Craig / Fuzzy sets in histogram equalization

276

is called the weighted fuzzy expected value and is denoted by WFEV [15] . Equation (15) which is a non-linear equation of the form x = F(x) is solved by a standard iteration method [9] : x„„ = F(x„ ), starting with x„=FEV . An accuracy of 10' is generally achieved after 3-4 iterations . In the next section we describe the fuzzy histogram equalization algorithm .

For example, if the WFEV indicates that the image is dark, then some of the gray level in the extreme light can be converged . By doing so, we enhance the image to be more suitable for image recognition .

3.4. The fuzzy histogram equalization algorithm The WFEV, if applied to gray level population, represent the most typical gray level . Let M be the typical gray level (corresponding to the WFEV) and si be any gray level . Then the distance measure between M and si is defined as s z l) trz Di=(IM2-

i=0,1, . .-,L-1 .

(16)

The new gray level gi ( for si < M) is computed by gi = max(0,

M - Di),

i = 0, 1, . . . , M - 1 . (17)

For gray levels greater than gi = min(L - 1,

M + D,),

M

we compute

i=M+1, . . .,L-1 . (18)

Finally, the gray level in the center of typicality is gM = M .

(19)

The reason for using the min/max operation in equations (17) and (18) is to ensure that the new gray level will not exceed the [0, . . . , L -1] range . The argument behind using the distance function and the WFEV to generate new grey levels is quite simple . Let s, and s ; he two gray levels such that gi =g; . In this case we may assume that the two gray levels were different because of noise or other distortions . Equations (17) and (18) were designed in such a way that only two types of convergence can take place : (1) gray levels which are far from the typical gray level, and (2) gray levels with negligible quantity . Thus the WFEV measures the brightness of the image and the distance measure converges gray levels which are far from the center of typicality .

Fig . 4 . (a) Image of girl . (b) After histogram equalization . (c) After FHE .



M, Schneider, M .

Craig /

Fuzzy sets in histogram equalization

277

-3-5. Some examples

Using the algorithm described above, we have generated some interesting results . Figure 4(a) is the original image' of a girl . Figure 4(b) is the same image after applying the histogram

Fig. 6 . Lighter image ; enhancement as Figure 4 .

Fig . 5 . Darker image ; enhancement as Figure 4 .

'The image is the property of Dr . ME . Valdez, who served as a Professor of Electrical Engineering and Computer Engineering at the Florida Institute of Technology .



278

M . Schneider, M. Craig / Fuzzy sets in histogram equalization

equalization technique . Figure 4(c) is the image after applying the fuzzy histogram equalization algorithm . Next, we took the original image and made it darker. The result is displayed in Figure 5 . Figure 5(a) is the original image, Figure 5(b) is the image after the histogram equalization is applied to it, and Figure 5(c) displays the girl after applying the fuzzy histogram equilization algorithm . Finally we took the original image and made it lighter . The result is shown in Figure 6 . Again, Figure 6(a) is the original image, Figure 6(b) is the image after applying the histogram equalization algorithm and Figure 6(c) is the image after applying the fuzzy histogram equalization algorithm .

4 . Conclusion

In spite of the fact that the fuzzy histogram equalization algorithm requires more computations, it has several advantages . First, it generates less gray levels, thus creates a sharper image . Second, it does not have the tendency to become lighter . On the contrary, it generates less gray levels over a larger spectrum of gray levels . These two characteristics are very important in edge detection and thus can be applicable to pattern recognition . In other words, since much of pattern recognition techniques are based on edge detection, and since we can generate a sharper image to detect edges, it is clear that the new technique should generate better results than the regular histogram equalization algorithm.

References [11 R.C . Gonzalez and P . Wintz, Digital Image Processing (Addison-Wesley, Reading, MA, 1987) . [2] R.C . Gonzalez and B .A . Fittes, Gray-level transformation for interactive image enhancement, Mech . Mach . Theory 12 (1977) 145-122 . [3] E .L . Hall, Almost uniform distribution for computer image enhancement, IEEE Trans . Comput. 23 (1974) 207 . [4] E .L . Hall, Computer Image Processing and Recognition (Academic Press, New York, 1979) . [5] R.A . Hummel, Histogram modification techniques, Technical Report TR-329, F-44620-7200062, Computer Science Center, University of Maryland (1974) . [6] A . Rosenfeld and A .C . Kak, Digital Picture Processing (Academic Press, New York, 1982) . [71 L .A . Zadeh, Fuzzy sets, Inform and Control 8 (1965) 338-353 . [8] H . Zimmermann, Fuzzy Set Theory -and its Applicadons (Kluwer-Nijhoff, Dordrecht-Boston, 1985) . [9] P . Henrici, Elements of Numerical Analysis (Wiley, New York, 1964) . [10] A . Kandel, Fuzzy Techniques in Pattern Recognition (Wiley, New York, 1982) . [11] A . Kandel and W .1 . Byatt, Fuzzy sets, fuzzy algebra, and fuzzy statistics, Proc . IEEE 66 (1978) 1619-1639 . [121 A . Kandel, Fuzzy statistics and forecast evaluation, IEEE Tans . Systems Man Cybernet . 8 (1978) 39(-401 . [13] A . Kandel, Fuzzy expectation and energy states in fuzzy media, Fuzzy Sets and Systems (1981) 145-160 . [141 E .P . Klement and D . Ralescu, Nonlinearity of fuzzy integral (short communication), Fuzzy Sets and Systems 11 (1983) 309-316 . [15] M . Friedman, M . Schneider and A . Kandel, The use of weighted fuzzy expected value (WFEV) in fuzzy expert systems, Fuzzy Sets and Systems 31 (1989) 37-45 . [16] M . Schneider and A . Kandel, Cooperating Fuzzy Expert Systems-Their Design and Applications in Intelligent Recognition (Verlag TUV Rheinland, Koln, Germany, 1988) . [17] M . Schneider and A . Kandcl, Properties of the fuzzy expected value and the fuzzy expected interval, Fuzzy Sets and Systems 26 (1988) 373-385 . [181 M . Schneider and A . Kandel, Properties of the fuzzy expected value and the fuzzy expected interval in fuzzy environment, Fuzzy Sets and Systems 28 (1988) 55-68 .