Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

The recent developments of advanced digital technologies have caused image concept to enlarge in the last years. Traditionally an optical field, imaging through digital equipment is progressively using a wider range of physical properties of imaged objects. These imaging systems comprise many scientific areas related to medical physics, material analysis, microscopy, astronomy, satellite scanning systems, and many others.

The continuous decrease of digital equipment costs during the last decades is responsible for an increasing number of imaging system users and vice versa. This growth in number of users has enabled many scientists from different areas to acquire and analyze digital images related to their own research environment. Most of these new studies are related with phenomena that were previously observed, but could not be appropriately registered because of appropriate equipment’s high cost.

Multiphase flow phenomena is an important area in which there was a significant number of recent publications related to digital visualization [17]. Thermo-hydraulic studies of multiphase flow using digital visualization have specific problems mostly related with image deformation resulting from cylindrical refraction effects [8]. Image deformations also imply focus imprecision that can cause misinterpretation of estimated parameters. This work will analyze some of these difficulties to show how Paraconsistent Logic (PL) can appropriately deal with them.

Inconsistencies on focus-measure quality indexes applied to acquire digital images are sometimes misinterpreted as part of optical focus phenomena. These inconsistencies are much dependent on each experimental condition, and therefore there is no universal quality index. Alternatively, the use of complex logic systems as PL can enable a systematic, flexible and impartial analysis of the best index to unfold a precise focus, or other image quality property of interest.

This chapter will show how the use of Paraconsistent Logic may improve a correct focus evaluation. An example of appropriate focus imprecision and uncertainty quantification through a Paraconsistent Fuzzy Logic System (PFLS) is expounded.

2 Focus and Image Quality

An important portion of recent imaging studies presents image quality metrics developments [916]. It is important to state some digital image definitions in order to describe this problem more appropriately.

2.1 Digital Image Concept

Digital image is any image representation that can be stored as a binary code and consequently be stored and processed by computers.

The most common representation includes bit words (called bytes) that can be organized on matrixes proportional to original captured information and this representation is usually stored in binary files with specific format. Visual information capture process is realized by electronic micro-devices, usually image sensors, where the most common are called Charged Coupled Device (CCD) [17], Complementary Metal-Oxide-Semiconductor (CMOS) [18] and Foveon X3® sensor [19]. Electronic and computation complex systems are used to make digital information available to be evaluated by algorithms for posterior scientific analysis.

Therefore, digital imaging systems include a variety of not-film-based image capture mechanisms. Even if these systems are not ‘photographic’ in a strict sense, many of them use optical systems, have a limited spectral range and usually store images as digital data to be posteriorly analyzed. Some of the main imaging systems are: thermal imaging, computerized tomography, positron emission tomography, magnetic resonance imaging and ultrasound imaging [20].

2.2 Image Quality

New image compression techniques were developed in order to enable large amounts of image information transmission and storage. A quantitative measure of image quality was necessary to compare distortion and degradation due to lossy compression algorithms [21]. Many different applications need to stablish quality standards related to each image information content as can be seen on x-ray images quality measures [22]. A classical work on this matter was published by Eskicioglu and Fisher [9] where they propose Hosaka plots to be applied to reconstructed images. The importance of statistical measures is more general and can be applied in any application, as they take into account all image processing involved [12].

An important landmark in this research was the wavelet-based measure by Kautsky et al. [10] which was aimed at astronomical imaging. Following this development, a new sharpness metric base on local kurtosis, edge and energy information was developed [15] in order to be applied on high-quality image capture control.

Other measure technique proposal using spatial frequency response was proposed by Williams and Burns [16]. An important evaluation of sharpness measures can be found in more recent conference [23].

2.3 Focus Evaluation

Development of image quality measures has a parallel development of image focus metrics. Both areas have related efforts on new parameter findings. An important evaluation of focus measures applied in multi-focus imaging fusion is described on [14].

Ferzli and Karam [13] proposed another important image sharpness metric landmark called Just Noticeable Blur. A recent method where blur motion parameters are estimated based on a radial basis function neural network is described on [11]. These techniques are important to cope with degradation problems derived from misfocus, atmospheric turbulence, camera or object motion, and many others [22]. Resulting developments of focus-quality evaluation measurements have also been published. They are usually associated with depth maps and with estimation through focusing automation of servo-controlled acquisition mechanism improvements [2427].

Focus study must include a set of sub-concepts that describes important image features related to optical capture conditions, digital processing mechanisms and storing resources used (Fig. 1). The word ‘focus’ is sometimes used to describe superimposed concepts, especially in scientific usage. In order to avoid misunderstanding, this text will use three different definitions to describe different focus aspects:

  1. 1.

    Experimental Optical Focus (EOF): this focus aspect is related to the optical system of the experimental object being studied (Fig. 1). Many times, the experimental apparatus has proper optical features that may include multiple refractions, reflexions, diffractions, and other optical conditions such as photomultipliers in neutron imaging. These optical conditions require specific optical studies in order to evaluate focus distances involved;

  2. 2.

    Capture Optical Focus (COF): this focus aspect is related to all optical properties involved in the capture hardware system (Fig. 1). This system includes the optical capture apparatus (lenses set or objective), the optical capture sensor and the digital camera mechanisms used to control and optimize capture. Usually, COF is mainly determined through the lenses optical center evaluation. The available commercial and scientific objectives usually present more than ten different lenses arrangement, which enables zoom adjustments associated with optical center determination changes;

  3. 3.

    Digital Inferred Focus (DIF): this focus aspect is related to evaluation systems used during image analysis (Fig. 1) which are aimed to obtain EOF estimations. This evaluation usually take into account most of EOF and COF properties including appropriate coupling conditions between them. Some misunderstanding may arise when DIF is simply called ‘focus’ since DIF is essentially an inference result. Image analysis evaluates DIF based on stored image properties. These properties depend both on which electronic hardware, and on which processing software is used to retain acquired image information. Different hardware and software combinations may imply in different pixel resolution or special resolution, which can strongly influence DIF. On the other hand, EOF is estimated based on image acquisition, illumination and optical apparatus parameters. Ideally, DIF should be equal to EOF, but lack of information on acquisition conditions and other imprecisions may imply significant deviations.

Fig. 1
figure 1

Digital image acquisition, processing and storing phases and correspondent focus aspects used in this text (Experimental Optical Focus EOF, Capture Optical Focus COF and Digital Inferred Focus DIF)

Analyzed images enclose some important features that can be used as basis for a quality evaluation. Quality evaluation measures are used to control image acquisition and have been included in new automatic focusing mechanisms. Recover the z distance from object P(x, y, z) to the center of the lens, based on focal distance, is a common task in Image Analysis.

Automatic focusing developments are aimed at a servo-controlled focus ring. This problem can be described as: “Given the projection P′ = (u, v) onto the focal plane of an object point P = (x, y, z) (z unknown), what focal length f produces the sharpest definition of P′ ? ” [28].

Robot focusing ability [24] rises two important focus determination issues: how to command a servo-controlled focus ring to produce best image focus and how to estimate the object distance from lens.

The focal depth improvement (described on Sect. 3.1) in light microscopy through digital image processing techniques [25] is intrinsically related to many works who try to fuse multi-focus image [2934].

Depth map estimation for 3d shape recovery is other common application [27]. Remote sensing and astronomy have similar problems [10].

Microscopic Particle Image Velocimetry is a recently developed technique that has produced many out-of-focus effects which need to have new experimental parameters and algorithms to deal with [26].

A common need in all these studies is a proper standardization of focus quality metrics. Knowledge about focus implies a better efficiency in different imaging phases: acquisition, pre-processing, storing and analysis (Fig. 1).

3 Optical Refraction and Focus Inaccuracy

3.1 Focus on Scientific Image Acquisition

Focus determination is very important to scientific imaging acquisition process as the more obtained image focus you are able to obtain the more information (since noise is properly discarded) about the ‘object of interest’ can be put to use. A first step in order to obtain good image focus is the experiment planning. Therefore is important to appropriately understand the photographic optics involved [35].

The main objective in scientific imaging is to be able to evaluate a specific parameter of interest and its associated error range [20]. The parameter of interest may be one of the geometrical properties like length, width, height or depth, but it can also be related to texture properties like rugosity [36, 37].

Focus range evaluation can be of great use for scientific parameter estimations in situations where the information of depth is of crucial importance.

Krotkov [24, 28] describes a classical scheme based on a thin lens arrangement for the distance evaluation from object to the optical center of lens, which he calls d out . Based on simple geometric properties Krotkov concludes that this depth can be written as: d out  ± DOF, where these parameters are defined [28] by Eqs. 1 and 2:

$$ d_{out} = \left( {\frac{{d_{in} \times f}}{{d_{in} - f}}} \right), $$
(1)
$$ DOF = \frac{{2d_{out} \,afc\left( {d_{out} - f} \right)}}{{a^{2} f^{2} - c^{2} \left( {d_{out} - f} \right)^{2} }}, $$
(2)

where d out is the object distance, a is the aperture diameter, and c the smallest dimension of the sensor.

The depth-of-field (DOF) and depth-of-focus can be estimated based on aperture (a), blur circle diameter (c), d in (image plane) and d out (object plane) distances as can be seen on Fig. 2.

Fig. 2
figure 2

Geometry scheme used by Krotkov [24] to estimate object depth and correspondent depth-of-field (DOF). Distances between lens center and the planes defined by object and image, are called d out and d in . Corresponding focus distances are f out and f in

Using the thin lens formula, a focus error (e) relative to the distance between image plane and detector plane can be expressed as in Eq. 3 [28]:

$$ \frac{1}{{d_{out} }} + \frac{1}{{d_{in} }} - \frac{1}{f} = e. $$
(3)

Therefore, it is possible to determine the best Capture Optical Focus (COF) if f out or d out can be appropriately estimated. However, in many scientific experiments, f out and d out can only be estimated through experimental optics (EOF), which may be independent of optical capture apparatus (Fig. 1). The evaluation of focus error (e), which is associated with image blur (c) is of extreme importance in these experiments. In the next section, some metrics to evaluate Digital Inferred Focus (DIF) based on acquired digital image information will be described.

3.2 Selected Focus Metrics for Use in PFLS

A pair of focus metrics was selected to exemplify the implementation of a PFLS to obtain a focus diagnosis appropriately. The system will be centered in the question (proposition): ‘is the imaged object in focus?’. This question has two main aspects to be analyzed. The first is if there is coherence in DIF evaluation. Focus metrics are important tools to be applied on digital images in order to evaluate the focus quality. This metric alone though, is unable to measure how close DIF is from EOF. Based solely on focus metrics, sometimes is impossible to obtain the object distance (z), or to estimate shape from focus. Shape from focus is a specific field of study, which will not be treated on this chapter.

Even considering only DIF measures, incoherence and discrepancies arises between different metrics, as each one is based on specific statistical properties of overall images. Evaluation of focus may lead to a set of image features that change and gain more importance for each specific metric.

The first selected metric to be evaluated by PFLS was the Gradient Magnitude Maximization method that is described by Krotkov [24] to be firstly cited by Tennebaum in 1970 in his Stanford thesis, ‘Accommodation in Computer Vision’. The method is known as Tenengrad since 1983 [38], and is based in measuring edge characteristics change. The gradient \( {\nabla }I(x,y) \) at each image point (x, y) is evaluated and magnitudes values (Eq. 4) greater than a threshold are summed.

$$ \left| {{\nabla }I\left( {x,y} \right)} \right| = \sqrt {I_{x}^{2} + I_{y}^{2} } , $$
(4)

where the partials can be estimated by Sobel operator convolution [39]. The Sobel operators are classical derivative masks (shown on Eqs. 5 and 6) to be applied through a convolution algorithm to digital images:

$$ G_{x} = \left| {\begin{array}{*{20}l} { - 1} \hfill & { - 2} \hfill & { - 1} \hfill \\ 0 \hfill & 0 \hfill & 0 \hfill \\ 1 \hfill & 2 \hfill & 1 \hfill \\ \end{array} } \right|, $$
(5)
$$ G_{y} = \left| {\begin{array}{*{20}c} { - 1} & 0 & 1 \\ { - 2} & 0 & 2 \\ { - 1} & 0 & 1 \\ \end{array} } \right|. $$
(6)

The gradient magnitude [24] is computed as shown on Eq. 7:

$$ S\left( {x,y} \right) = \sqrt {\left| {G_{x} *I(x,y)} \right|^{2} + \left| {G_{y} *I(x,y)} \right|^{2} } . $$
(7)

Tenengrad focus measurement (fm TN ) is evaluated by summing all S(x, y)2 obtained from image that are greater than a stablished T threshold value. This chapter considered a zero T value for calculations. This is a conservative basis as T = 0 condition includes, in this evaluation, all the present noise contained in the studied bi-dimensional image I(x, y).

The second selected metric used in PFLS evaluation was the Discrete Cosine Transform (DCT) [21, 40]. DCT is otherwise, a metric based on frequency domain properties, and is known to be less sensible to noise presence. The ratio between the DC energy (EDC) and the AC energy (EDC) from the DCT of the image (or part of the image) is considered as the main focus measure (fm) parameter described on Eq. 8:

$$ fm_{CDT} = \frac{{E_{AC} }}{{E_{DC} }}. $$
(8)

This parameter is considered a focus measure as it quantifies the high-frequency components that constitute the image details [41].

Whether both techniques were used to analyze some object of interest inside digital image, traditional logic would lead to the simple following possibilities shown on Table 1:

Table 1 Possible diagnosis for two focus metric techniques applied to an object of interest

Paraconsistent Logic maybe used as a tool to obtain more information from diagnosis results as presented on Table 1. Through PL treatment, more reliable and refined results are possible.

4 Paraconsistent Logic (PL)

Paraconsistent Logic precursors were the Polish logician J. Łukasiewicz and the Russian philosopher N.A. Vasil’év. Both have developed their ideas independently and simultaneously by 1910. Łukasiewicz student, the Polish S. Jaskowski, first proposed a paraconsistent logical system. His proposal was published in 1948 including his ideas about logic and contradiction, and a system known as “Discursive Propositional Calculus”. The logician Newton C.A. da Costa made an independent development from 1954 onwards with the first construction of a paraconsistent first-order predicate calculi and paraconsistent high-order logics [53].

This section is based on the work by researchers Abe and Da Silva Filho [4353], where the Paraconsistent Annotated Evidential Logic Eτ [53] will be used as basis to PFLS. The basic definitions and conventions are as follows: for a given proposition P, a pair of values (µ, λ) is associated, where 0 ≤ µ ≤ 1 is the favorable evidence degree (f e ) in P and 0 ≤ λ ≤ 1 is the unfavorable evidence degree (u e ) in P. This pair defines a domain that is called Hasse reticulate [42, 53]. This reticulate presents four extreme values defined by:

  1. 1.

    (1, 0) intuitively indicates ‘total favorable evidence’,

  2. 2.

    (0, 1) intuitively indicates ‘total unfavorable evidence’,

  3. 3.

    (1, 1) intuitively indicates ‘totally inconsistent evidence’,

  4. 4.

    (0, 0) intuitively indicates ‘evidence absence’, paracomplete condition.

An alternative representation is stated on Table 2:

Table 2 Hasse reticulate extreme values

These same values can be represented in Hasse reticulate as shown o Fig. 3:

Fig. 3
figure 3

Extreme logic states represented on Hasse diagram

The µ and λ values are used to define two variables: the Degree of uncertainty, D uc , and the Degree of certainty, D c . These variables are associated with P proposition. The transformation of the initials variables is performed by Eqs. 9 and 10:

$$ D_{ct} (degree\,of\, uncertainty) =\upmu + \lambda - 1, where - 1 \le D_{uc} \le 1, $$
(9)
$$ D_{c} (degree \,of\,certainty) =\upmu - \lambda , where - 1 \le D_{c} \le 1. $$
(10)

Figure 4 shows a typical example of the reticulated Paraconsistent Annotated Logic subdivided into 12 regions, using the variables degree of certainty and degree of uncertainty [42, 54]:

Fig. 4
figure 4

Dc and Duc logic dominion representation

The diagram shown on Fig. 4 represents twelve logic states:

  1. 1.

    Inconsistent,

  2. 2.

    True,

  3. 3.

    Paracomplete,

  4. 4.

    False,

  5. 5.

    Inconsistent tending to False,

  6. 6.

    Inconsistent tending to True,

  7. 7.

    Quasi-True tending to Inconsistent,

  8. 8.

    Quasi-True tending to Paracomplete,

  9. 9.

    Paracomplete tending to True,

  10. 10.

    Paracomplete tending to False,

  11. 11.

    Quasi-False tending to Paracomplete,

  12. 12.

    Quasi-False tending to Inconsistent.

In the theory of Fuzzy Sets, an x element of the universe of discourse set X is associated with the fuzzy set A by the µ A(x) membership function, with values that vary in the [0, 1] range. This continuous A set can be represented by:

$$ A = \int_{X} {x_{A} \left( {x_{i} } \right)/x_{i} .} $$
(11)

Considering that, using Paraconsistent Logic, a pair of membership functions (µA (x), μB (x)) characterizes a given proposition P; it can be shown that the fuzzy set A can be represented by:

$$ A = \int_{X} {\left( {\upmu_{A} \left( {x_{i} } \right)/x_{i} } \right) +\upmu_{B} \left( {x_{i} } \right)/x_{i} ,} $$
(12)

where the ‘plus’ signal on Eq. 12 may represent logical AND or OR operation. This last equation can be implemented and evaluated through Fuzzy Toolbox from Matlab [56].

4.1 PFLS Implementation

Image acquisition on cylindrical tube has some important optical difficulties due to multiple refractions that happen through cylindrical shape. That implies in variation on focus determination, as for each angle and position relative to the glass interface, image is formed in different distances. In practical terms, the main difficulty in this experiment is to evaluate if the object inside the tube (a vapor bubble inside liquid water) is ‘in focus’ (EOF) (Fig. 11 on Sect. 3).

A correct evaluation of which region of the acquired image is correctly focused (DIF), and which region may be considered blurred, is an important task in order to make possible a good image analysis. This correct evaluation may turn possible a more reliable estimation of flow parameters as void fraction.

One way to apply PL to evaluate if the image, or a part of it, is focused, is applying two different focus measure algorithms in order to obtain relative numeric values. These values can be used (as a universe of discourse) to construct two membership functions that ‘fuzzyfies’ the ‘crisp’ focus measures in order to find µ A and µ B , as shown on Fig. 5.

Fig. 5
figure 5

Tenengrad and Direct Cosine Transform measures used as universe of discourse for µ A and µ B evaluation

The most reliable technique is used as favorable evidence degree (f e ). Considering the current image application example, f e will be the Tenengrad metric. The unfavorable evidence degree (u e ) will be the DCT technique result. Both f e and u e are defined trough evaluated µ A and µ B . These techniques were chosen based on literature information on its efficiency, but for this example, any other metrics could have been chosen.

The following step is to evaluate µ and λ. This is done by using relations shown on Eqs. 13 and 14:

$$ \upmu =\upmu_{A} , $$
(13)
$$ \lambda = 1 - \mu_{B} $$
(14)

The λ evaluation is illustrated on Fig. 6:

Fig. 6
figure 6

Evaluation of µ and λ (degree of favorable and unfavorable evidence) using TN and DCT focus measures respectively

Based on µ and λ values, D c and D uc can be evaluated based on Eqs. 9 and 10. Finally, these D c and D uc values will be used as input to inference rules that will result in a truth-value for proposition P that in present example is ‘is the image on focus?’. The Matlab Fuzzy Toolbox [56] is used to implement all needed fuzzy rules. Figure 7 shows a block diagram representing PFLS implemented.

Fig. 7
figure 7

PFLS block diagram showing two input variables (Dc and Duc) with eight values each, base of rule with 40 rules and output variable (Diagnosis) with 21 possible values

The membership functions are detailed on Figs. 8 and 9.

Fig. 8
figure 8

Degree of certainty input variable composed of eight possible fuzzy values (labels) and their respective degrees of membership

Fig. 9
figure 9

Degree of uncertainty input variable composed of eight possible fuzzy values (labels) and their respective degrees of membership

Where the Degree of Certainty input variable presents the following eight possible fuzzy values (labels):

  1. 1.

    T = True,

  2. 2.

    QT = Quasi-True,

  3. 3.

    LT = Low True,

  4. 4.

    IT = Incipient True,

  5. 5.

    IF = Incipient False

  6. 6.

    LF = Low False,

  7. 7.

    QF = Quasi-False,

  8. 8.

    F = False.

The Degree of Uncertainty input variable presents the following eight possible fuzzy values (labels):

  1. 1.

    I = Inconsistent,

  2. 2.

    QI = Quasi-Inconsistent,

  3. 3.

    LI = Low Inconsistent,

  4. 4.

    II = Incipient Inconsistent,

  5. 5.

    IP = Incipient Paracomplete,

  6. 6.

    LP = Low Paracomplete,

  7. 7.

    QP = Quasi-Paracomplete,

  8. 8.

    P = Paracomplete.

Table 3 exhibits all possible input combinations and their respective output results (Evidence Diagnosis logic states and their corresponding labels). It is a similar structure of a logic classic ‘truth table’, notwithstanding using Paraconsistent Logic’s states. These labels and relations are elaborated similarly as example shown on Fig. 4. The output membership functions were constructed to characterize the output variable Diagnosis that presents 20 different possible values or labels (Fig. 10) where I1 and I2 are the same output value. The PFLS implementation using Matlab Fuzzy Toolbox [56] impose the creation of two variable instances. These values qualify and quantify the logic state of a proposition P: ‘the image or part of it is in focus’. This is equivalent to give a Paraconsistent Logic’s answer to this question. The labels are:

  1. 1.

    Inconsistent—I1,

  2. 2.

    Quasi-Inconsistent tending to False—QIF,

  3. 3.

    Incipient False and Incipient Inconsistent—IFII,

  4. 4.

    Low False and Low Inconsistent—LFLI,

  5. 5.

    Quasi-False tending to Inconsistent—QFI,

  6. 6.

    False—F,

  7. 7.

    Quasi-False tending to Paracomplete—QFP,

  8. 8.

    Low False and Low Paracomplete—LFLP,

  9. 9.

    Incipient False and incipient Paracomplete—IFIP,

  10. 10.

    Quasi-Paracomplete tending to False—QPF,

  11. 11.

    Paracomplete—P,

  12. 12.

    Quasi-Paracomplete tending to True—QPT,

  13. 13.

    Incipient True and incipient Paracomplete—ITIP,

  14. 14.

    Low True and Low Paracomplete—LTLP,

  15. 15.

    Quasi-True tending to Paracomplete—QTP,

  16. 16.

    True—T,

  17. 17.

    Quasi-True tending to Inconsistent—QTI,

  18. 18.

    Low True and Low Inconsistent—LTLI,

  19. 19.

    Incipient True and Incipient Inconsistent—ITII,

  20. 20.

    Quasi-Inconsistent tending to True—QIT,

  21. 21.

    Inconsistent—I2.

Table 3 Logic values (output diagnosis) for each input combination
Fig. 10
figure 10

Diagnosis output variable representation with 17 different possible values. Each value is represented by a triangular membership function, which is identified by a label

5 Image Acquisition on Cylindrical Tubes

Cylindrical tube visualization is an important and common technique used in many different multiphase flow studies.

5.1 Multiphase Flow Applications

Related applications can be found on petroleum extraction industry on profound waters where there is high temperature gradient between internal and external environment. This high gradient favors the existence of multiple phases inside the tube during transportation to the surface (topside facility). These called line risers usually have large diameter, although experiments are confined to much smaller diameters where visualization is important to check some of simulations results [1].

Microchip cooling beds are being tested based on micro-channels containing refrigerant fluid where critical heat flux and other parameters are investigated [24]. Most of these tubes are cylindrical shaped.

Nuclear applications also lead to refrigerant heat transfer studies, where most models use cylindrical tubes. Water refrigerated reactor projects commonly study two-phase flow composed of vapor and liquid phases flow through refrigerant tubes. Two-phase flow patterns are commonly studied based on image acquisition and analysis [57].

5.2 Experimental Acquisition

Specific experimental and theoretical problems related to flow patterns visualization will be used on this work to illustrate focus quality importance on proper image acquisition and analysis.

A proposed solution using Paraconsistent Logic enables comparison of different focus metrics based on experimental knowledge-based rules. Intrinsic difficulties on image acquisition and optics are described based on cylindrical visualization sections.

Cylindrical shape is present in most tubes, including stainless steel and other constituent materials. Experimental laboratories use transparent visualization sections in order to study phenomena using images. Neutron imaging and other systems are also used [6, 7] to study this area.

Therefore, this work analyses the difficulties to acquire optical images through cylindrical glass visualization sections. One of the main difficulties is optical deformation due cylindrical geometry leading to complex refraction optic effects [8]. A correction lens with cubic geometry around cylindrical tubes is used in different experiment configurations in order to attenuate multiple refraction effects. This lenses, however, also brings some additional difficulties on focus precise determination. Precise focus is important for implementing automatic acquisition and analysis procedures.

During acquisition procedure, focus control is one of the main parameters to assure precision on border estimates on posterior image analysis. Many different experimental parameters are usually affected directly by environment factors as spurious vibrations, luminosity, humidity and others. This group of factors can significantly alter final estimated focus and consequently lead to imprecision on border estimation from acquired image analysis and consequent poor control over camera settings during acquisition.

Determining the correct separation between two flow regions may be very important on characterizing flow patterns correctly.

5.3 Pattern Recognition

This chapter authors (R.N. de Mesquita and P.H.F. Masotti) have participated on a previous work on pattern recognition applied to Natural Circulation two-phase flow [5]. Typical images of two-phase flow inside cylindrical tubes are shown on Fig. 11.

Fig. 11
figure 11

Typical upward two-phase flow (air-water) image. Air bubbles present ellipsoidal shapes with different eccentricities. Some of these shapes are due to cylindrical refraction

In Fig. 11 is possible to observe that this kind of image presents different regions with different focus quality measures. Usually the cylindrical glass tube is filled with water. The optical conditions for image acquisition on these experiments include multiple refractions with different geometries and refractive indexes. Focus measure is smaller (blurred edges) for deepest bubbles as COF is adjusted to be near to the front tube interface. Image on Fig. 11 was acquired with camera and objective adjustments to restrict depth of field (DOF) in order to enable object distance estimation from camera. Based on these estimations is possible to distinguish which bubbles are nearer and which are more ‘profound’ (distant from camera). This distinction is important in order to evaluate individual bubble sizes and therefore be able to estimate void fraction values. Void fraction in this case is defined as the volume fraction of bubbles relative to total volume.

With closer observation it is possible to note on Fig. 11 that some bubble are ‘out of focus’ and some are perfectly focused. Most of these discrepancies occur because these bubbles are located at different depths. Restricted COF camera adjustments imply that only the bubbles whose borders are in DOF range (COF ≤ DOF) will present good focus measure values.

Analyzing Fig. 11 is also possible to observe larger optical cylindrical aberrations occurring mainly on bubbles near the right and left tube sides. Cylindrical and spherical refraction aberrations are mostly important for object points that have larger angles from central optical axis, so bubble nearest to side surfaces are more deformed as can be observed. It is important to say that bubbles with bigger depths (farthest from camera) are also ellipsoidal shaped by cylindrical refraction, but in our experiment, are mostly ‘out of focus’.

Natural circulation phenomenon has been included in recent nuclear power plant projects as a heat removal mechanism for specific accidents mitigation [44]. The same mechanism is also used in chemical processes, refrigeration, electronics, etc.

Most of natural circulation test facilities are aimed to simulate conditions of heat removal on these reactors and study changes in flow pattern and hydro-dynamics. Two-phase flow behavior and different instabilities are well known for traditional nuclear power plants.

New two-phase flow pattern features have become available due recent developments on image acquisition and processing techniques. Flow patterns, pressure drop from each phase are correlated with void fraction and flow parameters in most of these studies [45].

5.4 Natural Circulation Facility (NCF)

An important application of focus quality evaluation is acquired images from flow patterns analysis. Authors have been studying [5] these patterns in a Natural Circulation Facility installed at Instituto de Pesquisas Enérgeticas e Nucleares, IPEN/CNEN, São Paulo, Brazil. This facility is an experimental circuit designed to provide data from one and two-phase flow behavior under natural circulation conditions. This loop is presently conceded to IPEN/CNEN by the Chemical Department of Escola Politécnica da Universidade de São Paulo (USP).

NCF is a rectangular assembly (with 2600 mm height and 850 mm width) of borosilicate glass tubes that are temperature resistant, with 38.1 mm internal diameter and 4.42 mm wall thickness each. The loop has a heated section, also made of glass tube with 76.2 mm internal diameter and 880 mm length. This section has two Ni–Cr alloy electric heaters (H1 and H2) in U form and stainless steel cladded. This heaters can deliver up to 8000 W. Approximately 12 l of demineralized water are used to fill the circuit.

Many thermocouples are distributed along the circuit to measure fluid and ambient temperatures. Two Validyne differential pressure transducers are used to measure the relative pressure at the heaters outlet and the water level in the expansion tank.

A data acquisition system is used to acquire sensor data. Visualization is possible in all regions of the circuit, and a visualization section can be mounted with one or more digital cameras and usually use backlight illumination.

Temperature measurements and image acquisition can be concomitantly done in order to characterize phase transition patterns and correlate them with different flow features observable with time synchronism [46].

5.5 Cylindrical Refraction Optics

A typical visualization section for cylindrical tube image acquisition is shown on Figs. 12b and 13 in two views.

Fig. 12
figure 12

Natural circulation facility (NCF) with: a electrical heating section, b visualization section and c cooling section

Fig. 13
figure 13

Cylindrical refraction during digital image acquisition. Focus f1 and f2 differ due multiple refractive indexes and interface shapes

A digital camera is represented on the optical axis relative to cylindrical tube in Fig. 13. The tube usually is filled with water in different flow conditions that may include multiple phases (two-phase flow), different flow speeds and flow dynamics.

In Fig. 14 two different conditions of refraction are represented. The focus distance varies due to multiple refractions through different medium. Two different focus f1 and f2 are represented to illustrate possible three (water-glass-air) refractions. These possible light trajectories are shown to reach the camera digital sensor plane enabling sharp capture if the camera DOF is appropriately set. Cylindrical geometry introduces a focus distance behavior that can be very complex and may induce misunderstanding situations.

Fig. 14
figure 14

Experiment to demonstrate focus determination with variable focus distances

Many times, refractive boxes are not available due to experimental conditions or to acquisition costs involved. In pattern recognition tasks is desirable to have a predictable behavior and correction maps are elaborated [8] for deformations due to cylindrical shape. However, for possible identification of bubble depth, that model presented by Thome et al. [8] cannot be applied. In the absence of refractive box, it would be interesting to evaluate where image plane and focus plane are formed for each acquired image point.

6 Experimental Focus Imprecision Measurement

In this section will be described some experiments where PL application can help to determine and compare different focus measures.

6.1 Experimental Setup

A set of two experiments were done using an arrangement that makes possible image acquisition using different focus distances (Fig. 14). In this arrangement, a cylindrical glass tube of 46.7 mm external diameter and 3.85 mm of wall thickness is partially filled with water. Inside the glass tube, an opaque and rigid polyethylene cylindrical piece of 36.4 mm diameter is used as support for four metallic pins, which are fixed at different depths (5 mm distant from each other) as shown on Figs. 13, 14 and 15.

Fig. 15
figure 15

Frontal image showing focus on the second deeper metallic pin. A focus stair is positioned besides the tube

A CMOS full-frame digital camera with a 100 mm macro lens is mounted on a table trail that allows distance from object to be controlled. The metallic pins are partially immersed by the water that fills the glass tube, as shown of Figs. 14 and 15. It is possible to observe that, in Fig. 15, the upper part of pins do not suffer cylindrical distortion and are horizontally displaced relative to lower part. The unique exception is the third pin, which is on cylindrical optical axis and therefore suffers no significant refraction effect.

6.2 Image Acquisition with Different Focus Distances (COFs) Using a Focus Stair

In this first experiment, a macro lens was adjusted for best focus on consecutive stair steps, as shown on Figs. 14 and 15. Each consecutive step is labelled with consecutive letters in the following order: m, n, o, p, a reference circle (called ‘r’ in this text) and letters s and t. From one step to another, there is a depth difference of 5 mm. A set of seven photographs were made, where each was focused in each labelled step.

The camera was adjusted to an aperture of f/2.8, using speed of 1/320 s, and ISO 3200. The distance from CMOS sensor and object was 49 cm for the last focus stair step (labelled t), which was aligned (same distance from sensor) with the farthest glass tube external wall.

6.3 Image Acquisition with Different Focus Distances (COFs) Adjustments for Each Metallic Pin

In the second experiment, a set of images was acquired adjusting focus distances based on the first experiment results. This time focus distances (COFs) were adjusted to the lower parts of the consecutive metallic pins (submersed). The metallic pins also have 5 mm depth difference between each other.

As can be easily verified, images under water suffer many different refractions due the convergent lens effect (Fig. 13), which changes focus distance for images projected onto digital camera sensor. It is possible to have multiple focuses for the same object, as there are beam lights with small incidence angle to the tube that presents different refraction angles, but still are projected over CMOS surface. As a result, we have blur conditions all over the acquired image, with very small regions where objects present good focus quality.

7 PL Application for a Comparative Evaluation of Focus Quality Measure Indexes

Different ROIs (Regions of Interest) were extracted from acquired images in order to estimate focus measures for each of these parts. Figure 16 shows the chosen regions for cropping. The image analysis was divided into two phases.

Fig. 16
figure 16

Selected ROIs from acquired frontal images for analysis. The white rectangles are ROIs for each metallic pin (p1, p2, p3 and p4) bellow water level. Black rectangles define ROIs for each focus stair step (m, n, o, p, r—reference circle, s, and t)

7.1 Image Analysis of Stair ROIs

Firstly, the ROI focus measures were compared one to the other, for different focus distances. For a comparative study, different ROIs were extracted from acquired images in order to measure the DIF for each of these image parts, as can be seen on Fig. 16. Figure 17 shows an example of cropped ROIs for each step on the same image (image 3, which is the third from the seven taken). The figure also shows, on its lower-right side, a cropped image from the second metallic pin (p2 on Fig. 16). For each step ROI, Tenengrad (TN) and Discrete Cosine Transform (DCT) metrics were applied through algorithms described on Sect. 3.2. Figure 18 shows the TN and DCT results for each letter-labelled step shown on Fig. 17.

Fig. 17
figure 17

Example of image cropped ROIs on each ‘focus stair’ step, with focus distance varying 5 mm from one ROI to the next. The lower right ROI shows the second nearer metallic pin (p2) which is at the same focus distance of step labelled with letter ‘o’

Fig. 18
figure 18

Two selected focus measures evaluated for each ROI shown on Fig. 17

Table 4 presents the TN and DCT values shown on Fig. 18, and shows the Dc and Dct values with the respective PFLS output values (Diagnosis) for each step. These values show that the step with label ‘o’ was considered ‘in focus’. The True (T) PFLS output affirms that solely this step was ‘in focus’, while none of the other steps were considered True for proposition: ‘is in focus?’.

Table 4 TN and DCT focus measures and paracomplete diagnosis for third image

This first part of analysis confirmed that both metrics could detect the best focus object for all seven images. A direct correspondence between COF and EOF was verified for all images of ‘focus stair’ as these images don’t have any refraction optics occurring.

7.2 Image Analysis for Each Metallic Pin

In the second analysis, images from metallic pins were extracted and focus measures were applied. Here it is possible to note that the deeper or farther the pin is more inconsistencies on focus measure arises. Most of these inconsistencies are due to illumination conditions and EOF critical optics. Small-angled light beams can propagate with different large-angled trajectories through the multiple refractions (considering water-glass and glass-air consecutive cylindrical interfaces). This optical effect causes EOF fluctuations and consequent difficulty on EOF estimation based on DIF measures.

Figure 19 shows ROIs extracted from the seven images taken. The four pins are shown with changing focus distance.

Fig. 19
figure 19

ROIs from the four metallic pins (p1, p2, p3 and p4 represented on four column) for seven images (represented in seven lines) with focus distances varying 5 mm from each other

Tables 5, 6, 7 and 8 shows the DCT, TN and correspondent PLFS inputs (Gc and Gct) and outputs (Out and Diagnosis) obtained values for the seven images. Each pin image was compared to find which was ‘in focus’. In this part of the analysis, it is possible to observe that the four pins (corresponding to the four columns on Fig. 19) have a True (T) or Quasi-True (QT) Diagnosis output value for the best-focused pins. This result shows that PLFS could correctly diagnose the focus quality for these pins, although there were inconsistencies on TN and DCT measures.

Table 5 DCT and TN focus measures for first pin (p1) and correspondent PLFS inputs and outputs
Table 6 DCT and TN focus measures for second pin (p2) and correspondent PLFS inputs and outputs
Table 7 DCT and TN focus measures for third pin (p3) and correspondent PLFS inputs and outputs
Table 8 DCT and TN focus measures for fourth pin (p4) and correspondent PLFS inputs and outputs

On Table 5, it is possible to observe that DCT measures were grouped in only three values (1.62 × 103, 1.50 × 103 and 1.48 × 103) differently from TN values that have detected seven different levels of focus quality. However, TN values for image 6 shows a relative good evaluation although this pin image has the worst focus quality as can be seen on first column of Fig. 19.

On Table 6 the same behavior of DCT measure method. There is also only three different values for the seven images of second pin (second column of Fig. 19). TN measure method has a similar problem to evaluate the poor focus of the image 6 of second pin, where the TN value was relatively high.

Table 7 shows that both focus measures techniques failed to evaluate correctly the focus quality gradual increase. TN measure (which was chosen to be the favorable evidence parameter) presented incoherent evaluations for four of the seven images of third pin. DCT measure has also presented incoherent results.

However, the PFLS was able to manage the different evaluations from both metrics, diagnosing the incoherence problems. On image 7 of third pin, DCT value is relatively high, indicating a very good focus quality, although this is not observed. PFLS-Diagnosis output detects some tendency to paracomplete condition.

Table 8 shows that TN evaluates the best-focused image (image 6) with the best focus value. However, DCT evaluations present disagreeing values for the same image 6. This incoherence is diagnosed as a True value with an inconsistency tendency (QTI—Quasi-True Tending to Inconsistent). This image can be viewed on Fig. 19 (Sect. 7.2), sixth line and fourth column.

8 Conclusions

The example presented on this chapter shows that PFLS can be useful to manage inconsistencies of different focus metrics to evaluate scientific cylindrical refraction experiments. This system provides reliable and objective method to compare focus metrics for each part of the image, allowing the detection of these inconsistencies.

The critical refraction distortions registered on captured images may lead to incoherent focus metrics results. PFLS makes possible the use of different pairs of focus metrics to check inconsistencies, and diagnose conflicting results. The two chosen metrics to be compared, in the current example, have been used in many different applications on Digital Image Analysis field. However, any other pair of metrics could have been chosen depending on the experimental conditions.

Digital Image Analysis has a wide range of possible applications for Paraconsistent Logic use, especially on monitoring and diagnosis of defects, diseases and artifacts detection.

Focus determination is a developing field within Digital Image Analysis, who presents many different modalities. Recent multiphasic flow studies have been based on visualization techniques and pattern recognition tasks. Both depend on a correct focus evaluation.

Therefore, this chapter demonstrates one important application of Annotated Logic to directly deal with experimental inconsistencies on scientific digital-image- focus measures.