**ANFIS Definition of Focal Length for Zoom Lens via Fuzzy Logic Functions**

[35] F. Tabib Mahmoudi, F. Samadzadegan, and P. Reinartz, "Object oriented image analysis based on multi-agent recognition system," Computers & Geosciences, vol. 54,

[36] J. Liu and Y. Y. Tang, "Adaptive image segmentation with distributed behavior-based agents," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 21, pp.

[37] R. D. Labati, V. Piuri, and F. Scotti, "Agent-based image iris segmentation and multiple views boundary refining." In: Proceedings IEEE 3rd International Conference on Biometrics: Theory, Applications, and Systems 28-30 Sept., Washington DC, 2009, pp.

[38] P. Hofmann, P. Lettmayer, T. Blaschke, M. Belgiu, S. Wegenkittl, R. Graf, et al., "Towards a framework for agent-based image analysis of remote-sensing data," International

[39] C. M. Macal and M. J. North, "Tutorial on agent-based modelling and simulation,"

[40] P. Hofmann, V. Andrejchenko, P. Lettmayer, M. Schmitzberger, M. Gruber, I. Ozan, et al., "Agent based image analysis (ABIA) - preliminary research results from an implemented framework." In: GEOBIA 2016 : Solutions and Synergies., 14 September 2016 - 16 September 2016, University of Twente Faculty of Geo-Information and Earth Observation

[41] P. Hofmann, "Defuzzification strategies for fuzzy classifications of remote sensing

Journal of Image and Data Fusion, vol. 6, pp. 115-137, 2015.

data," Remote Sensing, vol. 8(6), doi:10.3390/rs8060467, 2016.

Journal of Simulation, vol. 4, pp. 151-162, 2010.

pp. 219-230, 2013.

296 Modern Fuzzy Control Systems and Its Applications

544-551, 1999.

1-7.

(ITC), 2016.

Bahadır Ergün, Cumhur Sahin and Ugur Kaplan

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/67823

#### **Abstract**

The digital cameras have been effected from systematical errors which decreased metric quality of image. The digital cameras have been effected from systematical errors that decreases metric quality of image. The aim of this chapter is to explore usability of fuzzy logic on calibration of digital cameras. Therefore, a 145‐pointed planar test field has been prepared in the laboratories of Department of Geodesy and Photogrammetric Engineering at the Gebze Technical University. The test field has been imaged from five points of view with the digital camera Nikon Coolpix‐E8700 within maximum (71.2 mm) and minimum (8.9 mm) focal length. The input‐output data have been determined from 10 calibration images obtained for fuzzy logic process. These data have also been used and formed for the space resection process. Adaptive neuro‐fuzzy inference system (ANFIS) functions have been used for fuzzy process at MATLAB 7.0, and the results of these two distinct methods have been compared. Finally, the most convenient (least squares average error) or the most useful ANFIS "*Trimf, trapmf, gbellmf, gaussmf, gauss2mf, pimf, dsigmf and psigmf*" functions are determined and compared for space resection method for the conventional bundle adjustment process.

**Keywords:** ANFIS, zoom lens calibration, focal distance, MATLAB

## **1. Introduction**

Fuzzy inference system (FIS) is a process of mapping from given inputs to outputs by using the theory of fuzzy sets [1]. FIS derives an output by using an inference engine, which is based on a form of **IF‐THEN** rules. There are two well‐established types of FIS [2–4]. While Mamdani FIS uses the technique of defuzzification of a fuzzy output, Sugeno FIS uses weighted average

© 2017 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

to compute the crisp output [4]. In fact, adaptive neuro‐fuzzy inference system (ANFIS) structure is composed of a representation as a network structure, which has the neural learning ability of Sugeno‐type fuzzy systems. This network is made of a combination of nodes, which are placed as layers in order to perform specific functions [5, 6].

Among the neuro‐fuzzy models most used nowadays, the adaptive neuro‐fuzzy inference system (ANFIS), which was proposed in 1992 by J.S Roger in his Ph.D. thesis, must be highlighted [7–9]. ANFIS adapts its parameters according to training data by using the hybrid learning algorithm. The algorithm consists of the gradient descent for tuning the non‐linear antecedent parameters and the least square for tuning the linear consequent parameters [1]. Most of the success of ANFIS comes from its implementation in the MATLAB Fuzzy Logic Toolbox, with an excellent graphical interface personally developed by J.S. Roger in collaboration with N. Gulley, incorporating also diverse fuzzy logic pattern classification algorithms for the definition and dimensioning of the input membership functions (mf) [9, 10].

In the literature, there are several examples of the ANFIS, which enable it to achieve great success in a wide range of scientific applications. The advantageous features of an ANFIS include easy implementation, fast and accurate learning, strong generalization abilities, excellent explanation facilities through fuzzy rules, and easy to incorporate both linguistic and numeric knowledge for problem solving [11]. ANFIS models have recently gained much popularity not only for calibrating non‐linear relationships because they offer more advantages over conventional modeling techniques, which include the ability to handle large amounts of noisy data from dynamic and non‐linear systems, especially where the underlying physical relationships are not fully understood, but also for solving linear systems which include the interpolation modeling such as time series. Literature shows that lots of ANFIS and FIS methods were proposed for the determination of the uncertainty of pattern recognition, image matching, and three‐dimensional (3D) position definition studies in computer vision applications. For instance, color recognition ANFIS model study for robust vision system has worked in Ref. [12]. Another application for ANFIS method is suggested for appropriate calibration method of stereo camera system used for non‐intrusive distance measurement in [13]. Another example for ANFIS method in remote sensing study, functions for serving and prediction from satellite images of Prionace Glauca for pattern recognition in (Backpropagation network, RBF, functional separability network) and the neuro‐diffuse networks (ANFIS) [14]. In Ref. [15], a new hybrid method of performing eye‐to‐hand coordination and manipulation to produce a working robot named COERSU. The method is an optimized combination of two neuro‐fuzzy approaches developed by the authors: direct fuzzy servoing and fuzzy correction. The fuzzy methods are tuned by the adaptive neuro‐fuzzy inference system (ANFIS). Human action recognition is an important research area in the field of computer vision having a great number of real‐world applications. In Ref. [16], ANFIS controller method has been suggested for path tracking, a virtual field strategy for obstacle avoidance and path planning, and multiple sensors (an ultrasonic array, a thermal sensor, and a video streaming system) for obtaining information about the environment. In Ref. [17], development of a virtual robot tele‐operation platform based on hand gesture recognition has been evolved from visual information by ANFIS and support vector machines (SVM). In Ref. [18], a multi‐view action recognition framework that extracts human silhouette clues from different cameras was presented with fuzzy rule‐based system for analyzing scene dynamics and interpreting human behaviors. The interaction tool has been located in 3D space then the 3D model has obtained by means of a structured light system which is calibrated using only the vanishing points extracted from a simple planar surface. Then, an immersive interaction technique was used to manipulate the 3D model using a fuzzy technique with the advantages of a low memory usage, real‐time operation, and low positioning errors as compared to classical solutions in [19]. Quantitative analysis of the error in the reconstruction of a 3D scene, which has been captured with synthetic aperture integral imaging system, has been worked for two‐dimensional (2D) images which was captured within unknown camera parameters with adaptive neuro‐fuzzy inference system (ANFIS) in [20].

In this chapter, an ANFIS approach has been developed for the detection of effective camera focal distance parameters with additional parameters, which help the measurement of image coordinates that provide the basis for three‐dimensional modeling obtained from two‐dimensional images, which are similar to [19, 20] studies. Thus, the photogrammetric studies, which benefit from self‐calibration conventional model, will be more usable with different cameras and different time points.

The main logic of this chapter is to process the selected radial distances via ANFIS functions and to obtain a focus distance value for each of the images. It is seen that ANFIS functions of optical distortion law can be validated by its effect on data sets. This also proves that ANFIS functions validate a physical reality and describe it in a highly reliable way. As a result of the research, it is seen that the approach of fuzzy logic can be used for the calibration process of digital cameras. Thus, it is concluded that it would be beneficial to use and study the fuzzy logic approach more in photogrammetric applications [21].

Information about fuzzy systems is described in the second part of this chapter. Third part of this chapter is the experimental application part. Test field has been photographed from five different angles with Nikon Coolpix‐e8700 digital camera with maximum (71.2 mm) and minimum (8.9 mm) focal distances in the application. Input and output data are determined with the resulting 10 images; space resection approach is created and studied by using ANFIS functions on MATLAB 7.0 software. Trimf, trapmf, gbellmf, gaussmf, gauss2mf, pimf, dsigmf, and psigmf functions in Fuzzy Interface System (FIS), which are used for creating a relation between fuzzy sets, under anfisedit menu in fuzzy logic tools on MATLAB 7.0 software, are studied in terms of space resection approach, and the most appropriate functions are determined for the detection of focal distance. The fourth part presents the results and their interpretations.

## **2. Fuzzy logic and main principles**

to compute the crisp output [4]. In fact, adaptive neuro‐fuzzy inference system (ANFIS) structure is composed of a representation as a network structure, which has the neural learning ability of Sugeno‐type fuzzy systems. This network is made of a combination of nodes, which

Among the neuro‐fuzzy models most used nowadays, the adaptive neuro‐fuzzy inference system (ANFIS), which was proposed in 1992 by J.S Roger in his Ph.D. thesis, must be highlighted [7–9]. ANFIS adapts its parameters according to training data by using the hybrid learning algorithm. The algorithm consists of the gradient descent for tuning the non‐linear antecedent parameters and the least square for tuning the linear consequent parameters [1]. Most of the success of ANFIS comes from its implementation in the MATLAB Fuzzy Logic Toolbox, with an excellent graphical interface personally developed by J.S. Roger in collaboration with N. Gulley, incorporating also diverse fuzzy logic pattern classification algorithms

In the literature, there are several examples of the ANFIS, which enable it to achieve great success in a wide range of scientific applications. The advantageous features of an ANFIS include easy implementation, fast and accurate learning, strong generalization abilities, excellent explanation facilities through fuzzy rules, and easy to incorporate both linguistic and numeric knowledge for problem solving [11]. ANFIS models have recently gained much popularity not only for calibrating non‐linear relationships because they offer more advantages over conventional modeling techniques, which include the ability to handle large amounts of noisy data from dynamic and non‐linear systems, especially where the underlying physical relationships are not fully understood, but also for solving linear systems which include the interpolation modeling such as time series. Literature shows that lots of ANFIS and FIS methods were proposed for the determination of the uncertainty of pattern recognition, image matching, and three‐dimensional (3D) position definition studies in computer vision applications. For instance, color recognition ANFIS model study for robust vision system has worked in Ref. [12]. Another application for ANFIS method is suggested for appropriate calibration method of stereo camera system used for non‐intrusive distance measurement in [13]. Another example for ANFIS method in remote sensing study, functions for serving and prediction from satellite images of Prionace Glauca for pattern recognition in (Backpropagation network, RBF, functional separability network) and the neuro‐diffuse networks (ANFIS) [14]. In Ref. [15], a new hybrid method of performing eye‐to‐hand coordination and manipulation to produce a working robot named COERSU. The method is an optimized combination of two neuro‐fuzzy approaches developed by the authors: direct fuzzy servoing and fuzzy correction. The fuzzy methods are tuned by the adaptive neuro‐fuzzy inference system (ANFIS). Human action recognition is an important research area in the field of computer vision having a great number of real‐world applications. In Ref. [16], ANFIS controller method has been suggested for path tracking, a virtual field strategy for obstacle avoidance and path planning, and multiple sensors (an ultrasonic array, a thermal sensor, and a video streaming system) for obtaining information about the environment. In Ref. [17], development of a virtual robot tele‐operation platform based on hand gesture recognition has been evolved from visual information by ANFIS and support vector machines (SVM). In Ref. [18], a multi‐view action recognition framework that extracts human silhouette clues from different cameras

for the definition and dimensioning of the input membership functions (mf) [9, 10].

are placed as layers in order to perform specific functions [5, 6].

298 Modern Fuzzy Control Systems and Its Applications

Fuzzy logic is based on the logic of clustering and determination of membership degrees depending of this clustering. Membership degrees generate rule‐based work systematic which constitutes the rules of fuzzy systems. Fuzzy cluster sections which are placed in the inlets and outlets of the fuzzy rules express an approximation for each. In this respect, all expressions like "approximately 3," "nearly 9," "over 5 and approximate" always express a fuzzy number. Each of these approximations corresponds to a fuzzy cluster. It cannot be possible to solve mathematical operations with these fuzzy numbers. The operations are made with fuzzy numbers by defining some restrictions. In order for a fuzzy number to exist, fuzzy cluster of this needs to have an interval of normal, convex, limited support and at section of membership degree, closed and finite. For the fuzzy numbers to be normal, membership degree of at least one of the real numbers in the fuzzy expression must be 1.

Generally, two fuzzy numbers as a triangle and trapezoid are in question. Mathematical expression of a triangle fuzzy number showed with a fuzzy cluster is given as Eq. (1):

$$\begin{aligned} \text{expression of a triangle fuzzy number showed with a fuzzy cluster is given as Eq. (1):}\\ \text{mf(x) = mf(x; a, b, c)} = \begin{bmatrix} (\mathbf{x} \cdot \mathbf{a})/(\mathbf{b} \cdot \mathbf{a}) & \mathbf{a} \le \mathbf{x} \le \mathbf{b} \\ (\mathbf{c} \cdot \mathbf{x})/(\mathbf{c} \cdot \mathbf{b}) & \mathbf{b} \le \mathbf{x} \le \mathbf{c} \\ 0 & \mathbf{x} > \mathbf{c} & \text{or } \mathbf{x} < \mathbf{a} \end{bmatrix} \end{aligned} \tag{1}$$

In the expression of mf(x;a,b,c), a and c show the lower and upper limit values relatively and b shows the single number with full membership. Similarly, trapezoid fuzzy numbers are expressed with four full whole numbers as a, b, c, d. Here a and d show lower and upper limit values of trapezoid fuzzy numbers; b and c show the limits of the cluster of the trapezoid numbers whose membership degree is full between these two numbers. Mathematical indication of trapezoid fuzzy number is like Eq. (2):

$$\begin{aligned} \text{tion of trapezoid fuzzy number is like Eq. (2):}\\ \text{mf(x) = mf(x; a, b, c, d)} &= \begin{bmatrix} (\mathbf{x} \cdot \mathbf{a})/(\mathbf{b} \cdot \mathbf{a}) & \mathbf{a} \le \mathbf{x} \le \mathbf{b} \\ 1 & \mathbf{b} \le \mathbf{x} < \mathbf{c} \\ (\mathbf{d} \cdot \mathbf{x})/(\mathbf{d} \cdot \mathbf{c}) & \mathbf{c} < \mathbf{x} \le \mathbf{d} \\ 0 & \mathbf{x} > \mathbf{d} & \text{or } \times \le \mathbf{a} \end{bmatrix} \end{aligned} \tag{2}$$

If we pay attention, when b = c, trapezoid fuzzy number is transformed into triangle fuzzy number. Graphical indication of these fuzzy numbers is as shown in **Figure 1**.

Generally, there are two reasons for the researchers to use fuzzy systems:

• Since the real‐world incidents are very complicated, these incidents are not possible to be taken under control by being defined with specific equations. As a natural result of this,

**Figure 1.** Fuzzy numbers: (a) triangle and (b) trapezoid.

the researcher always prefers applying to the methods that have approximate solubility even if not certain. As Einstein said, if it can be said that real‐life incidents can be indicated with mathematical equations, either the accuracy of the equation cannot be mentioned or if the result that mathematical equations exactly depicts the reality is taken, then real‐life incidents cannot be mentioned. So, the solutions are approximate to a certain extent in all studies conducted. Otherwise, many non‐linear equations must be solved simultaneously which is known to lead to chaotic unspecified problems according to current information.

• All theories and equations in engineering express the real world approximately. Even though many real systems are not linear, every effort is given in order to accept the linearity in examination of these with classic methods. In order for the verbal data presented by people to be converted into numerical data and calculated by being perceived by computers and algorithms, fuzzy systems are needed.

Almost all of mathematical, stochastic, or conceptual systems so far are made up of three units given in **Figure 2**.

These are input unit, a transition function which converts this input to output and is called system behavior and output unit. In all of the units here, numerical data are processed. The difference of the fuzzy systems from the conventional systems is that the system behavior section is divided into two and there are four connected units between each other as shown in **Figure 3**.

Each of the units here has tasks, which are different but can be related to each other:

• **General information base unit:** It includes input variants to which the incident to be examined is subjected and all information about these. Because the it includes both numerical and/or textual data, the database is called as 'general database'.

**Figure 3.** General fuzzy system.

expressions like "approximately 3," "nearly 9," "over 5 and approximate" always express a fuzzy number. Each of these approximations corresponds to a fuzzy cluster. It cannot be possible to solve mathematical operations with these fuzzy numbers. The operations are made with fuzzy numbers by defining some restrictions. In order for a fuzzy number to exist, fuzzy cluster of this needs to have an interval of normal, convex, limited support and at section of membership degree, closed and finite. For the fuzzy numbers to be normal, membership

Generally, two fuzzy numbers as a triangle and trapezoid are in question. Mathematical

In the expression of mf(x;a,b,c), a and c show the lower and upper limit values relatively and b shows the single number with full membership. Similarly, trapezoid fuzzy numbers are expressed with four full whole numbers as a, b, c, d. Here a and d show lower and upper limit values of trapezoid fuzzy numbers; b and c show the limits of the cluster of the trapezoid numbers whose membership degree is full between these two numbers. Mathematical indica-

If we pay attention, when b = c, trapezoid fuzzy number is transformed into triangle fuzzy

• Since the real‐world incidents are very complicated, these incidents are not possible to be taken under control by being defined with specific equations. As a natural result of this,

(x - a ) /(b - a ) a ≤ x ≤ b

(x - a ) /(b - a ) a ≤ x ≤ b

<sup>1</sup> <sup>b</sup> <sup>≤</sup> <sup>x</sup> <sup>&</sup>lt; c (<sup>d</sup> - <sup>x</sup> ) /(<sup>d</sup> - <sup>c</sup> ) <sup>c</sup> <sup>&</sup>lt; <sup>x</sup> <sup>≤</sup> d

0 x > d or x < a

(<sup>c</sup> - <sup>x</sup> ) /(<sup>c</sup> - <sup>b</sup> ) <sup>b</sup> <sup>≤</sup> <sup>x</sup> <sup>≤</sup> c

0 x > c or x < a

(1)

(2)

expression of a triangle fuzzy number showed with a fuzzy cluster is given as Eq. (1):

degree of at least one of the real numbers in the fuzzy expression must be 1.

[

⎡

⎢ ⎣

number. Graphical indication of these fuzzy numbers is as shown in **Figure 1**.

Generally, there are two reasons for the researchers to use fuzzy systems:

mf(x ) = mf(x; a, b, c ) =

300 Modern Fuzzy Control Systems and Its Applications

tion of trapezoid fuzzy number is like Eq. (2):

mf(x ) = mf(x; a, b, c, d ) =

**Figure 1.** Fuzzy numbers: (a) triangle and (b) trapezoid.


**Figure 3** represents a general fuzzy system. The point to be paid attention to here is information and outputs in the input; in other words, databases are fuzzy values. So each unit in **Figure 3** is made up of fuzzy clusters entirely. The most significant deficiency of basic fuzzy system is that numerical database cannot enter into such a fuzzy system and the outputs are not numerical, so they cannot be directly used in engineering designs.

In order to certainly eliminate the deficiencies of the general fuzzy system is extented to a new system which is proposed in Refs. [3, 22] This is called Takagi‐Sugeno‐Kank (TSK) fuzzy system. For each inputs and the outputs obtained as a result of operation of fuzzy rule and deduction engine are in the way of a function of inputs which are from input database. So like the input variants in rule base, it was thought that these variants are reflected to rule result section after THEN word as a linear function of these variants [21]. According to this, the rule is presented in the following part.

**IF** the speed of your car is high, **THEN** stepping on the gas force can be expressed as **y = ax.** For example, in the case that three input variants exist (x1 , x2 , and x3 ), in one of fuzzy system, y as output variant generally; **IF** x1 is little and x3 is wide, **THEN** it can be expressed as **y = a**<sup>0</sup>  **+ a**1 **x**1  **+ a**<sup>2</sup> **x**2  **+ a**<sup>3</sup> **x**3 . Result sections of all rules are made up of a polynomial linear equation. Since in the fuzzy system which has such a structure output variants are not used in the deduction of fuzzy clustering, instead of fuzzy deduction unit in **Figure 3**, weighted deduction calculation unit comes as mainly the membership degrees calculated from the input section of each rule. This system is shown in **Figure 4**.

**Figure 4.** TSK fuzzy system.

Actually in such a fuzzy system, output space is represented as a function of the inputs for being a rule valid in each sub‐space. Even in the case that the output surface is not linear, with TSK approach they are understood as modeled in the way of plain pieces of input variant kind on sub‐spaces.

• **Fuzzy rule base unit:** It includes all the rules which can be written in the type of logical **IF‐THEN**, connecting the inputs in data base to output variants. In writing of these rules, the whole interval connections (fuzzy cluster) which can only be between input and output data are considered. Thus, each rule connects one piece of input space to the output space

• **Fuzzy deduction engine unit:** It is a mechanism including the operations, which enable a system to behave as having one output by bringing the relations formed between input and output fuzzy clusters in a fuzzy rule base unit together. This engine serves for determination of what kind of output the whole system will give between the inputs by bringing

• **Output unit:** It indicates the output values obtained as a result of the interaction of infor-

**Figure 3** represents a general fuzzy system. The point to be paid attention to here is information and outputs in the input; in other words, databases are fuzzy values. So each unit in **Figure 3** is made up of fuzzy clusters entirely. The most significant deficiency of basic fuzzy system is that numerical database cannot enter into such a fuzzy system and the outputs are

In order to certainly eliminate the deficiencies of the general fuzzy system is extented to a new system which is proposed in Refs. [3, 22] This is called Takagi‐Sugeno‐Kank (TSK) fuzzy system. For each inputs and the outputs obtained as a result of operation of fuzzy rule and deduction engine are in the way of a function of inputs which are from input database. So like the input variants in rule base, it was thought that these variants are reflected to rule result section after THEN word as a linear function of these variants [21]. According to this, the rule is presented in the following part. **IF** the speed of your car is high, **THEN** stepping on the gas force can be expressed as **y = ax.**

is little and x3

in the fuzzy system which has such a structure output variants are not used in the deduction of fuzzy clustering, instead of fuzzy deduction unit in **Figure 3**, weighted deduction calculation unit comes as mainly the membership degrees calculated from the input section of each

, x2

. Result sections of all rules are made up of a polynomial linear equation. Since

, and x3

is wide, **THEN** it can be expressed as **y = a**<sup>0</sup>

), in one of fuzzy system,

 **+** 

logically. All of these contexts form the base rule.

mation and fuzzy rule bases with deduction engine.

For example, in the case that three input variants exist (x1

y as output variant generally; **IF** x1

rule. This system is shown in **Figure 4**.

**Figure 4.** TSK fuzzy system.

**a**1 **x**1  **+ a**<sup>2</sup> **x**2  **+ a**<sup>3</sup> **x**3

not numerical, so they cannot be directly used in engineering designs.

deductions of each rule together.

302 Modern Fuzzy Control Systems and Its Applications

However, TSK fuzzy systems have deficiencies as there is a mathematical relation after **IF** part; output sections of the rules cannot model the verbal data given by human, and output sections of all rules, which are possible to be written between input and output variants cannot be written because they are fuzzy. In order to eliminate these deficiencies, fuzzy system, which is respectively blur, and clarification units are used in input and output units given in **Figure 5** [21].

Here, fuzzy rule base and deduction engine in a general fuzzy system remain as they are. In the case that the inputs are numerical, there are blurring agent unit, which is for blurring them with a process, and clarifying agent unit, which is for digitizing the fuzzy outputs. Blurring (fuzzification) and clarifying (defuzzification) mean, respectively, blurring the input numbers and digitizing the fuzzy numbers.

Among the main properties of fuzzy systems, multiple inputs, rule base, and conversion as single output by processing with deduction engine come as the most important issues. In some special situations, outputs may be more than one. Fuzzy system determines the behavior of the system by converting variants forming the inputs to output variant in a way of non‐linear. By this way, it is possible to take the examined system under control in order to reach desired results by subjecting information base to non‐linear conversions. Owing to the fuzzy systems, it becomes possible to process image, make guess based on time series, solve control problems, and perform applications on communication issues. Other than this, fuzzy systems can be used in many areas like engineering, medicine, sociology, psychology, business management, expert systems, artificial intelligence, signal processing, transportation, and signalization.

Exact numerical values are needed in practical applications particularly for sizing in engineering designs. In such cases, fuzzy information must be clarified in order for the required answers to be given by benefiting from information obtained or given as fuzzy. All processes made for conversion of fuzzy information to exact results are called clarification.

**Figure 5.** Fuzzy system with blurring‐clarifying unit.

There are many clarification methods [23]. A few of them are presented below. In these processes, **z** indicates fuzzy deduction cluster, indicates components, and *z***\*** indicates clarified value.


$$\mathbf{z}^\* = \frac{\text{fmf}\_{\text{c}}(\mathbf{z})\mathbf{z}\mathbf{d}\mathbf{z}}{\text{fmf}\_{\text{c}}(\mathbf{z})\mathbf{d}\mathbf{z}}\tag{3}$$

Clarification is performed according to the center of gravity of fuzzy expression.

• **Weighted mean method:** In order for this method to be used, symmetric membership function (mf) is needed. Mathematical explanation is as shown in Eq. (4):

$$\mathbf{z}^\* = \frac{\sum \mathbf{m} \mathbf{f}\_c(\overline{\mathbf{z}}) \overline{\mathbf{z}}}{\sum \mathbf{m} \mathbf{f}\_c(\overline{\mathbf{z}})} \tag{4}$$

Here Σ sign indicates algebraic sum. Graphical indication of this method is shown in **Figure 7**. Here, each membership function of fuzzy cluster constituting the output is multiplied with the highest membership degree value it has and their weighted mean is calculated. For instance, weighted mean (clarified value) of two fuzzy clusters in **Figure 7** is calculated as shown in Eq. (5).

$$\mathbf{z}^\* = \frac{\mathbf{a}(0.5) \star \mathbf{b}(0.9)}{0.5 \star 0.9} \tag{5}$$

Since this clarifying process is valid only for symmetric membership functions, a and b values are the mean of the figures they represent.

• **Averagely the highest membership degree method:** This method is also known as the mean of the highest ones. In this respect, it is very close to the first clarification principle. However, the position of the highest membership may not be singular. This means that the one having the highest membership degree in the membership function, mf (z) = 1, may exist in a plain section instead of a point.

**Figure 6.** Clarification of the highest membership degree.

**Figure 7.** Clarification with weighted mean method.

There are many clarification methods [23]. A few of them are presented below. In these processes, **z** indicates fuzzy deduction cluster, indicates components, and *z***\*** indicates clarified

• **The highest membership principle:** Another name of this process is height method. For this method to be used, fuzzy deduction clusters with peaks are needed. This method can

• **Centroid method:** Another name of this method is center of gravity method. It could be the most common one of clarification methods. Mathematical expression is as shown in Eq. (3):

• **Weighted mean method:** In order for this method to be used, symmetric membership func-

Here Σ sign indicates algebraic sum. Graphical indication of this method is shown in **Figure 7**. Here, each membership function of fuzzy cluster constituting the output is multiplied with the highest membership degree value it has and their weighted mean is calculated. For instance, weighted mean (clarified value) of two fuzzy clusters in **Figure 7** is calculated as

Since this clarifying process is valid only for symmetric membership functions, a and b values

• **Averagely the highest membership degree method:** This method is also known as the mean of the highest ones. In this respect, it is very close to the first clarification principle. However, the position of the highest membership may not be singular. This means that the one having the highest membership degree in the membership function, mf (z) = 1, may

z).¯ <sup>z</sup> \_\_\_\_\_\_\_\_ ∑mfC (¯

Clarification is performed according to the center of gravity of fuzzy expression.

tion (mf) is needed. Mathematical explanation is as shown in Eq. (4):

∫mfC (z)dz (3)

z) (4)

0.5 <sup>+</sup> 0.9 (5)

value.

shown in Eq. (5).

be indicated with **Figure 6**.

304 Modern Fuzzy Control Systems and Its Applications

<sup>z</sup>\* <sup>=</sup> ∫mfC (z).zdz \_\_\_\_\_\_\_\_\_

<sup>z</sup>\* <sup>=</sup> ∑mfC(¯

<sup>z</sup>\* <sup>=</sup> <sup>a</sup>(0.5 ) +b(0.9 ) \_\_\_\_\_\_\_\_\_\_

are the mean of the figures they represent.

exist in a plain section instead of a point.

**Figure 6.** Clarification of the highest membership degree.

Clarified value according to this method in graphical indication in **Figure 8** is as shown in Eq. (6):

$$z^\* = \frac{a+b}{2} \tag{6}$$

• **Central management of the sums:** It is the fastest one among the clarification methods used. In this method, instead of combination of two fuzzy clusters, their algebraic sum is used. A deficiency of this is overlapping sections entering into the sum twice. Clarified value can be calculated as Eq. (7).

$$\mathbf{z}^\* = \frac{\int \mathbf{z} \sum\_{\mathbf{k}=1}^n \mathbf{m} \mathbf{f}\_{\mathbf{c}}(\mathbf{z}) \, \mathrm{d}\mathbf{z}}{\int \sum\_{\mathbf{k}=1}^n \mathbf{m} \mathbf{f}\_{\mathbf{c}}(\mathbf{z}) \, \mathrm{d}\mathbf{z}} \tag{7}$$

In a way, this calculation form resembles weighted mean clarification. However, in the method of center of sums, weights are the areas of related membership functions. In the average weights method, this is a membership degree.

**Figure 8.** Averagely the highest membership clarification.

• **Center of the largest area:** If the outlet fuzzy cluster includes at least two convex fuzzy sub‐clusters, center of gravity of the one with the biggest area of convex fuzzy clusters is used in clarification process. Mathematical indication of this method is as shown in Eq. (8):

$$\mathbf{z}^\* = \frac{\text{[mf}\_{\text{Cu}}(\mathbf{z})\text{zdz}}{\text{[mf}\_{\text{Cu}}(\mathbf{z})\text{ dz}}\tag{8}$$

Here, üebç(z) indicates the sub‐region where the convex fuzzy cluster with the biggest area dominates. This circumstance is used when all fuzzy deduction clusters are not convex; however, in the case that all deductions are convex, the result is the same with the one obtained with *z*\* centroid method.

• **The highest first and last membership degree method:** In this method, the lowest (or the highest) fuzzy cluster value with the highest membership degree in the fuzzy cluster that comes up as a combination of all outputs is selected. The equations below are valid for *z*\* value to be given by calculations. At first, the biggest height yeb is determined in the combination of fuzzy cluster deduction, B.

$$\mathbf{y}\_{\text{\tiny obs}}(\mathbf{B}) = \max \left| \mathbf{m} \, \mathbf{f}\_{\text{\tiny g}}(\mathbf{z}) \right| \tag{9}$$

Then, first highest value, *z*\* is found. Another way of this is to find the last highest fuzzy cluster value instead of the first one.

ANFIS name, which means fuzzy deduction system based on open adaptive networks or adaptive neural fuzzy detection system, is made of the first letters of adaptive network‐based fuzzy interface system or adaptive neuro‐fuzzy interface system. This network is the combination of the nodes, which are placed as layers for performing specific functions [5, 21]. ANFIS consists of six layers. This system is presented in **Figure 9**.

Node functions of each layers on ANFIS structure and the operations of layers are briefly explained [23, 24]:


$$y\_i^3 = \prod i = \mu\_{A\_\flat}(x) \ge \mu\_{\mathfrak{z}}(y\_i) = \mu\_i \tag{10}$$

Here, *yi* 3 represents the output values of the third layer and n represents the number of nodes in this layer.

ANFIS Definition of Focal Length for Zoom Lens via Fuzzy Logic Functions http://dx.doi.org/10.5772/67823 307

**Figure 9.** ANFIS network system.

• **Center of the largest area:** If the outlet fuzzy cluster includes at least two convex fuzzy sub‐clusters, center of gravity of the one with the biggest area of convex fuzzy clusters is used in clarification process. Mathematical indication of this method is as shown in Eq. (8):

Here, üebç(z) indicates the sub‐region where the convex fuzzy cluster with the biggest area dominates. This circumstance is used when all fuzzy deduction clusters are not convex; however, in the case that all deductions are convex, the result is the same with the one obtained

• **The highest first and last membership degree method:** In this method, the lowest (or the highest) fuzzy cluster value with the highest membership degree in the fuzzy cluster that comes up as a combination of all outputs is selected. The equations below are valid for *z*\* value to be given by calculations. At first, the biggest height yeb is determined in the combi-

(B) = max[m fB

Then, first highest value, *z*\* is found. Another way of this is to find the last highest fuzzy clus-

ANFIS name, which means fuzzy deduction system based on open adaptive networks or adaptive neural fuzzy detection system, is made of the first letters of adaptive network‐based fuzzy interface system or adaptive neuro‐fuzzy interface system. This network is the combination of the nodes, which are placed as layers for performing specific functions [5, 21].

Node functions of each layers on ANFIS structure and the operations of layers are briefly

• **First layer:** This is called the input layer. Input signals, which are taken from each of the

• **Second layer:** This is called the fuzzification layer. Jang's ANFIS model uses the current Bell activation function as the membership function in order to divide input values into fuzzy sets. Here, output of each node is formed of input values, and membership degrees related to membership function and membership degrees, which are obtained from the

• **Third layer:** This is the rule layer. Each node in this layer expresses the rules and number of Sug-

(*x* ) *x µBj*

represents the output values of the third layer and n represents the number of nodes

<sup>3</sup> = ∏*i* = *µAj*

ANFIS consists of six layers. This system is presented in **Figure 9**.

nodes on this layer, are transferred into other layers.

eno fuzzy logic deduction system. Output of each rule node *µ*<sup>i</sup>

ship degrees coming from second layer, and obtaining *µ*<sup>i</sup>

second layer are shown as *µ*Aj *(x)* and *µ*Bj *(y)*.

*yi*

Here, *yi* 3

in this layer.

(z)

∫mfCm(z ) dz (8)

] (9)

is the multiplication of member-

values are such as (*j*=1,2) and (*i*=1,….,n);

(*y* ) = *µi* (10)

<sup>z</sup>\* <sup>=</sup> ∫mfCm(z )zdz \_\_\_\_\_\_\_\_\_\_

with *z*\* centroid method.

306 Modern Fuzzy Control Systems and Its Applications

nation of fuzzy cluster deduction, B.

yeb

ter value instead of the first one.

explained [23, 24]:

• **Fourth layer:** This is the normalization layer. Each node in this layer assumes all the nodes coming from rule layer as the input value, and it calculates the normalized ignition level of each rule.

Calculation of normalized ignition level i µ is as shown in Eq. (11):

$$\boldsymbol{y}\_{\mu} = \boldsymbol{N}\_{i} = \frac{\mu\_{i}}{\sum\_{i=1}^{n} \mu\_{i}} = \overline{\mu}\_{i} \text{ ( $i = 1, n$ )}\tag{11}$$

• **Fifth layer:** This is the debugging layer. In this layer, weighted result values of a rule, which is given in each node, are calculated. Output value of i node in fifth layer is as shown in Eq. (12):

$$\mathbf{y}\_{\rangle} = \text{Tr}\_{i} [p\_{i}\mathbf{x}\_{1} + q\_{i}\mathbf{x}\_{2} + r\_{i}], \text{ ( $i = 1, n$ )}\tag{12}$$

Here, (*p*<sup>i</sup> *, q*i *, r*i ) variables are result parameter set for i rule.

• **Sixth layer:** This is the sum layer. There is only one node in this layer, and it is tagged with ∑. Here, output values of each node in the fifth layer are added to each other, and a real value of ANFIS system is obtained. System output value y can be calculated with Eq. (13):

$$\mathbf{y} = \sum\_{i=1}^{n} \left[ p\_i \mathbf{x}\_1 + q\_i \mathbf{x}\_2 + r\_i \right] \tag{13}$$

#### **3. Application**

MATLAB is a software development instrument designed for technical calculations and the solutions of mathematical problems. MATLAB, which is the abbreviation of the words "MATrix LABoratory," works using matrixes as understood from its name or, in other words, using arrays. MATLAB, which is estimated to be used by over 500,000 academician, researcher, and students, is also described as the most advanced technical and scientific problem solving and application development instrument of the computer world with many interfaces it includes. MATLAB, particularly used in the analysis of the systems in engineering area, can perform the operations of data analysis and examination, visibility and image processing, generating algorithm prototype, modeling and simulation, programming and application development [25].

Application study consists of two basic steps. These are:


In the application phase, geometric camera calibration study has been performed with bundle block adjustment method by using conventional method as the first step. In this study made by using zoom lens, camera calibration study has been preferred in both minimum and maximum focal lengths for Nikon Coolpix‐E8700 camera whose focal length has been selected. The image of this camera is shown in **Figure 10**.

**Figure 10.** Nikon coolpix‐E8700.

Images of test fields on which there are 145 points have been taken with Nikon Coolpix‐ E8700 digital camera from five angles in the situations of maximum (71.2 mm) and minimum (8.9 mm) focal length of the objective in the Photogrammetry Laboratory of Department of Geodesy and Photogrammetric Engineering of Gebze Technical University. This process is shown in **Figure 11**.

**Figure 11.** Test field shooting plan.

Coordinates of 145 points on test field were determined locally, and these values have been regarded as field coordinate (**ANNEX‐1**). After that, 10 images obtained have been subjected to the evaluation in Topcon Pl‐3000 software, and calibration parameters (inner orientation factors and distortion parameters) have been determined in situations of maximum focal length (71.2 mm) and minimum focal length (8.9 mm) of digital camera. These steps have been explained in **Figures 11** and **12** for both focal distances.

Application study consists of two basic steps. These are:

• Focal length calculation with ANFIS functions

308 Modern Fuzzy Control Systems and Its Applications

image of this camera is shown in **Figure 10**.

shown in **Figure 11**.

**Figure 10.** Nikon coolpix‐E8700.

**Figure 11.** Test field shooting plan.

• Geometric camera calibration with conventional method

In the application phase, geometric camera calibration study has been performed with bundle block adjustment method by using conventional method as the first step. In this study made by using zoom lens, camera calibration study has been preferred in both minimum and maximum focal lengths for Nikon Coolpix‐E8700 camera whose focal length has been selected. The

Images of test fields on which there are 145 points have been taken with Nikon Coolpix‐ E8700 digital camera from five angles in the situations of maximum (71.2 mm) and minimum (8.9 mm) focal length of the objective in the Photogrammetry Laboratory of Department of Geodesy and Photogrammetric Engineering of Gebze Technical University. This process is




ANNEX‐1

**Figure 12.** Camera calibration test field.

35 1.8000000e‐001 4.3500000e‐001 1.0000000e‐002 107 6.9000000e‐001 4.3500000e‐001 1.0000000e‐002 36 1.8000000e‐001 5.2000000e‐001 1.0000000e‐002 108 6.9000000e‐001 5.2000000e‐001 1.0000000e‐002 37 1.8000000e‐001 6.0500000e‐001 1.0000000e‐002 109 6.9000000e‐001 6.0500000e‐001 1.0000000e‐002 38 1.8000000e‐001 6.9000000e‐001 1.0000000e‐002 110 6.9000000e‐001 6.9000000e‐001 1.0000000e‐002 39 1.8000000e‐001 7.7500000e‐001 1.0000000e‐002 111 6.9000000e‐001 7.7500000e‐001 1.0000000e‐002 40 1.8000000e‐001 8.6000000e‐001 1.0000000e‐002 112 6.9000000e‐001 8.6000000e‐001 1.0000000e‐002 41 1.8000000e‐001 1.0300000e+000 1.0000000e‐002 113 6.9000000e‐001 1.0300000e+000 1.0000000e‐002 42 1.8000000e‐001 1.1150000e+000 1.0000000e‐002 114 6.9000000e‐001 1.1150000e+000 1.0000000e‐002 43 1.8000000e‐001 1.2000000e+000 1.0000000e‐002 115 6.9000000e‐001 1.2000000e+000 1.0000000e‐002 44 2.6500000e‐001 1.0000000e‐002 1.0000000e‐002 116 7.7500000e‐001 1.0000000e‐002 1.0000000e‐002 45 2.6500000e‐001 9.5000000e‐002 1.0000000e‐002 117 7.7500000e‐001 9.5000000e‐002 1.0000000e‐002 46 2.6500000e‐001 2.6500000e‐001 1.0000000e‐002 118 7.7500000e‐001 1.8000000e‐001 1.0000000e‐002 47 2.6500000e‐001 4.3500000e‐001 1.0000000e‐002 119 7.7500000e‐001 2.6500000e‐001 1.0000000e‐002 48 2.6500000e‐001 5.2000000e‐001 1.0000000e‐002 120 7.7500000e‐001 3.5000000e‐001 1.0000000e‐002 49 2.6500000e‐001 6.0500000e‐001 1.0000000e‐002 121 7.7500000e‐001 4.3500000e‐001 1.0000000e‐002 50 2.6500000e‐001 6.9000000e‐001 1.0000000e‐002 122 7.7500000e‐001 5.2000000e‐001 1.0000000e‐002 51 2.6500000e‐001 7.7500000e‐001 1.0000000e‐002 123 7.7500000e‐001 6.0500000e‐001 1.0000000e‐002 52 2.6500000e‐001 9.4500000e‐001 1.0000000e‐002 124 7.7500000e‐001 6.9000000e‐001 1.0000000e‐002 53 2.6500000e‐001 1.1150000e+000 1.0000000e‐002 125 7.7500000e‐001 7.7500000e‐001 1.0000000e‐002 54 2.6500000e‐001 1.2000000e+000 1.0000000e‐002 126 7.7500000e‐001 8.6000000e‐001 1.0000000e‐002 55 3.5000000e‐001 1.0000000e‐002 1.0000000e‐002 127 7.7500000e‐001 9.4500000e‐001 1.0000000e‐002 56 3.5000000e‐001 9.5000000e‐002 1.0000000e‐002 128 7.7500000e‐001 1.0300000e+000 1.0000000e‐002 57 3.5000000e‐001 1.8000000e‐001 1.0000000e‐002 129 7.7500000e‐001 1.1150000e+000 1.0000000e‐002 58 3.5000000e‐001 3.5000000e‐001 1.0000000e‐002 130 7.7500000e‐001 1.2000000e+000 1.0000000e‐002 59 3.5000000e‐001 4.3500000e‐001 1.0000000e‐002 131 8.6000000e‐001 1.0000000e‐002 1.0000000e‐002 60 3.5000000e‐001 5.2000000e‐001 1.0000000e‐002 132 8.6000000e‐001 9.5000000e‐002 1.0000000e‐002 61 3.5000000e‐001 6.9000000e‐001 1.0000000e‐002 133 8.6000000e‐001 1.8000000e‐001 1.0000000e‐002 62 3.5000000e‐001 7.7500000e‐001 1.0000000e‐002 134 8.6000000e‐001 2.6500000e‐001 1.0000000e‐002 63 3.5000000e‐001 8.6000000e‐001 1.0000000e‐002 135 8.6000000e‐001 3.5000000e‐001 1.0000000e‐002 64 3.5000000e‐001 1.0300000e+000 1.0000000e‐002 136 8.6000000e‐001 4.3500000e‐001 1.0000000e‐002 65 3.5000000e‐001 1.1150000e+000 1.0000000e‐002 137 8.6000000e‐001 5.2000000e‐001 1.0000000e‐002 66 3.5000000e‐001 1.2000000e+000 1.0000000e‐002 138 8.6000000e‐001 6.0500000e‐001 1.0000000e‐002 67 4.3500000e‐001 1.0000000e‐002 1.0000000e‐002 139 8.6000000e‐001 6.9000000e‐001 1.0000000e‐002 68 4.3500000e‐001 9.5000000e‐002 1.0000000e‐002 140 8.6000000e‐001 7.7500000e‐001 1.0000000e‐002 69 4.3500000e‐001 1.8000000e‐001 1.0000000e‐002 141 8.6000000e‐001 8.6000000e‐001 1.0000000e‐002 70 4.3500000e‐001 2.6500000e‐001 1.0000000e‐002 142 8.6000000e‐001 9.4500000e‐001 1.0000000e‐002 71 4.3500000e‐001 3.5000000e‐001 1.0000000e‐002 143 8.6000000e‐001 1.0300000e+000 1.0000000e‐002 72 4.3500000e‐001 4.3500000e‐001 1.0000000e‐002 144 8.6000000e‐001 1.1150000e+000 1.0000000e‐002

310 Modern Fuzzy Control Systems and Its Applications

145 8.6000000e‐001 1.2000000e+000 1.0000000e‐002

ANNEX‐1

In **Figures 13** and **14**, focal length obtained with bundle block adjustment (conventional method), inner orientation parameters, and radial distortion parameters were summarized from Topcon PI‐3000 software interface.

**Figure 13.** The one obtained by Topcon PI‐3000 program in maximum focal length.

As the second step of the application, image coordinates measured over images have been indicated radially with Eq. (14) for maximum focal length and minimum focal length values of digital camera.

$$\mathbf{c}\_{k} = \frac{\mathbf{r}'}{\tan \pi} \tag{14}$$

ck : calibrated focal length

r1 : radial distance

τ: distortion angle

**Figure 14.** The one obtained by Topcon PI‐3000 program in minimum focal length.

Twenty‐three points have been selected and arranged in the format of training data (smalldata. dat) and remaining 122 points have been arranged in the format of test data (bigdata.dat) as shown in **Figure 15**. ANFIS data set which are used in fuzzification and defuzzification have been composed from equation process with radial distance and angle. This process has been repeated for the images taken from 10 different angles for each zoom distance. ANFIS data set has been composed from equation process with radial distance and angles.

In **Figure 15**, first and fourth columns indicate x values of image coordinates, second and fifth columns indicate y values, and third and sixth columns indicate focal lengths calculated radially.

After ANFIS data set has been generated, an ANFIS application stated below has been performed by using MATLAB software. The basic logic in this application is radial distances selected as input is processed with the help of ANFIS functions, and as a result, a focal length value for each image has been obtained. Algorithm figure determined for this method is indicated below. Here, it is seen that training algorithm determined for generation of ANFIS artificial neural network operates iteratively. Artificial neural network structure shaped with training data described as training data and consisting of 23 points gives result with the last iteration where 122 points are also included for getting the exact result. Thus, a calculation, which includes again the same quantity of measurement (145 radial values) corresponding to focal length distance, is determined with conventional method. For this reason, a logical measurement number equality has been enabled in comparison of ANFIS results with conventional method. In brief, the measurement values in the first and second steps are in the same quantity. This process has been explained in **Figure 16**.


**Figure 15.** ANFIS data set structure for radial distances.

As the second step of the application, image coordinates measured over images have been indicated radially with Eq. (14) for maximum focal length and minimum focal length values

tan <sup>τ</sup> (14)

of digital camera.

: radial distance τ: distortion angle

: calibrated focal length

312 Modern Fuzzy Control Systems and Its Applications

ck

r1

<sup>c</sup><sup>k</sup> <sup>=</sup> <sup>r</sup>*<sup>ı</sup>* \_\_\_\_

**Figure 13.** The one obtained by Topcon PI‐3000 program in maximum focal length.

**Figure 14.** The one obtained by Topcon PI‐3000 program in minimum focal length.

**Figure 16.** ANFIS algorithm.

Each data set has been subjected to process with eight different ANFIS functions (trimf, trapmf, gbellmf, gaussmf, gauss2mf, pimf, dsigmf, and psigmf) as indicated above and quadratic average error values of Artificial Neural Network and ANFIS functions have been obtained. Artificial neural network structure has been shown in **Figure 17** from MATLAB ANFIS interface.

Measured radial values and ANFIS artificial neural network structure have been indicated in **Figure 17**. Quadratic mean errors (standard deviation) of focal length differences related to radial lengths obtained for function structures used in forming artificial neural network have been generated for 10 images in total according to maximum focal length data as shown in **Table 1** and minimum focal length data as shown in **Table 2**. While there are standard deviation values here, focal length value obtained (with bundle block adjustment) in the first step has been used as exact value. At the end of the first step, inner orientation parameters obtained by conventional method will be considered as true, and they will constitute reference data to be used in comparison for the results obtained with second step in other word ANFIS.

**Figure 17.** Artificial neural network structure generation.


**Table 1.** Standard deviation values of maximum focal length obtained with ANFIS functions.

Each data set has been subjected to process with eight different ANFIS functions (trimf, trapmf, gbellmf, gaussmf, gauss2mf, pimf, dsigmf, and psigmf) as indicated above and quadratic average error values of Artificial Neural Network and ANFIS functions have been obtained. Artificial neural network structure has been shown in **Figure 17** from MATLAB

Measured radial values and ANFIS artificial neural network structure have been indicated in **Figure 17**. Quadratic mean errors (standard deviation) of focal length differences related to radial lengths obtained for function structures used in forming artificial neural network have been generated for 10 images in total according to maximum focal length data as shown in **Table 1** and minimum focal length data as shown in **Table 2**. While there are standard deviation values here, focal length value obtained (with bundle block adjustment) in the first step has been used as exact value. At the end of the first step, inner orientation parameters obtained by conventional method will be considered as true, and they will constitute reference data to

be used in comparison for the results obtained with second step in other word ANFIS.

ANFIS interface.

**Figure 17.** Artificial neural network structure generation.

**Figure 16.** ANFIS algorithm.

314 Modern Fuzzy Control Systems and Its Applications

The result of determining focal distance with eight ANFIS functions, which are used in the application and square mean errors which are obtained with these functions, are compared to camera calibration values which are calculated with the conventional method (bundle block adjustment), and the differences of focal distances are illustrated image by image.

The results that eight ANFIS functions have given standard deviations for first image to fifth image depending on the maximum and minimum focal lengths have been detailed in the graphs in **Figures 18** and **19**. When ANFIS method is examined in terms of reliability and inner reliability parameters between selected functions with this application realized, it has been seen that it gives the most suitable results in determination of focal length of trimf and gaussmf functions.


**Table 2.** Standard deviation values of minimum focal length obtained with ANFIS functions.

**Figure 18.** Standard deviations graphic for maximum focal length (71.9 mm).

**Figure 19.** Standard deviations graphic for minimum focal length (8.9 mm).

## **4. Conclusion**

When the results were obtained at the end of the application, it was seen that data with long focal lengths produce lower quadratic mean errors, and test data produced by using short focal length produce higher quadratic mean error values in the same ANFIS functions. When its mathematical structure is considered from radial distortion focal length graphics, it is seen that the shorter the focal length, the more radial distortion error happens. When this situation is considered, it is seen that radial distortion error directly influences the approach to ANFIS functions, and it has an influence on general error amount in data set. In other words, it has been seen that optical distortion law can be verified with the influence of ANFIS functions to data sets. This at the same time proves a physical fact in general table that it verifies ANFIS functions and depicts it in a very proper way.

When the graphics of the functions between each other are examined, it is seen that the most proper (with the least quadratic mean error) or the most usable ANFIS functions in a bundle block adjustment study to be modeled in ANFIS structure related to spatial resection structure are "*trimf, gbellmf and gaussmf*."

It is seen that ANFIS functions, which depict balancing as the weakest (with the highest quadratic mean error), are "*pimf, dsigmf and psigmf*" functions with this approach. When an assessment is made concerning the general of this study to make an approach of spatial resection by using ANFIS system, advantages and disadvantages below will occur for the calibration studies.

Advantages:

**Figure 18.** Standard deviations graphic for maximum focal length (71.9 mm).

316 Modern Fuzzy Control Systems and Its Applications

**Figure 19.** Standard deviations graphic for minimum focal length (8.9 mm).


#### Disadvantages:


As a result of the studies conducted, it has been seen that fuzzy logic approach can be used in the study of calibration of digital cameras. It was determined that the accuracy can be increased by increasing the data number of estimation model established with ANFIS method and estimation can be made benefiting from other artificial intelligence methods. For this reason, it was concluded that it will be more beneficial to use and search fuzzy logic approach more in photogrammetric applications.

## **Author details**

Bahadır Ergün<sup>1</sup> \*, Cumhur Sahin1 and Ugur Kaplan2

\*Address all correspondence to: bergun@gtu.edu.tr

1 Department of Geodesy and Photogrammetry, Gebze Technical University, Gebze, Turkey

2 Department of Mathematics, Gebze Technical University, Gebze, Turkey

## **References**


[8] Roger JS. ANFIS: adaptive network based fuzzy inference systems. IEEE Transactions on Systems Man and Cybernetics. 1993;**23**(3):665‐685. doi:10.1109/21.256541.

As a result of the studies conducted, it has been seen that fuzzy logic approach can be used in the study of calibration of digital cameras. It was determined that the accuracy can be increased by increasing the data number of estimation model established with ANFIS method and estimation can be made benefiting from other artificial intelligence methods. For this reason, it was concluded that it will be more beneficial to use and search fuzzy logic approach

and Ugur Kaplan2

2 Department of Mathematics, Gebze Technical University, Gebze, Turkey

Conference; 18‐21 November 2012; Bangkok, Thailand.

1 Department of Geodesy and Photogrammetry, Gebze Technical University, Gebze, Turkey

[1] Kajornrit J, Wong KW, Fung CC. A comparative analysis of soft computing techniques used to estimate missing precipitation records. In: Proceedings of the 19th ITS Biennial

[2] Mamdani EH, Assilian S. An experiment in linguistic synthesis with a fuzzy logic controller. International Journal of Human‐Computer Studies. 1999;**51**(2):135‐147. doi:10.1006/

[3] Takagi T, Sugeno M. Fuzzy identification of systems and its applications to modeling and control. IEEE Transactions on Systems, Man and Cybernetics. 1985;**15**:116‐132.

[4] Hamam A, Georganas ND. A comparison of mamdani and sugeno fuzzy ınference systems for evaluating the quality of experience of hapto‐audio‐visual applications. In: Proceeding of the IEEE International Workshop on Haptic Audio Visual Environments

[5] Tsoukalas LH, Uhrig RE. Fuzzy and neural approaches in engineering (1st ed.). New

[6] Cıtak E. Fuzzy logic approach to determine the factors affecting hand dexterity [thesis].

[7] Roger JS, Sun C. Functional equivalence between radial basis function networks and fuzzy inference systems. IEEE Transactions on Neural Networks. 1993;**4**:156‐159.

and their Applications 18‐19 October 2008; Ottawa, Canada. IEEE.

York: John Wiley & Sons; 1996, 600 p. ISBN:0471160032.

more in photogrammetric applications.

318 Modern Fuzzy Control Systems and Its Applications

\*, Cumhur Sahin1

\*Address all correspondence to: bergun@gtu.edu.tr

**Author details**

Bahadır Ergün<sup>1</sup>

**References**

ijhc.1973.0303.

WOS:A1985AFX0900011.

Unıversıty of Cukurova; 2008.

doi:10.1109/72.182710.


## **EMG-Controlled Prosthetic Hand with Fuzzy Logic Classification Algorithm**

Beyda Taşar and Arif Gülten

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/intechopen.68242

#### Abstract

[21] Ozbilge EU. An approach of matlab about calibration of digital cameras [thesis]. Gebze

[22] Sugeno M, Kang G. Structure identification of fuzzy model. Fuzzy Sets and Systems.

[23] Ross TJ. Fuzzy logic with engineering applications. Chichester: McGraw‐Hill; 1995,

[24] Hocaoğlu FO, Kurban M. Adaptif ağ tabanlı bulanık mantık çıkarım sistemi ile Eskisehir bolgesi icin güneşlenme süreleri tahmini. Elektrik‐Elektronik‐Bilgisayar Mühendisliği

[25] Mathworks. 2017. Retrieved 25 January 2017, from https://www.mathworks.com/prod-

11. Ulusal Kongresi ve Fuarı, 22‐25 Eylul 2005; Istanbul, Turkiye.

Institute of Technology; 2010.

320 Modern Fuzzy Control Systems and Its Applications

pp. 134‐147. ISBN: 0‐07‐053917‐0.

ucts/matlab.html.

1988;**26**(1):15‐33. doi:10.1016/0165‐0114(88)90113‐3.

In recent years, researchers have conducted many studies on the design and control of prosthesis devices that take the place of a missing limb. Functional ability of prosthesis hands that mimic biological hand functions increases depending on the number of independent finger movements possible. From this perspective, in this study, six different finger movements were given to a prosthesis hand via bioelectrical signals, and the functionality of the prosthesis hand was increased. Bioelectrical signals were recorded by surface electromyography for four muscles with the help of surface electrodes. The recorded bioelectrical signals were subjected to a series of preprocessing and feature extraction processes. In order to create meaningful patterns of motion and an effective cognitive interaction network between the human and the prosthetic hand, fuzzy logic classification algorithms were developed. A five-fingered and 15-jointed prosthetic hand was designed via SolidWorks, and a prosthetic prototype was produced by a 3D printer. In addition, prosthetic hand simulator was designed in Matlab/SimMechanics. Pattern control of both the simulator and the prototype hand in real time was achieved. Position control of motors connected to each joint of the prosthetic hand was provided by a PID controller. Thus, an effective cognitive communication network established between the user, and the real-time pattern control of the prosthesis was provided by bioelectrical signals.

Keywords: EMG, fuzzy logic classification, multifunctional prosthesis hand, pattern recognition

### 1. Introduction

People lose limbs due to accidents and medical conditions. Robotic devices, which imitate the shape and function of a missing limb, are manufactured for use by people who lose their limb in such situations. In recent years, researchers have studied to design and control multifunctional

© 2017 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

prosthetics hand [1–7]. The complexity of the movement, that is, the number of independent movements, increases in proportion to the number of joints. There are 206 bones in the adult skeletal system. The 90 bones of the skull and face are connected to each other by nonimmobilized joints, and the 33 bones of the spine are connected to each other by semi-movable joints. Movable joints are only present between the bones (except the metacarpals bones) of the arm (25) and leg (25). In light of this information, aside from the wrist joints, the human hand has 15 independent joints with three on each finger. Therefore, the biological hand movement involves the control of these joints independently. Thus, control of the hand is quite complex. Thus, of all the human parts, the hand is the most complicated in terms of kinetic analysis [8].

Two main factors enable the functional and visual prosthesis to be used like a biological hand:


However, no matter how perfect the design and manufacture of the prosthetic hand may be, the utility depends on the cognitive interaction, i.e., the control algorithm, being designed properly, e.g., the type of movement and coordination between fingers. If information is not transferred to the prosthetic hand rapidly enough, then the prosthesis will not assume the desired position. Cognitive interaction is the most important factor for user to use effectively. There are many studies about cognitive interaction between human and robotic devices [20–25].

All voluntary muscle movements in humans occur as a result of bioelectrical signals transmitted from the brain through the muscle nerves. Bioelectrical electromyogram (EMG) signals transmitted to the muscles carry information about the type of movement, speed, and degree of muscle contraction or relaxation. The biological hand performs the basic tasks of holding and gripping, which involve various finger movements. The wrist movements essentially constitute the axis and assist in these gripping and holding movements. The main factor that increases the functionality of the prosthetic hand is the movement of the fingers. As the number of independent movements made by the prosthetic hand increases, it can mimic the biological hand more successfully. This study realizes the design of the bioelectrical signal control algorithm and the extension of the bioelectrical signal database with the purpose of increasing the finger motion function of bioelectrical signal-controlled prosthesis hands.

Figure 1 shows bioelectrical signals in the context of the activity of the muscle movements (e.g., flexion, relaxation force), as seen from the block flow diagram. EMG can be used to detect signals from the flexor pollicis longus, flexor carpi radialis, brachioradialis, extensor carpi radialis, extensor digiti minimi, and extensor carpi ulnaris. Bioelectrical signals were recorded with the help of four surface electrodes and subjected to a series of preprocessing and classification operations to understand the relationships between EMG signals and hand and finger movements. These signals were then applied to the prosthetic hand (space and simulator) as a reference motion signal. With the designed controllers, the position of the prosthetic hand finger joints can be controlled. Thus, a cognitive interface and communication network are established between the user and the prosthetic hand. Briefly summarized, the study creates a bioelectrical database of the activities of the hand muscles and the interaction network between the human and prosthetic hand using this database and interface to design a simulator and develop a control algorithm.

Figure 1. Control of multifunctional prosthetic hand simulator and prototype with EMG signals.

## 2. Recording, preprocessing, and featured extractions of EMG signal

#### 2.1. Recording of EMG signals

prosthetics hand [1–7]. The complexity of the movement, that is, the number of independent movements, increases in proportion to the number of joints. There are 206 bones in the adult skeletal system. The 90 bones of the skull and face are connected to each other by nonimmobilized joints, and the 33 bones of the spine are connected to each other by semi-movable joints. Movable joints are only present between the bones (except the metacarpals bones) of the arm (25) and leg (25). In light of this information, aside from the wrist joints, the human hand has 15 independent joints with three on each finger. Therefore, the biological hand movement involves the control of these joints independently. Thus, control of the hand is quite complex. Thus, of all the human parts, the hand is the most complicated in terms of kinetic analysis [8].

Two main factors enable the functional and visual prosthesis to be used like a biological hand:

However, no matter how perfect the design and manufacture of the prosthetic hand may be, the utility depends on the cognitive interaction, i.e., the control algorithm, being designed properly, e.g., the type of movement and coordination between fingers. If information is not transferred to the prosthetic hand rapidly enough, then the prosthesis will not assume the desired position. Cognitive interaction is the most important factor for user to use effectively. There are many

All voluntary muscle movements in humans occur as a result of bioelectrical signals transmitted from the brain through the muscle nerves. Bioelectrical electromyogram (EMG) signals transmitted to the muscles carry information about the type of movement, speed, and degree of muscle contraction or relaxation. The biological hand performs the basic tasks of holding and gripping, which involve various finger movements. The wrist movements essentially constitute the axis and assist in these gripping and holding movements. The main factor that increases the functionality of the prosthetic hand is the movement of the fingers. As the number of independent movements made by the prosthetic hand increases, it can mimic the biological hand more successfully. This study realizes the design of the bioelectrical signal control algorithm and the extension of the bioelectrical signal database with the purpose of increasing the finger motion function of bioelectrical signal-controlled prosthesis hands.

Figure 1 shows bioelectrical signals in the context of the activity of the muscle movements (e.g., flexion, relaxation force), as seen from the block flow diagram. EMG can be used to detect signals from the flexor pollicis longus, flexor carpi radialis, brachioradialis, extensor carpi radialis, extensor digiti minimi, and extensor carpi ulnaris. Bioelectrical signals were recorded with the help of four surface electrodes and subjected to a series of preprocessing and classification operations to understand the relationships between EMG signals and hand and finger movements. These signals were then applied to the prosthetic hand (space and simulator) as a reference motion signal. With the designed controllers, the position of the prosthetic hand finger joints can be controlled. Thus, a cognitive interface and communication network are established between the user and the prosthetic hand. Briefly summarized, the study creates a bioelectrical database of the activities of the hand muscles and the interaction network between the human and prosthetic hand using this database and interface to design a simula-

• Perform the position and speed controls of each joint efficiently and precisely [11–19].

studies about cognitive interaction between human and robotic devices [20–25].

• Prosthetic hand mechanical design and modeling [9, 10] and

322 Modern Fuzzy Control Systems and Its Applications

tor and develop a control algorithm.

EMG signals were recorded from the forearm muscles (the flexor pollicis longus, flexor carpi radialis, brachioradialis, extensor carpi radialis, extensor digiti minimi, and extensor carpi ulnaris) with the help of four surface electrodes. Electrode placements are shown in Figure 2. Electrode layout was chosen according to the protocol [26–28].

The signals, which support movements of the thumb, middle, ring, index, and pinkie fingers, were recorded separately for each of the respective muscles. Channels and finger relations are shown in Table 1.

#### 2.2. Preprocessing of EMG signals

The recorded EMG signals also include various noise signals. It is necessary to separate the noise signals from the EMG signals, so that the characteristics of the signal can be accurately

Figure 2. Placement of surface electrodes.

Figure 3. Preprocessing steps.

determined. For this reason, the raw EMG signal is first preprocessed. The block diagram of the preliminary preparation stage, including the separation, rectification, and sampling of the recorded EMG signals from noise, is shown in Figure 3.

#### 2.2.1. Numerical sampling

EMG signals are analog voltage signals. Their amplitudes change constantly over the voltage range. Analog-to-digital conversion is the process by which the amplitude of the analog signal voltage is represented by a number sequence at specific time points [29–31]. The EMG voltage signals used in this study are converted into a number sequence by sampling with a period of 0.001 s.

#### 2.2.2. Rectification process

Rectification is the evaluation of only the positive parts of the signal. This is done either by halfwave or full-wave rectification of the signal. A full-wave rectification method was applied to preserve the energy of the signal [25, 29–34], and the expression for the method is given in Eq. (1).

$$\mathbf{X}\_{\text{training}} = |\mathbf{x}\ (\mathbf{t})|\tag{1}$$

#### 2.2.3. Smoothing of signal

A bandpass filter (50–500 Hz) was designed to soften the signal by eliminating high-frequency components.

#### 2.2.4. Separate the signal into windows

Before the attributes of the obtained EMG signals are calculated, the frame is processed by the method adjacent to the signal. Experiments in the study of Englehart [18, 19] for framing and optimal framing values (R = 256, r = 32 ms) reached with calculations were used.

#### 2.3. Featured extractions of EMG signal

The EMG signal is a non-stationary, time-varying signal that varies in amplitude by random negative and positive values [25, 31, 32]. Bioelectrical signals have certain characteristic values, i.e., information. Features in time domain have been widely used in medical and engineering practices and researches. Time domain features are used in signal classification due to its easy and quick implementation. Furthermore, they do not need any transformation, and the features are calculated based on raw EMG time series. Moreover, much interference that is acquired through the recording because of their calculations is based on the EMG signal amplitude. However, compared to frequency domain and time-frequency domain, time domain features have been widely used because of their performances of signal classification in low noise environments and their lower computational complexity [29]. In this study, five time domain features methods widely used in the literature have been utilized to obtain the features of the EMG signal.

#### 2.3.1. Signal energy

determined. For this reason, the raw EMG signal is first preprocessed. The block diagram of the preliminary preparation stage, including the separation, rectification, and sampling of the

Channel 1 Channel 2 Channel 3 Channel 4

Pinkie finger muscle Ring finger muscle Middle finger muscle İndex finger muscle

EMG signals are analog voltage signals. Their amplitudes change constantly over the voltage range. Analog-to-digital conversion is the process by which the amplitude of the analog signal voltage is represented by a number sequence at specific time points [29–31]. The EMG voltage signals used in

Rectification is the evaluation of only the positive parts of the signal. This is done either by halfwave or full-wave rectification of the signal. A full-wave rectification method was applied to preserve the energy of the signal [25, 29–34], and the expression for the method is given in Eq. (1).

A bandpass filter (50–500 Hz) was designed to soften the signal by eliminating high-frequency

Before the attributes of the obtained EMG signals are calculated, the frame is processed by the method adjacent to the signal. Experiments in the study of Englehart [18, 19] for framing and

The EMG signal is a non-stationary, time-varying signal that varies in amplitude by random negative and positive values [25, 31, 32]. Bioelectrical signals have certain characteristic values, i.e., information. Features in time domain have been widely used in medical and engineering practices and researches. Time domain features are used in signal classification due to its easy

optimal framing values (R = 256, r = 32 ms) reached with calculations were used.

X\_training ¼ jx ðtÞj ð1Þ

this study are converted into a number sequence by sampling with a period of 0.001 s.

recorded EMG signals from noise, is shown in Figure 3.

2.2.1. Numerical sampling

Figure 3. Preprocessing steps.

Table 1. Channel finger relations.

324 Modern Fuzzy Control Systems and Its Applications

2.2.2. Rectification process

2.2.3. Smoothing of signal

2.2.4. Separate the signal into windows

2.3. Featured extractions of EMG signal

components.

Mathematically, the energy of the signal m (t) is calculated as in Eq. (2), where tj and ti denote the lower and upper bounds of the part of the signal to be integrated, respectively. The above expression represents the area below the absolute value of the signal curve at time T = ti–tj [30–35].

$$E = \int\_{t\_i}^{t\_j} |m(t)| dt \tag{2}$$

#### 2.3.2. Maximum value of signal

The maximum value of the signal represents the largest of the sampled signal values in each packet divided by windows [29].

#### 2.3.3. Signal average value

Mathematically, the average of the signal m (t) is calculated as Eq. (3) [30, 31], where ti and tj denote the upper and lower bounds of the part of the signal to be integrated, respectively. The above expression represents the overall average of the signal at time interval T = ti�tj .

$$AVR = \frac{1}{t\_j - t\_i} \int\_{t\_i}^{t\_j} |m(t)| dt \tag{3}$$

#### 2.3.4. Effective value of the signal

Effective value is a commonly used signal analysis method in the time domain, such as average rectification [29–32]. The effective value of the m(t) signal is calculated as Eq. (4).

$$RMS = \left(\frac{1}{T}\int\_{0}^{t} m^2(t)dt\right)^{\frac{1}{2}}\tag{4}$$

#### 2.3.5. Variance of signal

The variance value of the signal represents the amount of deviation from the mean of the sampled signal values in each packet divided by windows [30]. p(t) is the variance of the signal to represent the probability density function of t:

$$VAR = \left(\frac{1}{T}\int\_0^t (\mathbf{x} - \text{ORT})^2 p(t) dt\right) \tag{5}$$

### 3. Pattern recognition with fuzzy logic algorithm

A classifier's function should be able to map different patterns, match them appropriately, and, in this case, select different hand grip postures. The extracted features were then fed into the fuzzy logic (FL) classifier for the developed control system. FL developed by Lofty Zadeh [35–41] provides a simple way to arrive at a definite conclusion based solely on imprecise input information. A summary of the feature extraction process from the forearm muscles is shown in Table 2 according to motion.

In total, there are 20 features of EMG signal for four channels. In order to make relations easier, a featured function, which occurs at RMS, AVR, MAX, VAR, and E values, is defined for each channel. Finally, the number of inputs is reduced by four. The featured function is calculated as follows in Eq. (6).

$$F\_i = E\_i + AVR\_i + MAX\_i + VAR\_i + RMS\_i \tag{6}$$

For the FL classification analysis, the triangular shape of the membership function (MF) for the inputs (Fi) and output and the centroid method for defuzzification are used. The rules are created


Table 2. Summary of the feature extraction process from the forearm muscles.

based on information from the states of contraction. FLC rules are shown in Table 3. Recorded SEMG signals have been used to initial testing. Then real time data implemented to Prosthetic hand model.

Fi Featured functions were inputs to the FL. The limits of F were set to [0, 20]. The three linguistic variables used were Small (S), Medium (M), and Big (B). The outputs of FL were Hand closure, Hand opening, Index-thumb contact, Middle-thumb contact, Ring-thumb contact, and Pinkythumb contact. Figure 4 shows the flow diagram of FL classification process from four SEMG signals for six hand patterns [35].


3. Pattern recognition with fuzzy logic algorithm

Table 2 according to motion.

326 Modern Fuzzy Control Systems and Its Applications

Signal Hand

closure

Hand opening

follows in Eq. (6).

A classifier's function should be able to map different patterns, match them appropriately, and, in this case, select different hand grip postures. The extracted features were then fed into the fuzzy logic (FL) classifier for the developed control system. FL developed by Lofty Zadeh [35–41] provides a simple way to arrive at a definite conclusion based solely on imprecise input information. A summary of the feature extraction process from the forearm muscles is shown in

In total, there are 20 features of EMG signal for four channels. In order to make relations easier, a featured function, which occurs at RMS, AVR, MAX, VAR, and E values, is defined for each channel. Finally, the number of inputs is reduced by four. The featured function is calculated as

For the FL classification analysis, the triangular shape of the membership function (MF) for the inputs (Fi) and output and the centroid method for defuzzification are used. The rules are created

Energy Channel 1 16,41091 9,949203 5,853087 5,405963 5,354211 12,84222

Maximum value Channel 1 2,378095 1,398911 0,822295 0,61429 0,725287 2,255524

Average value Variance 0,656436 0,397968 0,234123 0,216239 0,214168 0,513689

RMS value Channel 4 0,474695 0,273057 0,163739 0,134428 0,148438 0,387735

Variance Channel 4 0,72476 0,223357 0,08254 0,045411 0,066981 0,508143

Table 2. Summary of the feature extraction process from the forearm muscles.

Index-thumb touch

Channel 2 12,48169 10,92331 7,334108 6,46115 13,25441 5,029002 Channel 3 12,02946 9,254157 8,313991 12,82708 7,183281 4,252198 Channel 4 14,59524 7,548085 11,22431 6,920272 9,376161 4,381767

Channel 2 1,674114 1,183987 1,126519 0,961061 1,90971 0,609637 Channel 3 1,606747 1,351835 1,163335 1,60762 1,147475 0,666139 Channel 4 1,990469 0,844166 1,437937 0,906574 1,485923 0,532234

Channel 1 0,499268 0,436932 0,293364 0,258446 0,530176 0,20116 Channel 2 0,481178 0,370166 0,33256 0,513083 0,287331 0,170088 Channel 3 0,58381 0,301923 0,448973 0,276811 0,375046 0,175271

Channel 1 0,325763 0,25909 0,207215 0,173207 0,370618 0,124443 Channel 2 0,316673 0,25826 0,223731 0,339657 0,213173 0,122159 Channel 3 0,383453 0,188114 0,295885 0,180392 0,269928 0,10675

Channel 1 0,293061 0,15076 0,133987 0,086676 0,422607 0,038505 Channel 2 0,281122 0,204654 0,145503 0,326644 0,150682 0,047588 Channel 3 0,410777 0,089351 0,246002 0,089669 0,232966 0,027352

Fi ¼ Ei þ AVRi þ MAXi þ VARi þ RMSi ð6Þ

Middle-thumb touch

Ring-thumb touch

Pinky-thumb touch

Figure 4. The flow diagram of the control system with FL classification components.

Performance of FL tested 200 hand motions. Classification performance value for the six motions is shown in Table 4.

In the medical decision-making process, ROC analysis method is used to determine the discrimination of the test or classification algorithm. In this study, performance of FLC algorithm for six motion class are demonstrated in Table 5 via ROC analysis.

Performance values calculated as Eqs. (7)–(10) for each hand motion

$$Accuracy(ACC) = \Sigma True\text{ positive} + \Sigma True\text{ negative}/\SigmaTotal\text{ population} \tag{7}$$

Positive predictive valueðPPVÞ, Precision ¼ ΣTrue positive=ΣTest out comepositive ð8Þ

True positive rateðTPRÞ, Sensitivity ¼ ΣTrue positive=ΣCondition positive ð9Þ

$$\text{False positive rate} (\text{FPR}) = \Sigma \text{False positive} / \Sigma \text{Condition negative} \tag{10}$$


Table 4. Classification achievement percentages.


Table 5. ROC analysis.


Table 6. Contingency matrixes.

Performance of FL tested 200 hand motions. Classification performance value for the six

In the medical decision-making process, ROC analysis method is used to determine the discrimination of the test or classification algorithm. In this study, performance of FLC algorithm

AccuracyðACCÞ ¼ ΣTrue positive þ ΣTrue negative=ΣTotal population ð7Þ

True positive rateðTPRÞ, Sensitivity ¼ ΣTrue positive=ΣCondition positive ð9Þ

Number of true classified motion (A)

False positive rateðFPRÞ ¼ ΣFalse positive=ΣCondition negative ð10Þ

Number of wrong classified motion (B)

> Ring-thumb touch

Average percentage of success (%)

Pinky-thumb touch

Positive predictive valueðPPVÞ, Precision ¼ ΣTrue positive=ΣTest out comepositive ð8Þ

for six motion class are demonstrated in Table 5 via ROC analysis. Performance values calculated as Eqs. (7)–(10) for each hand motion

> Tested total number of motion (A + B)

Hand closure MOTION 1 84 84 0 100 Hand opening MOTION 2 84 84 0 100 Index-thumb touch MOTION 3 84 76 8 90.476 Middle-thumb touch MOTION 4 84 66 18 78.57 Ring-thumb touch MOTION 5 84 72 12 85.714 Pinky-thumb touch MOTION 6 84 76 8 90.476

> Index-thumb touch

Hand closure 84 0 0 0 0 0 Hand opening 0 84 0 0 0 0 Index-thumb touch 0 0 76 6 6 4 Middle-thumb touch 0 0 1 66 2 0 Ring-thumb touch 0 0 4 10 72 3 Pinky-thumb touch 0 0 2 0 1 76 No motion 0 0 1 2 1 1

Middle-thumb touch

motions is shown in Table 4.

328 Modern Fuzzy Control Systems and Its Applications

Hand pattern Pattern

number

Table 4. Classification achievement percentages.

Hand closure Hand opening

ROC analysis Motions

Classification algorithm result

Table 5. ROC analysis.

The four outcomes can be formulated in a 2 · 2 contingency table. All contingency matrixes for each motion are shown in Table 6.

### 4. 3D modeling and manufacturing of prosthetic hand

#### 4.1. 3D modeling of prosthetic hand via SolidWorks

In order to develop a multifunctional prosthetic hand model, the structural characteristics of the human hand must first be determined. In other words, it is necessary to determine the number of joints, the number of links, the fingers and the length and width parameters of each finger. In order to obtain a prosthetic hand the same size as a human hand, the hand characteristics of an adult male were recorded as in Table 7 for the purposes of this study [42–44].


Table 7. Part of the hand.

Figure 5. SolidWorks images of prosthetic hand.

Using the parameter values in Table 5, the prosthetic hand 3D model is designed with the help of the SolidWorks program as shown in Figure 5.

#### 4.2. Manufacturing of prosthetic hand via 3D printer

The prototype of the prosthetic hand was produced with the help of the EDISON 3D printer manufactured by 3D Design Company. The necessary adjustments for the production (e.g., resolution, amount of fullness, amount of support) were made using the Simplify 3D program, which was offered by the same company as the software program. After a hand of 16 parts was produced, it was assembled as shown in Figure 6.

Figure 6. Prototype hand.

## 5. Prosthetic hand simulator design

#### 5.1. Mechanical design of prosthetic hand simulator via SimMechanics

SimMechanics used in the realization of simulations of mechanical systems [45, 46]. By transferring the 3D CAD model of the prosthetic hand developed in the SolidWorks program to the Matlab SimMechanics program, a chain structure containing each joint and link of the prosthetic hand was obtained as shown in Figure 7. Five fingers connected to the palm, three rotary hinges forming each finger, and three connecting links are arranged in series to form the hand SimMechanics model.

EMG-Controlled Prosthetic Hand with Fuzzy Logic Classification Algorithm http://dx.doi.org/10.5772/intechopen.68242 331

Figure 7. Prosthetic hand SimMechanics model.

Using the parameter values in Table 5, the prosthetic hand 3D model is designed with the help

The prototype of the prosthetic hand was produced with the help of the EDISON 3D printer manufactured by 3D Design Company. The necessary adjustments for the production (e.g., resolution, amount of fullness, amount of support) were made using the Simplify 3D program, which was offered by the same company as the software program. After a hand of 16 parts was

of the SolidWorks program as shown in Figure 5.

Figure 5. SolidWorks images of prosthetic hand.

330 Modern Fuzzy Control Systems and Its Applications

produced, it was assembled as shown in Figure 6.

5. Prosthetic hand simulator design

SimMechanics model.

Figure 6. Prototype hand.

5.1. Mechanical design of prosthetic hand simulator via SimMechanics

SimMechanics used in the realization of simulations of mechanical systems [45, 46]. By transferring the 3D CAD model of the prosthetic hand developed in the SolidWorks program to the Matlab SimMechanics program, a chain structure containing each joint and link of the prosthetic hand was obtained as shown in Figure 7. Five fingers connected to the palm, three rotary hinges forming each finger, and three connecting links are arranged in series to form the hand

4.2. Manufacturing of prosthetic hand via 3D printer

As shown in Figure 7, when SolidWorks solid model is transferred to Matlab Program, a chain structure composed of revolute and link parts is obtained.

#### 5.2. Modeling of the DC motor

In this study, it was decided to use a DC servo motor for movement of each joint in the prosthetic hand. The equivalent circuit of the DC servo motor is given in Figure 8 [47–49].

Modeling equations of DC motor were expressed in terms of the Laplace variable s as Eqs. (11)–(13).

$$s(Js+B)\Theta(\mathbf{s}) = \mathcal{K}\_l I(\mathbf{s})\tag{11}$$

$$(Ls + R)I(\mathbf{s}) = V(\mathbf{s}) - K\_\epsilon s \theta(\mathbf{s}) \tag{12}$$

We arrive at the following open-loop transfer function by eliminating I(s) between the two equations above, where the rotation is considered the output and the armature voltage is considered the input.

$$\frac{\theta(s)}{V(s)} = \frac{K}{s\left((Ls+R)(Js+b) + K^2\right)}\tag{13}$$

Using the mathematical model of the DC servo motor, the Matlab/Simulink model is constructed as shown in Figure 9.

Figure 8. DC motor electrical and mechanical model.

Figure 9. DC motor Matlab/Simulink model.

#### 6. Controller design

Position of ultra-nano DC servomotors connected to joints is controlled using a PID controller. The controller's proportional gain coefficient (Kp), integral gain coefficient (Ki), and derivative gain (Kd) values are determined by Genetic Algorithm [11, 50–52] to ensure that the system quickly reaches a steady state without overshooting as shown in Table 8. The PID controller has an input-output relationship with input e (t) and output u (t) [53–55].

$$u(t) = K\_p \cdot e(t) + K\_i \cdot \int\_0^t e(\tau) \, d\tau + Kd. \frac{de(t)}{dt} \tag{14}$$


Table 8. PID parameters.

#### 7. Graphical and numerical results

Electromyography is used to measure EMG signals, which are extracted from the forearm muscles and classified with the help of four surface electrodes. The type of motion that one wishes to perform is the perceived and designed three-dimensional prosthetic hand simulator and the five-fingered and 15-jointed hand. These movements were made in real time on the prototype. Each joint of the prosthetic hand is moved with one ultra-nano servomotor, and the position control of the motors is provided by the designed PID.

The prosthetic hand was made with hand closure, hand opening, thumb-index touch, hand opening, thumb-middle touch, hand opening, thumb-ring touch, hand opening, thumb-pinkie touch, and hand opening movements. The hand opening movement is performed after the hand closing movement and touch movement.

1. EMG signals were taken from four channels, four groups of muscles simultaneously, as shown in Figures 10–13, and preprocessed. First, the signal amplitude was scaled from 0 to 10 V and then filtered.

Figure 10. Preprocessing step graphics of EMG signal recorded Channel 1.

Figure 11. Preprocessing step graphics of EMG signal recorded Channel 2.

6. Controller design

Table 8. PID parameters.

Figure 9. DC motor Matlab/Simulink model.

Figure 8. DC motor electrical and mechanical model.

332 Modern Fuzzy Control Systems and Its Applications

7. Graphical and numerical results

Position of ultra-nano DC servomotors connected to joints is controlled using a PID controller. The controller's proportional gain coefficient (Kp), integral gain coefficient (Ki), and derivative gain (Kd) values are determined by Genetic Algorithm [11, 50–52] to ensure that the system quickly reaches a steady state without overshooting as shown in Table 8. The PID controller

> ðt 0

Electromyography is used to measure EMG signals, which are extracted from the forearm muscles and classified with the help of four surface electrodes. The type of motion that one wishes to perform is the perceived and designed three-dimensional prosthetic hand simulator

All DC motors connected the each finger joints 0.42176 0.75724 0.0048566

eðτÞ:dτ þ Kd:

deðtÞ

Kp Ki Kd

dt <sup>ð</sup>14<sup>Þ</sup>

has an input-output relationship with input e (t) and output u (t) [53–55].

uðtÞ ¼ Kp � eðtÞ þ Ki �

Figure 12. Preprocessing step graphics of EMG signal recorded Channel 3.

Figure 13. Preprocessing step graphics of EMG signal recorded Channel 4.


Position control of the finger joints for six hand patterns was provided by the PID controllers as shown in Figures 18–23.

For all finger joints, PID performance is shown in Table 10.

Figure 14. Features graphics of EMG signal recorded Channel 1.

Figure 15. Features graphics of EMG signal recorded Channel 2.

EMG-Controlled Prosthetic Hand with Fuzzy Logic Classification Algorithm http://dx.doi.org/10.5772/intechopen.68242 335

Figure 16. Features graphics of EMG signal recorded Channel 3.

2. As shown in Figures 14–17, the energy, maximum, effective, mean, and variance attribute

4. The specified type of motion information was input to the simulator and the prototype. 5. According to the recognized hand pattern, the reference joint angles in Table 9 were applied as the control input signal, and the closed loop position control of the DC servomotors was performed according to feedback information from sensors connected to the

Position control of the finger joints for six hand patterns was provided by the PID controllers as

values of the respective signals were calculated.

For all finger joints, PID performance is shown in Table 10.

Figure 14. Features graphics of EMG signal recorded Channel 1.

Figure 15. Features graphics of EMG signal recorded Channel 2.

simulator joints.

334 Modern Fuzzy Control Systems and Its Applications

shown in Figures 18–23.

3. Motion pattern was determined by motion classification algorithm.

Figure 17. Features graphics of EMG signal recorded Channel 4.


Table 9. Reference value for each finger joints.

Figure 18. PID response graphics of five fingers for hand close and prosthetic hand photograph.

Figure 19. PID response graphics of five fingers for hand opening and prosthetic hand photograph.

Figure 20. PID response graphics of five fingers for thumb-index touch and prosthetic hand photograph.

EMG-Controlled Prosthetic Hand with Fuzzy Logic Classification Algorithm http://dx.doi.org/10.5772/intechopen.68242 337

Figure 21. PID response graphics of five fingers for thumb-middle touch and prosthetic hand photograph.

Figure 18. PID response graphics of five fingers for hand close and prosthetic hand photograph.

336 Modern Fuzzy Control Systems and Its Applications

Figure 19. PID response graphics of five fingers for hand opening and prosthetic hand photograph.

Figure 20. PID response graphics of five fingers for thumb-index touch and prosthetic hand photograph.

Figure 23. PID response graphics of five fingers for thumb-pinkie touch and prosthetic hand photograph.



Table 10. PID performance value for each joint.

## 8. Conclusion

Finger Joint no Motion 1 Motion 2 Motion 3 Motion 4 Motion 5 Motion 6

Steady state time (s) 9.915 9.71 9.915 0 0 0 Steady state error (deg.) 0.045 10e-4 0.045 0 0 0

Steady state time (s) 9.915 4.555 7.0725 0 0 0 Steady state error (deg.) 0.047 0.0183 0.0219 0 0 0

Steady state time (s) 9.915 4.535 7.429 0 0 0 Steady state error (deg.) 0.047 0.0202 0.0255 0 0 0

Steady state time (s) 10.5022 10.279 0 10.52 0 0 Steady state error (deg.) 0.0474 1e-3 0 0.0475 0 0

Steady state time (s) 10.5022 10.279 0 3.437 0 0 Steady state error (deg.) 0.0474 1e-3 0 0.0036 0 0

Steady state time (s) 10.5022 10.279 0 3.9265 0 0 Steady state error (deg.) 0.0474 1e-3 0 0.0036 0 0

Steady state time (s) 9.922 9.907 0 0 9.914 0 Steady state error (deg.) 0.047 1e-3 0 0 0.047 0

Steady state time (s) 9.915 9.9075 0 0 3.412 0 Steady state error (deg.) 0.047 1e-3 0 0 0.0035 0

Steady state time (s) 9.9055 9.906 0 0 1.884 0 Steady state error (deg.) 0.047 1e-3 0 0 0.0005 0

Steady state time (s) 9.9094 9.9122 0 0 0 9.29 Steady state error (deg.) 0.0475 1e-3 0 0 0 0.0475

Steady state time (s) 9.9094 9.9122 0 0 0 4.8174 Steady state error (deg.) 0.0475 1e-3 0 0 0 0.0052

Steady state time (s) 9.9094 9.9122 0 0 0 1.3391 Steady state error (deg.) 0.0475 1e-3 0 0 0 0

2 Overshoot (deg.) 2.8357 0.3244 0 0 0 2.7883

3 Overshoot (deg.) 2.8357 0.3244 0 0 0 2.636

2 Overshoot (deg.) 2.835 0.0368 2.349 0 0 0

3 Overshoot (deg.) 2.835 0.348 0.377 0 0 0

2 Overshoot (deg.) 2.8356 0.3244 0 2.812 0 0

3 Overshoot (deg.) 2.8356 0.3244 0 2.7812 0 0

2 Overshoot (deg.) 2.8356 0.3244 0 0 2.781 0

3 Overshoot (deg.) 2.8357 0.3244 0 0 2.545 0

Pinkie finger 1 Overshoot (deg.) 2.8356 0.3244 0 0 0 2.8368

Table 10. PID performance value for each joint.

Index finger 1 Overshoot (deg.) 2.835 0.3299 2.835 0 0 0

338 Modern Fuzzy Control Systems and Its Applications

Middle finger 1 Overshoot (deg.) 2.8356 0.3244 0 2.8368 0 0

Ring finger 1 Overshoot (deg.) 2.8356 0.3244 0 0 2.8368 0

The main factor in increasing the functionality of the prosthetic hand to the extent of imitating biological hand functions is the movement of the fingers. The greater the number of movements the fingers can do independently of each other, the greater the ability of the prosthetic hand to move and the more successfully it can mimic the biological hand. Within the scope of this thesis, the function of the prosthetic hand is improved by six different finger movements. Bioelectrical signals of two separate users were recorded from the forearm muscles (the flexor pollicis longus, flexor carpi radialis, brachioradialis, extensor carpi radialis, extensor digiti minimi, and extensor carpi ulnaris) with the help of four surface electrode groups. Thus, a broad bioelectrical signal database was created. The recorded bioelectrical signals were subjected to a series of preprocessing and feature extraction processes to calculate the maximum, effective, mean, variance, and energy values of the EMG signals. An FL classification algorithm was developed to create an effective cognitive interaction network, and 90% classification success was obtained from these algorithms. The identified bioelectrical signals were applied to the designed three-dimensional prosthesis handheld simulator. The five-fingered and 15-jointed prosthetic hand prototypes produced with a 3D printer, and the positional control of the prosthetic finger joints was performed with the designed controllers. Each finger of the prosthetic hand was moved by an ultra-nano DC motor, and the position controls of the motors were provided by the designed PID. Thus, a cognitive interface and communication network were established between the person and the prosthetic hand with great success.

## Acknowledgements

The subject of this chapter, which is Beyda TAŞAR's doctoral thesis, was supported by TÜBİTAK under the Domestic Doctoral Scholarship Program for Priority Areas in 2211 C. In addition, the study was supported by Fırat University Scientific Research Projects Management Unit within the scope of PhD Thesis Project number MF-14.25.

## Author details

Beyda Taşar1 \* and Arif Gülten<sup>2</sup>

\*Address all correspondence to: btasar@firat.edu.tr

1 Firat University, Engineering Faculty, Department of Mechatronics, Elazig, Turkey

2 Firat University, Engineering Faculty, Department of Electrical and Electronics, Elazig, Turkey

### References

[1] Boostani R, Moradi MH. Evaluation of the forearm EMG signal features for the control of a prosthetic hand. Institute of Physics Publishing Physiological Measurement. Physiological Measurement. 2003;24:309-319. PII: S0967-3334(03)38946-4


[15] Englehart K, Hudgins B. A robust, real-time control scheme for multifunction myoelectric control. IEEE Transactions on Biomedical Engineering. 2003;50(7):848–854

[2] Nishikawa D, Yu W, Yokoi H, Kakazu Y. On-line supervising mechanism for learning data in surface electromyogram motion classifiers. Journal and Communication in Japan.

[3] Arieta AH, Katoh R, Yokoi H, Wenwei Y. Development of multi-DOF electromyography prosthetic system using the adaptive joint mechanism. Applied Bionics and Biomechan-

[4] Zhao J, XIie Z, Jing L, Cai H, Hong L, Hırzınger G. EMG control for a five-fingered prosthetic hand based on wavelet transform and autoregressive model. International

[5] Carrozza MC, Cappiello G, Stellin G, Zaccone F, Vecchi F, Micera S, Dario P. On the development of a novel adaptive prosthetic hand with compliant joints: Experimental platform and EMG control. In: Proceedings of the IEEE/RSJ International Conference on

[6] Hocaoğlu E. Data acquisition and feature extraction for classification of prehensile SEMG signal for control of a multifunctional prosthetic hand [Master thesis]. Istanbul: Sabanci

[7] Carozza M, Cappiello G, Stellin G, Zaccone F, Vecchi F, Micera S, Dario P., On the development of a novel adaptive prosthetic hand with compliant joints: Experimental platform and EMG control, Intelligent Robots and Systems, 2005.(IROS 2005). pp. 1271–

[8] Taylor Cl, Schwarz RJ. The anatomy and mechanics of the human hand. Artificial Limbs

[9] Rakibul H, Vepar SH, Hujijbert H. Modeling and control of the Barrett hand for grasping. In: 15th International Conference on Computer Modelling and Simulation; 10–12 April

[10] Hasan R, Rahideh A, Shaheed H. Modeling and interactional of the multifingered hand. In: Proceedings of the 19th International Conference on Automation & Computing.

[11] Michalewicz, Z. Genetic Algorithms + Data Structures = Evolution Programs. Berlin

[12] Widhiada W, Douglas SS, Jenkinson ID, Gomm JB. Design and control of three fingers motion for dexterous assembly of compliant elements. International Journal of Engineer-

[13] Al-Assaf Y, Al-Nashash H. Surface myoelectric classification for prostheses control. Jour-

[14] Parker P, Englehart K, Hudgins B. Myoelectric signal processing for control of powered limb prostheses. Journal of Electromyography and Kinesiology. 2006;16:541–548

Conference on Mechatronics and Automation, China; 2006.

Intelligent Robots and Systems; April 2005. pp. 3951-3956

University, Mechanical Engineering; 2010.

1276, 2-6 August 2005, 10.1109/IROS.2005.1545585

2002;33:14, pp. 2634-2643

340 Modern Fuzzy Control Systems and Its Applications

ics. 2006;3:101-112

2.2. 1955:22.

2013; Cambridge University.

Brunel University, Uxbridge, UK; 2013.

Heidelberg, New York: Springer-Verlag; 1999.

ing, Science and Technology. 2011;3(6):18–34

nal of Medical Engineering & Technology. 2005;29(5):203–207


[44] Taşar B, Gülten A, Yakut O. Kinematic analysis of the human hand for desing prosthetic hand. In: 3rd International Congress on Natural and Engineering Sciences; September 9– 13, 2015; Sarajevo, Bosnia and Herzegovina: International University of Sarajevo

[30] Yazıcı İ. EMG İşaretlerinin İşlenmesi Ve Sınıflandırılması [Master thesis]. Sakarya:

[31] Taşan D. Protez Denetimi İçin Elektromiyografi (EMG)de Örüntü Tanıma, Yüksek Lisans

[32] Akgün G, Demetgül M, Kaplanoğlu E. EMG Sinyallerinin Öznitelik Çıkarımı ve Geri Yayılımlı Yapay Sinir Ağı, Algoritması İle Sınıflandırılması, Otomatik Kontrol Ulusal

[33] Chen WT, Wang Z, Ren X. Characterization of surface EMG signals using improved

[34] Chu J, Moon I, Mun M. A real-time EMG pattern recognition system based on linear-nonlinear feature projection for a multifunction myoelectric hand. IEEE Transactions on

[35] Chan F, Yong-Sheng Y, Lam F, Yuan-Ting Z, Parker P. Fuzzy EMG classification for prosthesis control. IEEE Transactions on Rehabilitation Engineering. 2000;8(3)

[36] Yaraş B, Hüseynov R, Namazov M, ÇeliKKale İE, Şeker M. Fuzzy control and sliding mode fuzzy control of DC motor. Journal Of Engineering And Natural Sciences

[37] Ajiboye A, Weir R. A heuristic fuzzy logic approach to EMG pattern recognition for multifunction prosthesis control. IEEE Transactions on Biomedical Engineering. 2005;52

[38] Karlik B, M.O., T., & M., A. A fuzzy clustering neural network architecture for multifunction upperlimb prosthesis. IEEE Transactions on Biomedical Engineering. 2003;50:1255–1261

[39] Vuskovic M, Du SJ. Classification of prehensile EMG patterns with simplified fuzzy ARTMAP networks. In: Proceedings of the International Joint Conference on Neural

[40] Khzeri M, Jahed M, Sadati N. Neuro-fuzzy surface EMG pattern recognition for multifunctional hand prosthesis control, Industrial Electronics. In: IEEE International

[41] Zheng L, He X. Classification techniques in pattern recognition. In: WSCG, Conference

[42] Taşar B, Yakut O, Gülten A. Object detection and grip force control via force sensor for EMG based prosthesis hand, E205. In: International Conference on Electrical and Elec-

[43] Taşar B, Gülten A, Yakut O. Modeling controlling and simulation of 15 DOF multifunctional prosthesis hand using SimMechanics, C201. In: International Conference

Sakarya University, Institute of Science and Technology; 2008

Mühendislik Ve Fen Bilimleri Dergisi, Sigma. 2014;32:97–108

Toplantısı, TOK2013, Malatya 26–28 Eylül 2013.

342 Modern Fuzzy Control Systems and Its Applications

Biomedical Engineering. 2006;53:2232–2238

(11): 280–291

Symposium; 2007

Networks; 2002, 3, pp. 2539–2544

Proceedings; 2005, ISBN 80-903100-8-7

tronics Engineering (ICEEE); 27–28 Nisan 2015; Ankara

on Automatic Control (ICOAC); 27–28 Nisan 2015; Ankara

Tezi, Ege Universty, Institute of Science and Technology, İzmir, 2008

approximate entropy. Zhejiang University Science B. 2006;7(10): 844–848


**Applications of Fuzzy in Industrial Engineering**
