## 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 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

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):

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):

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, 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’.**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 logically. All of these contexts form the base rule.**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 deductions of each rule together.**Output unit:**It indicates the output values obtained as a result of the interaction of information and fuzzy rule bases with deduction engine.

**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 (x_{1}, x_{2}, and x_{3}), in one of fuzzy system, y as output variant generally; **IF** x_{1} is little and x_{3} is wide, **THEN** it can be expressed as **y = a _{0} + a_{1}x_{1} + a_{2}x_{2} + a_{3}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**.

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.

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.

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.

**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 be indicated with**Figure 6**.**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):

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):

Here
**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).

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.

Clarified value according to this method in graphical indication in
**Figure 8**
is as shown in Eq. (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).

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.

**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 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 y_{eb}is determined in the combination of fuzzy cluster deduction, B.

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]:

**First layer:**This is called the input layer. Input signals, which are taken from each of the nodes on this layer, are transferred into other layers.**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 second layer are shown as*µ*and_{Aj}(x)*µ*._{Bj}(y)**Third layer:**This is the rule layer. Each node in this layer expresses the rules and number of Sugeno fuzzy logic deduction system. Output of each rule node*µ*is the multiplication of membership degrees coming from second layer, and obtaining_{i}*µ*values are such as (_{i}*j*=1,2) and (*i*=1,….,n);

Here,

**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):

**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):

Here, (*p _{i}, 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):

## 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**
.

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**
.

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.

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.

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.

c_{k}: calibrated focal length

r^{1}: radial distance

τ: distortion angle

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**
.

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.

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.

## 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:

There will be no need for generating a separate unreal algorithm for spatial resection step in bundle block adjustment.

Study will be able to be made without the need of approximate rotation and reciprocation parameters.

It will decrease iteration number for bundle block adjustment.

Calibration will be able to be enabled during study not only in minimum and maximum focal lengths but also in all focal lengths.

Disadvantages:

Data sets must be prepared for ANFIS sets. This requires additional time.

It is not possible to reach approximate rotation and reciprocation parameters.

Since the system will directly give result, focal length necessary for calibration will be known only as approximately depending on data number.

It is verified for more than sufficient images that focal length found with additional transaction can be used as calibrated for certain.

All images to be determined for the project must be taken from the same focal length.

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.