An optical-flow-based monitoring method for measuring translational motion in infrared-thermographic images of AFP processes

This paper presents a novel method for a precise localization of the automated-fiber-placement head, without the need for a data access to the machine control. It is based on a sub-pixel accurate optical-flow-algorithm which determines information about the heads movement by means of the material flow in sequences of IR images. Using local curvatures in the temperature field of the IR images, feature matrices are created which can locally be compared to the features of successive images. Thus, the translation between images become visible. This enables the possibility to perform an accurate (16.8μm\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$16.8\,\upmu{\mathrm{m}}$$\end{document}) and self-sufficient process monitoring that additionally is capable of capturing the motion and position information of the AFP system and can be linked to existing algorithms for defect detection and classification.


Introduction
Automated-fiber-placement (AFP) processes enable additive manufacturing of high-performance fiber-reinforced composites. AFP processes are undergoing rapid development in line with advances in control systems and studies on the production of fiber-reinforced polymers. This development concerns, among other things, the steadily growing automation in the context of Industry 4.0 strategies. Malhan et al. developed an automated planning process for robotic lay-up of prepreg [21]. In the manufacturing process of fiber composites, Parmar et al. present current and future scenarios related to the application of Industry 4.0 concepts. These include monitoring systems for the detection and avoidance of defects during the manufacturing process [23], as well as a numerical tool for predicting an efficient heating law for AFP processes with thermoplastic prepregs [22].
Although the AFP technology is an established manufacturing process and is used industrially for the production of high-quality laminates, manufacturing or material related defects can occur occasionally. This requires costly manual inspections and subsequent to the lay-up process a nondestructive testing (NDT) of the entire laminate. The manual visual inspection of laminate quality is very time-consuming due to high demands on manufacturing accuracy. High downtimes of AFP machines are a consequence [1,2]. Thus, an in-process monitoring system for an automated and reliable detection of possible material and manufacturing defects is desirable to achieve cost and time savings in inspections and tests. In addition, new technologies and methods are constantly being developed for monitoring systems, such as 3d-printed resistive carbon fiber reinforced sensors for monitoring resin frontal flows during composite manufacturing [19] and carbon coated piezoresistive fiber sensors which are also capable of monitoring the structural health of composites [20]. Such a monitoring system requires the inspection results to be received concurrent to the production process on real-time bases, which limits both the measuring methods and the data processing methods. Denkena et al. [3] present a solution using an online thermographic monitoring system that assigns IR images of the lay-up process to the respective course positions. The lay-up head´s position required for this is received from the machine control of the AFP machine. Every individual IR image is analyzed, temperature anomalies are identified and a classification for predefined production defects is carried out using artificial neuronal networks.
The mechanical properties of a fiber composite component are designed for their specific application. Consequently, similar material or manufacturing defects in different components or areas of a component can have different structure-specific impacts. In addition, the mechanical properties of a component are directly influenced by the size, type and local summation of material and manufacturing defects. Therefore, there is a need for a seamless and geometrically high accuracy detection of any deviation from the ideal structure during production, so that performanceimpairing deviations can be removed before subsequent processes like curing. On the other hand, in some cases less impairing defects may possibly left behind to reduce the effort for correction. Thus, in order to be able to evaluate material and manufacturing deviations an accurate and reliable detection and evaluation system is essential.
The concurrent research aims at detecting production defects during manufacturing by means of thermographic process monitoring and to derive a geometric model of the cured defect in the final component from the thermal data. The geometric model is then used to perform structuralmechanical evaluation of the final part to predict the impact of the defect on the mechanical part characteristic. For a meaningful evaluation, both the geometric dimensions of the defect and its exact position in the laminate are important. Representative Structural Elements (RSE) are to be used for online-evaluation of structural defects during the AFP layup process. The scale of such RSE is dependent on the factors with dominating influence on the structural-mechanical behavior, such as the characteristic defect size. A monitoring system must therefore at least uphold a higher accuracy than the average defect size. This especially applies for local accumulation of material imperfections, where otherwise non-critical production defects may increase the impact factor of neighboring defects and thus could lead to local failure of the structure. As an example, a high accumulation of material splices within a small area might be mentioned. A monitoring system must therefore also take the production history into account, [4].
In order to evaluate the manufacturing process and the component quality efficiently and machine independently, the data used as the starting point for a structural-mechanical evaluation must be subject to criteria for high data quality. These criteria cover precision, consistency, completeness and uniqueness of the data. To achieve the essential data quality criteria for a meaningful evaluation this paper introduces an optical-flow-based method for measuring translational motion in infrared-thermographic images. Each IR image is assigned a position that is determined on the basis of previously acquired image data-without access to a position measurement system of the AFP system. The position information can then be used to convert the IR images into a single thermal image of the entire course, by cropping and stitching all course related images. Thus, enabling a precise, seamless location of relevant thermal data of the structural component, which can then be used to locate and evaluate imperfections.

Preliminary work and state of technology
The surface inspection method of thermal monitoring in [3,18] is based on threshold values that are dependent on machine specific production parameters such as lay-up velocity and compaction pressure, [5]. In order to be independent of machines types and process conditions and thus reduce the associated parameterization effort, the detection and classification of IR images with defects can be performed by artificial intelligence, [6]. Such a monitoring system classifies complete images as either faulty or error-free by using convolutional neuronal networks. Here achieved detection rate greater than 95% testify to the reliability of the system [7]. However, this system depends on the position transmitted by the AFP machine to assign found defects to the corresponding part location. The trigger mechanism and asynchronous cycle times between the IR camera and the machine controller result in inaccuracies while localizing the position at which the IR images where taken. The approach in [7] uses a path-based trigger in an attempt to synchronize the images from the IR camera to the machine controller. The IR camera runs continuously at the nominal frequency of 50Hz and transmits the next IR image following an external trigger signal every 20mm along the course, as depicted in Fig. 1. The accuracy of the image position is thereby directly dependent to the frequency of the IR camera. The loss of precision of the geometric location thus also scales linearly with the speed of the end effector, presuming a constant camera frequency.
At present, there is no possibility of effective image data reduction by cropping of IR recordings, since inaccurate determination of overlapping areas could lead to redundancies and even to incomplete data.
Optical-flow analyses are used to determine movements in image sequences. Consequently this analysis allows the positioning of images relative to each other by extracting suitable features that can be also recognized in the next image. Miller [8] uses optical-flow analysis for video navigation of unmanned aircraft by using the algorithm of Lucas [9] to determine motion vectors of local image areas in successive images. Nooralishahi [10] uses optical-flow analysis with Lowe's Scale-Invariant Feature Transform (SIFT) method [11] to stitch together aerial thermographic images of the earth's surface. This method allows a significant data reduction by discarding redundant image sections.

Method
Redundancy-free thermal component data can be achieved by determining the material flow between successive images to then only remove overlapping image areas. The material flow is determined by using an algorithm based on the optical-flow method.

Technological framework
The in-house-developed AFP experimental system [17] comes with an integrated IR camera (IRS640). The IR camera is aligned at a 30° angle to the tooling surface and has a 7° Scheimpflug adapter to obtain an even depth of field over the entire image, Fig. 2. [5] In order to quantify the relative position of successive images, a geometric transformation is performed beforehand. Presuming a flat laminate, the image transformation is a constant perspective change due to the non-varying relative position between camera and tool surface. By statically transforming the IR-image a constant pixel density is obtained. This in turn allows precise and even distancing in all planar directions across the whole image.
The monitoring of AFP processes by means of an IR camera provides the prerequisite for an optical-flow based evaluation, as the frequency is sufficient to provide the required overlap of individual images for robust optical-flow analysis. Nevertheless, the image characteristics differ greatly from those cases optical-flow method is conventionally used, as the AFP process is a highly dynamic, thermal-transient process and necessary image characteristics change within a few milliseconds. In addition, the IR images of an AFP process contain very simple geometrical features, which further complicate feature extraction and feature assignment to following images.
The research question therefore arises as to whether relative positioning of the individual images to one another is possible despite the thermally unstable image data and without positional information from the machine control system of the AFP machine. The approach to answer the question is to determine the geometrical transversal offset of successive images by means of optical-flow analysis.

Extraction of characteristic features
Optical-flow analyses within image processing often use edge detecting algorithms for feature extraction. Figure 3a shows an acquired thermal images during the AFP process with a vertical lay-up direction (LD) and a horizontal course order (CO), indicated by the frame of reference. The thermal images predominantly contain edges in the direction of the proceeding placement process resulting from the small gaps between two tows or lateral tow edges and are therefore less suitable for determining the positioning orthogonal to the laying direction. Environmental conditions, the material used and the layer in which it is deposited, as well as process parameters such as the velocity of the AFP-head, the temperature of the substrate and the compaction force, have an influence on the global temperature distribution in the thermal image. Therefore, it is first investigated whether other characteristic signal features such as the local curvatures in the temperature distribution-due to natural thermal inhomogeneity in the material-can be used as characteristic features. The local features can be extracted independently of the tested materials from different manufacturers (¼", 12 k, thermoset) and different process and environmental conditions suitable for this application.
The direction-dependent local curvature can be determined by the Hessian matrices H f (x, y) , Fig. 3b-d:  [1,0] correspond to the diagonal curvature measure. The feature matrix M(x, y) is composed of the elements of the Hessian matrix as follows: The feature matrix thus corresponds to a 3-channel image with directionally individual curvature features. The individual image channels were reduced in size, since the calculation via convolutions results in edge effects that do not represent thermal features.

Feature matching
As mentioned before, the perspective of the IR camera does not change during the AFP process, so no additional geometric transformation is necessary before feature assignment.
The transversal offset of two successive images is determined by means of the block-based method by determining the normalized sum of the least squares method of the direction-dependent curvatures, where a block corresponds to the pixels of the same position in each feature channel c . The block-based normalized sum of the least squares method R of a defined area of the feature matrix from the previous image M n−1,c x ∶ − x , 0 ∶ − y at every possible position i, j in the feature matrix of the current image M n,c is calculated via:  Figure 4 shows two successive IR images within an AFP course to the left. The calculated matrix R with the respective normalized sum of the least squares method is shown in Fig. 4 to the right. The illustration shows a symmetrical, circular area-the error ellipse-in which the discrete distribution sum of the normalized least squares method behaves similar to the density of a two dimensional normal distribution. Therefore the algorithm of Förstner [12]-practically implemented as a convolution kernel-can be used to determine the weighted center of gravity S i s , j s |i max , j max ∈ ℝ even though the image information is only finitely available in the pixel grid. The subpixel exact translation is determined to a significance level of = 0.9.
With the procedure described above a subpixel accurate translation vector � ⃗ of the material flow is obtained:

Experimental investigation of the accuracy of the measuring method
The optical-flow-based analysis of the AFP process outputs translation vectors for each IR image pair. To ensure that the generated measured values can be compared with a reference value and evaluated for accuracy, a time difference Δt is assigned to each translation vector, which results from the recording frequency f IR of the IR camera. Consequently, the material flow distance in each corresponding time interval of the lay-up can be determined. Since it can be assumed that the material flow equals the distance travelled by the end effector, these measurement pairs can be tested for correspondence.

Experimental investigation of the accuracy of the measuring method
The accuracy of the calculated material flow distance is estimated by comparing the derived machine parameters from the optical-flow-based process monitoring system to the recorded machine parameters of the AFP system. The measurement is performed during the lay-up of the third layer of a test laminate. In processes with slit-tape as substrate, significantly more thermal features can be found, since inhomogeneity in the temperature distribution occurs between individual tows due to very small air pockets, which result in warmer spots. These can be used as optical features by the algorithm for determining translation. An increase in the number of layers can have a reinforcing effect on the number and extent of the features, since thermal inhomogeneity in lower layers can also be seen to a lesser extent in the current layer. Consequently, in order to maximize the difficulty of finding characteristics and thus validate and evaluate the system under industry-relevant conditions, tape is used in the bottom layer.

Experimental measurements
In the experiment, courses of four ¼"-tows (HexPly® 8552 UD Carbon Prepreg, AS4 (12 K)) are applied over a length of l = 500mm . The relative humidity is 24% and the ambient temperature is 21 • C during lay-up. The target temperature of the substrate in the nip point is 40 • C.The lay-up velocity of the individual courses varies, whereas the velocity during cutting the tow remains constant. The IR camera operates with a nominal frequency of f IR = 75Hz and runs independently of the AFP system. This requires the time axes to be synchronized after conducting the experiments in order to evaluate the accuracy of the optical measurement procedure. It is assumed that the distance covered by the end effector corresponds to the calculated material flow in the thermographic images. The measurements of both the machine control and the optical-flow-based measuring system are synchronized over time for two courses of different lay-up velocities, v 1 = 0.3 m s and v 2 = 0.25 m s . The velocity at the end of every course during cutting the tows is v c = 0.1 m s . The sampling frequency of the optical-flow-based measurement is by a factor of 0.9 lower than the sampling frequency f R = 83.33Hz of the machine controller, due to the IR camera frequency of f IR = 75 Hz.
In Fig. 5 the cumulative course length as well as the calculated velocities of the optical-flow based measurement and the AFP-head position and velocities from the machine control are synchronized over time. The illustrated course has a lay-up velocity of v 1 = 0.3 m s with a deceleration to the velocity of v c = 0.1 m s in the range of 0.6s < t < 1.5s . Especially the calculation of the course length shows a high accuracy. The significantly higher scatter of the velocities is due to the slightly varying frequency of the camera.

Evaluation of the results
The evaluation of the optical measurement procedure-i.e. the quantified accuracy-is carried out by evaluating its precision and trueness, [13]. Precision herein describes a random scattering of measured values. Trueness is a measure of the deviation due to a systematic measurement error. Quantifying the accuracy of the measuring method is performed with a non-parametric method according to Passing and Bablok, which evaluates the power of a method in relation to a reference method, [14].
Each distance between two images can be assigned to a corresponding target distance of the machine control. The paths of the AFP-head from the machine control are interpolated cubically so that the required distance increments used as reference can be derived. All pairs of measurements-the material flow distance between two images and the associated distance acquired from the machine control-serve as data basis for the evaluation. The deceleration to the velocity required for the cut is not considered separately. Pairs of measured values with duplicates in the reference measurement are filtered out of the database, with the remaining pair of measured values being randomly selected.
Passing and Bablok recommend a preliminary correlation check. Here, the non-parametric rank correlation coefficient according to Spearman, [15], is used, whose correlation coefficient = 0.99937 has been determined to a significance level of = 0.01 . Therefore, as ≼ 1 , the condition  Figure 6 shows the linear regression diagram of the optical-flow-based measurement of the distance s 0 against the reference path measurement from machine control to a significance level of = 0.01 . Table 1 shows the descriptive statistics for the two methods and the calculated model coefficients. The value of the intercept is 0.999 m with a confidence interval including 0 . From this, it is derived that there is no systematic difference between the two methods. The gradient coefficient is equal to 0.997 with a confidence interval including 1 . This is interpreted as to that the proportional difference between the two methods is equal to 1 . Consequently, to a significance level of = 0.01 , no systematic or proportional differences between the two methods exist.
For the test to be valid, the assumption of linearity must be checked as well. This is done by a cumulative sum test according to Passing and Bablok, [14]. In Fig. 7 the results of the linearity test are shown. Since the cumulative sum does not exceed the critical values c = ±1.63 at the significance level of = 0.01 the hypothesis of a linear relationship between the two measurement methods holds.

Analysis of the results
A critical analysis is performed on the Bland Altman diagram, Fig. 8, in which the deviations of the optical-flowbased measurement from the reference measurement are plotted against the reference distance, [16]. The average deviation of the measuring differences to the reference distance is = −0.162 μm and spreads with a standard deviation of = 16.8 μm . The majority of the differences lie   It can further be seen that the scattering of measured values increases with increasing reference distance, which in turn is proportional to the end effector velocity. This indicates a direct dependency of the precision of the optical-flow measuring algorithm from the process velocity.
The described relative material-flow measuring method for locating IR-images along the end effector path shows high precision and trueness. Nevertheless, it should be checked whether the optical measuring method is inferior to the absolute measurements of the machine control, since the measurement uncertainty correlates with the absolute number of individual measurements taken. It is therefore desirable to minimize the overlap of successive IR images. In the test case, the maximum diameter of the error ellipse is approx. 5mm , while the image section is approx. 50mm long. Thus, an overlapping of the IR images of 20% is deemed sufficient. At a constant material flow velocity v the number of measurements can thus be reduced by adjusting the recording frequency according to: The number of material flow measurements n for a specific course length l can be determined by: In turn, the measurement uncertainty of independent dispersing quantities can be approximated by: In Fig. 9 the uncertainty of the position assignments to the images depending on the course length are compared. The slash-dotted lines are the average expected uncertainty of the position assignment, where: The dotted lines are the maximal expected uncertainty of the position assignment, where maximal uncertainty of the optical-flow based measurement is approximated by the 6 -interval: When considering the maximal expected uncertainty, the relative position of the last image of courses of 12.755m length is equal for both methods with an uncertainty of 1.8mm at a constant lay-up velocity of v = 0.3 m s . Furthermore, the color indicates the distribution density of the uncertainties, where the uncertainty of machine control assignment is equally distributed compared to the opticalflow based normally distributed uncertainty.

Conclusion and outlook
In this publication a method for sub-pixel accurate opticalflow based measurement of material flow in IR images of the highly thermal-transient AFP process was described. It was proven that the distances calculated with the proposed optical-flow based measuring method, given two follow-up IR images with a pixel density of = 4.9 px mm , achieve a precision of = 16.8 μm with a trueness of | | = 0.162 μm to a significance level of = 0.01 . In the presented study, end effector velocities of up to 0.3 m s were considered. Due to a potential decrease in precision at higher velocities, as was described in Sect. 6.4, further experiments are necessary at a higher velocity range.
The presented measuring method is attributed with high accuracy for relative path measurements and thus is suitable for accurately determining the material flow. The cumulative location uncertainty to the 6 -interval for course lengths of up to 25m were shown to be 2.52mm , so that the need of coupling the optical monitoring system to the machine interface of the AFP machine is considered obsolete for flat laminates.
In addition, the calculated sub-pixel-precise offset of the images can further be used to derive process and machine parameters such as lay-up velocity, course lengths and acceleration of the end effector. A decoupling of the thermal monitoring system would for the first time make it possible to autonomously analyze and monitor an AFP process using IR thermography. The obtained process parameters-i.e. position, velocity, acceleration, and temperature field-can be compared with the target values of the G-code based machine flow chart of the lay-up in order to independently monitor the manufacturing process and detect possible defects in real-time. Furthermore, consistent and redundant-free thermal data of the lay-up process can be efficiently stored in a digital component twin for mechanical evaluation.
Moreover, the material flow determination opens up additional possibilities for the evaluation of component qualities. By determining the translation vector, ondulations orthogonal to the laying direction can potentially also be determined. This must be evaluated in further studies.
Furthermore, investigations were carried out with prepreg materials from two different manufacturers and different compaction forces and substrate temperatures. Although the extracted features have different characteristics, the accuracies in the determination of the optical flow are similar to those presented in this publication. Therefore, it is expected that the presented method is independent of the materials as well as process and environmental conditions designed for this application.