membership functions were selected for input and output 
variables. 
values.  The triangular membership function is a function of a vector, x, and depends on three scalar parameters, a, b, and c, as given by an example in Fig. 2:  $$\begin{array}{cc}0&x\leq a\\ \frac{x-a}{b-a}&a\leq x\leq b\\ f(x;a,bc)=\mu_{\mbox{\tiny{\it Risk}}}^{\mbox{\tiny{\it Norm}}}\left(x=\begin{array}{cc}\frac{c-x}{c-b}&b\leq x\leq c\\ \frac{c-b}{c+0.8}&c\leq x\end{array}\right.\end{array}\tag{3}$$

![0_image_0.png](0_image_0.png)

Fuzzy sets and fuzzy operators are the subjects and verbs of fuzzy logic. These if-then rule statements are used to formulate the conditional statements that comprise fuzzy logic. A single fuzzy if-then rule assumes the form. 

## If X Is A Then Y Is B (4)

where, A and B are linguistic values defined by fuzzy sets on the ranges (universe of discourse) X and Y, respectively. The if-then part of the rule "x is A" is called the antecedent or premise, while the then-part of the rule "y is B" is called the consequent or conclusion [28]. 

During data processing, fuzzy system fuzzifies the crisp data, applies the mamdani inference system using the fuzzy rules and finally, determines the zooming function of the camera through defuzzification. Defuzzification has some methods such as center of gravity (centroid (COG)), mean of maximum (MOM), and first of maximum (FOM), and so on. 

Center of gravity is the most popular and the most precision method for defuzzification that was used. Center of gravity method is a grade weighted by the areas under the aggregated output functions. The formula for Centroid is given as. 

$$z^{*}={\frac{\int\mu_{c}(z)z d z}{\int\mu_{c}(z)d z}}\quad\quad(5)$$

where, dzz ≠∫ 0)( μc for all μi . 

The formula for mean of maximum (MOM) is given as. 

$$z^{*}={\frac{\int\mu_{c}(z)z d z}{\int\mu_{c}(z)d z}}\qquad(6)$$

for membership function defined as 

$$\mu_{c}(z)=\begin{cases}1&\mu_{c}(z)=c\operatorname*{max}\\ 0&o t h e r w i s e\end{cases}.$$

C. Proposed Algorithm The objective of the proposed algorithm is to zooming function of a digital camera based on the input given as distance. Shown in Fig. 3 is a block diagram of the proposed algorithm, which includes a fuzzification block, a knowledgebase, a fuzzy inference engine and a defuzzification block. 

![0_image_1.png](0_image_1.png)

From Fig. 3, it can be seen that the input is distance and output is zoom. The proposed algorithm consists of three steps: fuzzification, fuzzy rules, and defuzzification. 

Step 1: Fuzzification. In order to keep the number of fuzzy rules at a reasonable level, input can be defined as fuzzy set Distance with five membership functions known as Too Near, Near, Medium, Far, Too Far. For the output, Zoom fuzzy set with five membership functions such as Max Zoom Out, Min Zoom Out, Default, Min Zoom In, and Max Zoom In were defined. 

Step 2: Fuzzy Rules In this step, we use the linguistic quantification to specify a set of rules that captures the expert's knowledge about how to control the output. For example: If Distance is Too Near then Zoom is Maximize Zoom Out. 

Step 3: Defuzzification Any suitable defuzzification method can be used to defuzzify the output variable. 

The inputs for fuzzy system that introduced in this study were distance that is crisp. Initially, fuzzy system fuzzifies the crisp data and then with mamdani inference system applies the fuzzy rules; finally, determines the zooming function. 