(IJCSIS) International Journal of Computer Siene and Information Seurity, Vol. 6, No. 3, 2009 The Appliation of Mamdani Fuzzy Model for Auto Funtion of a Digital Camera * I. Elamvazuthi, P. Vasant Universiti Tehnologi PETRONAS Tronoh, Malaysia J.Webb University of Tehnology Swinnburne, Sarawak Campus, Kuhing, Sarawak, Malaysia Abstrat Mamdani Fuzzy Model is an important tehnique in Computational Intelligene (CI) study. This paper presents an implementation of a supervised learning method based on membership funtion training in the ontext of Mamdani fuzzy models. Speifially, auto zoom funtion of a digital amera is modelled using Mamdani tehnique. The performane of ontrol method is verified through a series of simulation and numerial results are provided as illustrations. Keywords-omponent: Mamdani fuzzy model, fuzzy logi, auto zoom, digital amera I. INTRODUCTION The adoption and adaptation of digital signal proessing tehnology in onsumer digital ameras has improved the performane of automati adjustments inluding auto faus (AF), auto exposure (AE) and zoom traking, whih are important features for high image quality, under various shot onditions [1]. In a digital amera, optial parameters suh as zoom, fous and aperture, are usually motor (omputer) ontrolled [2]. The zoom traking is the ontinuous adjustment of a amera s foal length, to keep in-fous state of amera image during zoom operation. Without zoom traking operation, a amera system annot maintain in-fous state during zooming. Some onventional zoom traking tehniques were implemented using urve trae stored in a look-up table [3]- [6]. The simple look-up table method, however, requires a large system memory. Moreover, it is diffiult to selet a proper urve when the zoom lens moves toward the tele-angle. There are several methods that determine the variations of the intrinsi parameters developed in the literature. Reently, some researh has been onduted by the employment of neural networks [7]. Nevertheless, this method is too omplex to be used and require a lot of training data whih might not be always available. The simplest modeling tehnique is to measure the intrinsi parameters using a standard offline alibration tehnique at several zoom and fous settings and store the data in a look-up table [8]. This leads unfortunately to a large memory requirement espeially when a preise model is needed. A novel tehnique using moving least-squares approah to model the variation of the amera internal parameters as a funtion of fous and zoom was proposed by [9]. Compared to a previous tehnique using a global least-squares regression sheme with bivariate polynomial funtions, the new method resulted in redution of the mean estimation error. System Modelling based on onventional mathematial tools (e.g., differential equations) is not well suited for dealing with ill-defined and unertain systems. By ontrast, a fuzzy system employing fuzzy if- rules an model the qualitative aspets of human knowledge and reasoning proesses without employing preise quantitative analysis [10]. Inreasingly, fuzzy system as a promising Computational Intelligene tehnique has found many industrial appliations. Different fuzzy models have been developed, and suessfully applied suh as Mamdani model and Sugeno model. There is not a universally best fuzzy model, but eah model or may have its suitable types of appliation. So how to automatially hoose an appropriate fuzzy model or for a speifi appliation is always important and sometimes diffiult [11]. Interest has been shown reently in the appliations in the fields of image reognition, espeially for image zooming. Image zooming involves the adjustment of a amera s foal length to keep in-fous state of amera image during zooming operation. It is well known that there are two types of zooming operations, i.e., optial and digital zoom. Many ompat digital ameras an perform both an optial and a digital zoom. A amera performs an optial zoom by moving the zoom lens so that it inreases the magnifiation of light before it even reahes the digital sensor. In ontrast, a digital zoom degrades quality by simply interpolating the image- after it has been aquired at the sensor [12]-[14]. Digital Camera involves the zooming funtion whih allows us to fous our target image in variety of distane. Generally, the determination of zoom in (+nx) and zoom out (-nx) is proportional to the distane between the digital amera and the objet that want to apture. In this paper, the auto image zooming that was implemented by using Mamdani fuzzy model is desribed where rules are derived from multiple knowledge soures suh as previously published databases and models, existing literature, intuition and soliitation of expert opinion to verify the gathered information. This paper is not onerned with theoretial disussion of digital amera zooming funtions, rather, it onentrates on the appliation Mamdani fuzzy model in the zooming funtions of digital amera. Preliminary results of this study were published in CIM onferene proeedings [15]. 244 http://sites.google.om/site/ijsis/
The rest of paper is organized as follows. A brief introdution to the onepts related to zooming funtions of a digital amera is presented in Setion II. Setion III desribes the theoretial aspets of fuzzy system by disussing the philosophy and development of fuzzy logi, fuzzy model and proposed algorithm. Setion IV provides the results and disussion and lastly, onlusions are given in setion V. II. ZOOM TRACKING ALGORITHM In some onventional look-up table zoom traking methods, the ontrol iruit omprises of a miroproessor equipped with read only memory (ROM) that stores data urves for various foal distanes. When the zoom lens is shifted for exeuting a zooming operation, the fousing lens is orrespondingly shifted along the proper trae urve. Sine the ROM annot store the trae data for many distanes due to limitations of its memory size, the traes between the stored traes are estimated using the following equation [16]: d s d = D (1) Ds where D s is the differene between the fous positions of the upper and lower traes, and d s is differene between the fous positions of the estimated and the lower trae at the zoom start point of Fig. 1. D is the differene between the fous positions of the upper and the lower traes, and d is the differene between the fous positions of the estimated and the lower trae at the urrent zoom point. As the zoom lens is shifted, the fousing lens traks the trae stored or estimated. loser to human reasoning and the real world than formal logi. Fuzzy logi was introdued by Zadeh in [17] and used by Mamdani to ontrol the dynami system in [18]. Sine, fuzzy logi has been suessfully applied to many appliations for automati ontrol (espeially for non-linear ill-defined systems) [19-21]. The onept of fuzzy set is a lass with unsharp boundaries. It provides a basis for a qualitative approah to the analysis of omplex systems in whih linguisti rather than numerial variables are employed to desribe system behaviour and performane. Thus, in this work, fuzzy ontroller to inorporation of fuzzy tehniques into the auto image zooming to ahieve the automati ontrol during zooming funtion is proposed. B. Model Desription Fuzzy logi algorithms have been widely used in many ontrol appliations. Unlike a onventional proportionalintegral-derivative (PID) ontroller, the FLC an ahieve the goals of steady output and satisfatory transient performane simultaneously. However, hoies of rule sets and membership funtions signifiantly affet ahieving these performane goals [22]. Two well-known Fuzzy rule-based Inferene System are Mamdani fuzzy method and Tagaki- Sugeno (T-S) fuzzy method [23]. Advantages of the Mamdani fuzzy inferene system are it s intuitive, has widespread aeptane and well suited to human ognition [24-26]. The T- S fuzzy inferene system works well with linear tehniques and guarantees ontinuity of the output surfae [27-28]. But the T-S fuzzy inferene system has diffiulties in dealing with the multi-parameter syntheti evaluation; it has diffiulties in assigning weight to eah input and fuzzy rules. Mamdani model an show its legibility and understandability to the laypeople. The Mamdani fuzzy inferene system shows its advantage in output expression and is used in this projet. Fuzzy logi starts with the onept of a fuzzy set. A fuzzy set is a set without a risp, learly defined boundary. It an ontain elements with only a partial degree of membership [28]. A fuzzy set is defined by the expression below: D = {( x, μ ( x)) Ix X, μ ( x) [0,1]} (2) D D Figure 1. Conventional zoom traking algorithm [15] However, if the lens position sensors do not have suffiient resolution aurate estimation urve traes are not aquired. This results in bad fousing. The de-fousing gradually inreases as the zoom lens moves toward the teleend. For better estimation more aquired data is needed thus inreasing ROM size. III. FUZZY LOGIC A. Philosophy and Development of Fuzzy Logi Human reasoning is fuzzy, or approximate, and so is the real world. Fuzzy logi is the logi underlying modes of reasoning whih are approximate rather than exat, thus it is where X represents the universal set, x is an element of X, D is a fuzzy subset in X and μ D (x) is the membership funtion of fuzzy set D. Degree of membership for any set ranges from 0 to 1. A value of 1.0 represents a 100% membership while a value of 0 means 0% membership. If there are 5 subgroups of size, 5 membership funtions are required to express the size values in fuzzy rules. A membership funtion is a urve that defines how eah point in the input spae is mapped to a membership value (or degree of membership) between 0 and 1. The input spae is sometimes referred to as the universe of disourse [29]. The membership funtions are usually defined for input and output variables. There are some forms of membership funtions suh as triangular, trapezoidal, Gaussian distribution and others. In this study, triangular and trapezoidal 245 http://sites.google.om/site/ijsis/
membership funtions were seleted for input and output variables. The triangular membership funtion is a funtion of a vetor, x, and depends on three salar parameters, a, b, and, as given by an example in Fig. 2: 0 x a x a a x b b a Norm f ( x; a, b) = μ x x Risk ( = (3) b x b x + 0.8 x 0.2 z* The formula for mean of maximum (MOM) is given as. μ( z) zdz μ ( z) dz = (6) for membership funtion defined as 1 ( z) = 0 μ( z) = max otherwise μ. C. Proposed Algorithm The objetive of the proposed algorithm is to zooming funtion of a digital amera based on the input given as distane. Shown in Fig. 3 is a blok diagram of the proposed algorithm, whih inludes a fuzzifiation blok, a knowledgebase, a fuzzy inferene engine and a defuzzifiation blok. Input (Distane) Figure 2. Shemati of triangular membership funtion Fuzzy sets and fuzzy operators are the subjets and verbs of fuzzy logi. These if- rule statements are used to formulate the onditional statements that omprise fuzzy logi. A single fuzzy if- rule assumes the form. Knowledge Base Fuzzifiation Inferene Defuzzifiation Output () IF x is A THEN y is B (4) where, A and B are linguisti values defined by fuzzy sets on the ranges (universe of disourse) X and Y, respetively. The if- part of the rule x is A is alled the anteedent or premise, while the -part of the rule y is B is alled the onsequent or onlusion [28]. During data proessing, fuzzy system fuzzifies the risp data, applies the mamdani inferene system using the fuzzy rules and finally, determines the zooming funtion of the amera through defuzzifiation. Defuzzifiation has some methods suh as enter of gravity (entroid (COG)), mean of maximum (MOM), and first of maximum (FOM), and so on. Center of gravity is the most popular and the most preision method for defuzzifiation that was used. Center of gravity method is a grade weighted by the areas under the aggregated output funtions. The formula for Centroid is given as. μ( z) zdz z* = (5) μ ( z) dz where, μ ( z) dz 0 for all μ i. Figure 3. Fuzzy system for auto image zooming From Fig. 3, it an be seen that the input is distane and output is zoom. The proposed algorithm onsists of three steps: fuzzifiation, fuzzy rules, and defuzzifiation. Step 1: Fuzzifiation. In order to keep the number of fuzzy rules at a reasonable level, input an be defined as fuzzy set Distane with five membership funtions known as Too Near, Near, Medium, Far, Too Far. For the output, fuzzy set with five membership funtions suh as Max Out, Min Out, Default, Min In, and Max In were defined. Step 2: Fuzzy Rules In this step, we use the linguisti quantifiation to speify a set of rules that aptures the expert s knowledge about how to ontrol the output. For example: If Distane is Too Near is Maximize Out. Step 3: Defuzzifiation Any suitable defuzzifiation method an be used to defuzzify the output variable. The inputs for fuzzy system that introdued in this study were distane that is risp. Initially, fuzzy system fuzzifies the risp data and with mamdani inferene system applies the fuzzy rules; finally, determines the zooming funtion. 246 http://sites.google.om/site/ijsis/
The DISTANCE fuzzy set and ZOOM fuzzy set is given in Table I and II respetively. TABLE I DISTANCE FUZZY SET Distan Too Near Mediu Far Too Far e (m) Near m 0 Y* N N N N 4 Y N N N N 5 N Y N N N 10 N Y* N N N 12 N N Y* N N 15 N N Y N N 20 N N Y N N 25 N N N Y N 30 N N N Y* N 35 N N N Y N 40 N N N Y N 45 N N N N Y 50 N N N N Y* Figure 4. Membership funtions of Distane TABLE II ZOOM FUZZY SET (nx) Max Out Min Out Default Min In Max In -10 Y N N N N -8 Y* N N N N -6 N Y N N N -4 N Y N N N -2 N Y* N N N 0 N N Y* N N 2 N N Y Y* N 4 N N N N N 6 N N N N N 8 N N N N Y* 10 N N N N Y Example rules that define the five different zooming funtion based on five different distane input are given in Table III. TABLE III RULES FOR ZOOMING FUNCTION Rule Input Output R1 If Distane is Too Near is Maximize Out R2 If Distane is Near R3 If Distane is Medium R4 If If Distane is Far R5 If If Distane is Too Far is Minimize Out is Default is Minimize In is Maximize In IV. RESULTS AND DISCUSSION To establish the grade membership, the distane is used as input and the zoom is used as output. Fig. 4 and 5 illustrates the membership funtion of the input and output variables. Figure 5. Membership funtions of The fuzzifiation of the risp distane gives the following membership for the Distane Fuzzy set as shown in Table IV. TABLE IV FUZZIFICATION OF DISTANCE µtoo Near µnea r µmediu m µfar µtoo Far Distane 0 0 0.24 0.2 0 = 22 m Fire Rule no no yes yes no The Inferene yielded DEFAULT x MEDIUM and MINIMUM ZOOM IN x FAR. During omposition, The MEDIUM and FAR sets have an output of 0.24 and 0.2 respetively as shown in Table IV. By applying R4: If Distane is Far is Minimize In and R3: If Distane is Medium is Default, the output of fuzzy system an be seen in Fig. 6. Figure 6. Composition Defuzzifiation is the result of the fuzzy logi. Its primary goal is to onvert the fuzzy value (an average) to a single number, a risp value. There are many ways an be used to ahieve defuzzifation and in this work, the Center of Area method yielded an answer of 1.7X. The data obtained from 247 http://sites.google.om/site/ijsis/
The data from Fig. 6 is diksplayed in Table V and Table VI for defuzzifiation using COA and MOM methods respetively. TABLE V DATA AFTER COMPOSITION FOR COA Default Minimum In Output of 2 Rules Weighted Perentage -2 0 0 0 0-1.5 0.24 0 0.24-0.45-1 0.24 0 0.24-0.3 0 0.24 0 0.24 0 1 0.24 0.2 0.24 0.3 1.5 0.24 0.2 0.24 0.45 1.6 0.24 0.2 0.24 0.32 2 0 0.2 0.2 0.4 3 0 0.2 0.2 0.6 4 0 0.2 0.2 0.8 5 0 0.2 0.2 1 5.2 0 0.2 0.2 1.04 6 0 0 0 0 SUM 2.4 4.16 TABLE VI DATA AFTER COMPOSITION FOR MOM Default Minimum In Output of 2 Rules Weighted Perentage -1.5 0.24 0 0.24-0.45-1 0.24 0 0.24-0.3 0 0.24 0 0.24 0 1 0.24 0.2 0.24 0.3 1.5 0.24 0.2 0.24 0.45 1.6 0.24 0.2 0.24 0.32 SUM 1.44 0.32 Defuzzifiation using COA method shows that the omputation leads to a SINGLE VALUE for the size, whih is an average value omputed with respet to the entre of gravity of the output fuzzy set: 4.16/2.44 = 1.7. Defuzzifiation using MOM method shows that the omputation leads to a SINGLE VALUE for the size, whih is the output fuzzy set: 0.32/1.44 = 0.22. The differene between these two methods is too big. Simulation results show that this is true for different set of values. It an be dedued that the use of entre of area method produes more aurate results ompared to the mean of maxima method. V. CONCLUSION In the study, the auto image zooming funtion has been enhaned using Mamdani fuzzy model. We restrited our study to the ase of ontrolling the zoom funtion using distane as input. The performane of our algorithm is quite good beause it is apable of disriminating the zoom funtions based on distane. However, our simulations show that some improvements and extensions an be made to our approah. In future, advaned parameter initialization methods and learning algorithms suh as geneti algorithm, partile swarm optimization an be applied in improving the performane of zooming funtion. ACKNOWLEDGMENT The authors would like top thank Universiti Teknologi PETRONAS and University of Tehnology Swinburne, Sarawak Campus, Kuhing, Sarawak, Malaysia for supporting this work. REFERENCES [1] J. S. Lee, Y.Y. Jung, B.S. Kim, and S.J. Ko, An Advaned Video Camera System with Robust AF, AE, and AWB Control, IEEE Bans. on Consumer Eletronis, vol. 47, no. 3, pp. 694-699, Aug. 2001. [2] Meng Xiang Li and Jean Mar Lavest, Some Aspets of Lens Camera Calibration, IEEE Transations On Pattern Analysis And Mahine Intelligene, VOL. 18, NO. 11, November 1996. [3] Y. M. Lee, A Fuzzy Control Proessor for Automati Fousing, IEEE Trans. on Consumer Eletronis, vol. 40, no. 2, pp. 138-144, May 1994. [4] K. Ooi, K. Izumi, M. Nozaki, and I. Takeda, An Advaned Autofous System for Video Camera using Quasi Condition Reasoning, IEEE Trans. on Consumer Eletronis, vol. 36, pp. 526-529, Aug. 1990. [5] J. A. Fayman, 0. Sudarsky, and E. Rivlin, Traking, Proeedings of IEEE International Conferene on Robotis and Automation, vol. 4, pp. 2783-2788, May. 1998. [6] P. Hoad and J. Illingworth, Automati Control of Camera Pan, and Fous for Improving Objet Reognition, Fifth IEE International Conferene on Image Proessing and its Appliations, no. 410, pp. 291-295, July. 1995. [7] M. T. Ahmed and A. A. Farag, A neural approah to zoom-lens amera alibration from data with outliers, Image and Vision Computing, vol. 20, no. 9, pp. 619 630, Aug. 2002. [8] K. Tarabanis, R. Y. Tsai, and D. S. Goodman, Modeling of a omputerontrolled zoom lens, in Proeedings of IEEE International Conferene on Robotis and Automation, May 1992, vol. 2, pp. 1545 1551. [9] Mihel Sarkis, Christian T. Senft and Klaus Diepold, Modeling The Variation Of The Intrinsi Parameters Of An Automati Camera System Using Moving Least-Squares, Proeedings of the 3rd AnnualIEEE Conferene on Automation Siene and Engineering Sottsdale, AZ, USA, Sept 22-25, 2007. [10] Yuanyuan Chai, Limin Jia, and Zundong Zhang, Mamdani Model based Adaptive Neural Fuzzy Inferene System and its Appliation, International Journal of Computational Intelligene 5:1 2009, 22-29. [11] Lu BAI, Liya DING, A Suitability Measure for Automati Seletion of Fuzzy Model based on User's Data,, Journal of Maau University of Siene and Tehnology, Vol.2 No.2, De 30, 2008. [12] http://www.ambridgeinolour.om/tutorials/image-interpolation.htm. [13] http://ezineartiles.om/?expert= Ziv_Haparnas. [14] http://en.wikipedia.org/wiki/_lens. [15] Irraivan Elamvazuthi, Mohamed Khan Aftab Ahmed Khan and Mumtaj Begam, Enhanement of Auto Image ing using Fuzzy Set Theory, 2nd International Conferene on Control, Instrumentation and Mehatronis, (CIM 2009) 2-3 June, 2009, Malaa, M sia [16] Yoon Kim, June Sok Lee, Aldo W. Morales and Sung Jea Ko, A Video Camera System With Enhaned, Traking And Auto White Balane, IEEE Transations on Consumer Eletronis, Vol. 48, No. 3, 428 August 2002. [17] L.A. Zadeh, Outline of a New Approah to the Analysis of Complex Systems and Deision Proesses; IEEE Trans. Syst. Man. Cybern., vol. 3, no. 1, pp. 28-44, 1973. [18] E.M. Mamdani, Appliations of Fuzzy Algorithms for Simple Dynami Plants; Pro. IEEE, vol. 21, no. 12, pp.1585-1588, 1974. [19] C.C. Lee, Fuzzy Logi in Control Systems: Fuzzy Logi Controller; IEEE Trans. Syst. Man. Cybern., vol. 20, no. 2, pp. 404-435, 1990. [20] H.Takahashi, K. Ikeura, and T. Yamamori, 5-speed Automati Transmission Installed Fuzzy Reasoning; Pro. of International Fuzzy Engineering Symposium '91 (IFES'91), pp. 1136-1137, 1991. [21] E.M. Mamdani, Twenty Years of Fuzzy Control: Experienes Gained and Lessons Learnt; Pro. IEEE International Conf. on Fuzzy Systems, pp. 339-344, 1993. [22] Yunseop Kim, John F. Reid, Qin Zhang, Fuzzy logi ontrol of a multispetral imaging sensor for in-field plant sensing, omputers and eletronis in agriulture 6 0 ( 2 0 0 8 ) 279 288]. 248 http://sites.google.om/site/ijsis/
[23] Yuanyuan Chai, Limin Jia, and Zundong Zhang, Mamdani Model based Adaptive Neural Fuzzy Inferene System and its Appliation, International Journal of Computational Intelligene 5:1 2009, pp. 22-29. [24] E.H.Mamdani and S.Assilian, An experiment in linguisti synthesis with a fuzzy logi ontroller, International Journal of Man-Mahine Studies, 7(1):1-13,1975. [25] F. Esragh and E.H. Mamdani, A general approah to linguisti approximation,fuzzy Reasoning and Its Appliations, Aademi Press,1981. [26] E. H. Mamdani, Appliation of Fuzzy Logi to Approximate Reasoning Using Linguisti Synthesis, IEEE Trans. Computers, 26(12):1182-1191, 1977. [27] T. Takagi and M. Sugeno, Derivation of fuzzy ontrol rules from human operators ontrol ations, Pro. IFAC Symp. on Fuzzy lnformation,knowledge Representation and Deision Analysis, 55 60, July 1983. [28] T. Takagi and M. Sugeno, Fuzzy identifiation of systems and its appliations to modeling and ontrol, IEEE Trans. Syst., Man, Cybern, 15:116 132, 1985. [29] Fuzzy Logi Toolbox User s Guide. 2008. The Math works Software. AUTHORS PROFILE I. Elamvazuthi is a leturer at the Department of Eletrial and Eletroni Engineering of Universiti Teknologi PETRONAS (UTP), Malaysia. His researh interests inlude Control Systems, Mehatronis and Robotis. P. Vasant is a leturer at the Department of Fundamental and Applied Sienes of Universiti Teknologi PETRONAS (UTP), Malaysia. His researh interests are Soft Computing and Computational Intelligene. J. Webb is a leturer at the University of Tehnology Swinburne, Sarawak Campus, Kuhing, Sarawak, Malaysia. He speializes in Computational Methods, Nano-Physis and Mehatronis. 249 http://sites.google.om/site/ijsis/