Optical inspection device for the inner surface of pipe ends

The inner surface of the holes in the ends of tubing pipes used in oil production is most prone to deterioration. The mechanical loads combined with corrosion lead to the formation of pits on the surface of the holes. A tubing burst leads to significant financial, technological and environmental losses. The existing methods of non-destructive inspection do not allow to measure the depth of a corrosion pit (cavity) on the surface of the pipe end hole. We propose the construction of the device for monitoring the pipe inner surface closely adjacent to its end. The device uses the optical principle of monitoring the presence and the depth of corrosion pits on the surface of the tubing pipe end hole. The device uses structured lighting of the ring of the hole surface. Judging by the out-of-roundness of the light-shadow border, we evaluated the depth of the defects on the hole surface. The device was tested and calibrated on a special stand, where the depth of the cavity was changed with a step of 30 microns. The reflected light flow from the target surface was recorded by a video camera. Tests of the device showed its resistance to the disturbances in the form of stray lighting, electromagnetic interference, vibrations and dirt in the room (no special operating conditions are required). The length of the corrosion pit does not affect the sensitivity of the device. If the material of the controlled tubing changes, the device shall be calibrated. For a 4 mm long defect, the depth of the corrosion pit up to 1.5 mm can be detected. Preliminary calibration of the device allows to reduce the measurement errors caused by the technological and operational reasons. The developed device is able to detect the presence of a corrosion pit on the hole surface. The accuracy of measuring the depth of the defect on the pipe surface is not less than 150 microns, which is acceptable for oil pipe repair plants. The device can be operated manually and can be built into an automated control system. The monitoring results can be documented. The developed device can be used in other areas: inspection of holes made in reinforced concrete structures, inspection of surface of the holes of chemical production pipes, GTE fuel system, etc.


Introduction
Oil production uses the oil pipes (OCTG) with a length of 6 to 10 m, with various diameters (27-115 mm) and the wall thickness of 3.2 to 7 mm, with external conical thread at the end (hereinafter referred to as nipple). The pipes are connected by means of threaded sleeves tightened with a torque of at least 500-3200 N×m (for smooth pipes) 1 . As a result, the nipple suffers significant tensile, bending and torsional stresses. In addition, the nipple is experiencing the total tensile (compression) stress of the pipe during its operation. On average, the nipple wall thickness is less than the pipe wall thickness. All the above considerations indicate: the nipple is the most loaded part of the tubing.
The stress condition of the nipple contributes to the formation and development of hydrogen and sulfide corrosion cracking at the end of the pipe hole surface in accordance with ISO 15156-2:2009 "Petroleum and natural gas industries -Materials for use in H 2 S-containing environments in oil and gas production -Part 2: Cracking-resistant Carbon and low-alloy steels, and the use of cast irons (MOD)".
If hydrogen sulfide (H 2 S) is contained in the produced oil, sulfide corrosion occurs on the surface of the tubing hole. If CO 2 is contained in the oil-well gas, the surface of the hole is subject to carbon dioxide corrosion.
The following types of corrosion are the most dangerous for the tubing lifetime: pitting [1] and mesa corrosion. The rate of penetration into the hole surface of the pipe can reach 3-10 mm/year for pitting corrosion and 8-10 mm/year for mesa corrosion. 43% of oil pipes destruction in Russia occurs as a result of pitting and mesa-corrosion [2].
The chemically aggressive environment combined with significant nipple stresses result in the fact that the most probable deterioration area of the tubing pipes is the hole surface under the external thread of the pipe. This can be exemplified by oil production under the brand "Urals".
The depth of the surface defect is the most critical parameter for the lifetime of an oil pipe. A tubing pipe is taken out of service when the depth of the defect reaches 25% of the nominal pipe wall thickness 2 . The tubing defects are detected during the nipple repairing.
The Russian regulatory technology documents 2 , the US standard API 570 "Piping Inspection Code: In-service Inspection, Rating, Repair, and Alteration of Piping Systems" and the international standard ISO 10893-10 "Non-destructive testing of steel tubes -Part 10: Automated full peripheral ultrasonic testing of seamless and welded (except submerged arc-welded) steel tubes for the detection of longitudinal and/or transverse imperfections" recommend to use the following methods of surface defects detection [3]: visual, magnetic, ultrasonic, and eddy current.
The visual method is subjective. The assessment of the defect depth depends on the operator, which means that lack of experience, fatigue and malaise of the operator can lead to significant errors.
The paper [4] reviews the theoretical aspect of inspecting the magnetic coiled tubing defects using a magnetic field. This method has several limitations if applied to the inspection of tubing: -the most crucial thing for the lifetime of a pipe is the hole surface under the nipple thread. The presence of the nipple indicates that the pipe has a finite length; -when modeling the defect, it was assumed that the defect has a certain shape (for example, a sphere [4], a blind or a through cylinder [5,6]), while the real surface of the defect has a more complex shape; -the internal pipe body defects are considered, which are formed and inspected during the tubing production, while operational defects are located on the pipe surface; -tubing can be made of polymer, aluminum or stainless alloy, which are not magnetic. The review [7] considers the inspection of tubing defects by ultrasonic methods. The reflections of the ultrasonic wave at the end of the pipe and on nipple threads do not allow to estimate the depth of the defect on the hole surface of the pipe end.
In the paper [8], it is proposed to use the eddy current method to inspect the cracks on the surface of holes of ferromagnetic pipes with the diameter of 70 mm. The hole surface is scanned with a cylindrical probe. Eddy current sensors are installed around the circumference of the probe surface. The gaps between the sensors are the dead zones of the sensors. The authors report a limitation on the size of the controlled defects.
Thus, the known methods have quite a restricted application regarding the inspection of the hole surface of the pipe end. The purpose of this article is to develop a device for monitoring the hole surface of the tubing pipe end, which could control the defect depth.

Research objective
Repair shops located near the drilling site need an inspection device (hereinafterthe ID) for monitoring the hole surface of the tubing pipe end. This means that the design of the ID shall meet the following requirements: -the operation of the ID should not involve qualified specialists; -the ID should work in extreme conditions (temperature fluctuations, high humidity, unqualified operators); -the ID should not be sensitive to the tubing material (pipes can be made of steel, stainless alloy, aluminum alloy or polymer); -the inspection accuracy should comply with the regulatory documents for tubing operations; -the cost should be low. The distance from the end to the stop face of the tubing pipe depends on the pipe diameter and amounts to 63-98 mm (for smooth pipes 29-65 mm). In oil production in Russia, tubing pipes with the nominal diameter of 73 and 89 mm are used the most widely (the hole diameter is 62 and 76 mm). Therefore, the device for optical inspection of the internal surface of the pipe end shall: -control the depth of the defect of the hole surface at a distance from 0 to at least 100 mm from the pipe end; -the ID should control the hole surface with the diameter of 62 to 76 mm. In our opinion, it is advisable to use an optical inspection system to fulfill all the above requirements.
The review [9] analyses various optical systems for monitoring the surface of through-holes of smooth-bore weapons, NPP fuel rods, ceramic ring insulators, etc. The control area on the bore surface is formed by diffraction elements (DOE) [10][11]. We believe that the device shown in the paper [12] has the most appropriate design for the inspection of hole surface of the tubing end. A peculiarity of the proposed device is the use of DOE as a source of ring illumination [13][14]. In this case, the inner surface of the hole is scanned by moving the light ring along the axis of the hole.
The disadvantages of this design are as follows: -the use of laser as a light source reduces the reliability of the device; -the use of DOE is associated with the possible stray diffraction orders and the likely decrease of lighting energy efficiency [15][16]; -the means of recording the reflected light flux are located behind the lighting source and the DOE (Fig. 1). In this case, the information channel shall be output through the opposite end of the pipe. This is unacceptable during the tubing repair operations. This article continues and develops the work on the design of the optical inspection device proposed by us in the paper [17]. In particular, the design [17] has a number of disadvantages: -it is intended for the situation when the body of the inspection device and the surface of the tubing hole are coaxial; -it does not take into account the defects on the surface of the tubing hole that could have occurred during the pipe manufacture (ovality) and/or during its transportation (bending); -it does not take into account the effect of its position relative to the ID on the accuracy of the estimation of the depth of the hole surface defect; -the possibility of tilting the axis of the device relative to the hole surface was not taken into account (the presence of tilt reduces the inspection accuracy). We suggest a modernized digital optical device for monitoring the surface of the pipe hole (Fig. 2), which differs from [17] by a more advanced image processing algorithm for the inspected hole surface. To improve the inspection accuracy of the depth of the hole surface defect (including the corrosion pit), we upgraded the bench that we used to calibrate the device in [17]. The bench upgrade involved the feature of changing the position of the corrosion cavity model in relation to the ID with a given accuracy. Also, the design of the upgraded stand provided for the possibility to adjust the axial tint angle of the ID in relation to the hole surface. The advantage of the suggested optical scheme (Fig. 2) is the formation of a sharp boundary between the illuminated area and the shadow area on the controlled surface of the hole. A ring-shaped sharp border is formed by the light flux from the light source 1 and is limited by an annular groove 3 of the aperture annular diaphragm 2.
The light-shadow border is a structured image [18] of the hole surface section. Mathematical methods of image processing [19][20][21] allow to identify the defect and estimate its depth on the hole surface. It is sufficient to move the ID to a specified distance along the hole axis to identify corrosion pits on the hole surface of the pipe end. Such movement is possible if there is a gap between the hole surface and the cylindrical surface of the inspection device. The hole surface of the end of tubing pipe with the length over 6 meters, is inspected when the pipe is in the horizontal position. In this case, the gap between the tubing surface and the ID surface varies from 0 to (Fig. 2 b). This leads to variable sensitivity of ID to the corrosion pit depth. The device will have the maximum sensitivity at the lowest point of the tubing pipe hole, and the minimum sensitivity at the top point. This means that in the areas of the hole where the gap reaches the maximum value, the depth of the corrosion pit will be estimated with the lowest accuracy.
It should be noted that the hole along the pipe axis may have deviations from the nominal diameter up to 0.9 mm or 12.5% of the pipe wall thickness (less than 8 mm) according to GOST R 52203-2004 Tubing and coupling. Specifications. This fact also reduces the inspection accuracy of the corrosion cavity depth. In order to improve the accuracy of the corrosion cavity depth inspection, we used computer techniques to process the image of the hole surface formed by the video camera 6. We lightened the ring on the inspected tubing surface, and the reflected light formed three circles on the video camera: O1, O2 and O3 (Fig.3). The circles had different centers: C1, C2 and C3. Circle O1 corresponds to the cylindrical body of the ID. О2 corresponds to the border of the ring closest to the video camera 6, and О3 corresponds to the border of the ring that is far from the video camera 6. a) b) Figure 3. Image of the inspected surface: aimage from the video camera; bscheme of the circles on the image from the video camera.
Misalignment of the circles O1, O2 and O3 is caused by the following factors: 1. The defects of the hole shape along the length of the tubing pipes; 2. The tilt of the ID axis relative to the hole surface, performed by the operator; 3. The combined effect of the factors of i.1 and i.2. Fig. 4a shows an enlarged image of the locations of the centers C1, C2 and C3. The circle O1 with the center C1 corresponds to the cylindrical surface of the ID with the known diameter (60 mm). For this reason, we chose the axis of the cylindrical surface of the ID as a measuring base, and all measurements were performed in relation to it. The center C1 of the circle O1 always belongs to the axis of symmetry of the cylindrical surface of the ID. The angle α is formed by a horizontal line and a half-line through the centers C1 and C2. The angle β is formed by a horizontal line and a half-line through the centers C1 and C3.
The reason for the mismatch of the centers C2 and C3 of the circles O2 and O3 is the change in the hole diameter within the width of the ring of light illuminating the inspected surface of the hole.
If the entire surface of the hole corresponds to the nominal size, and there is no bend on the inspected surface fragment, the centers C1, C2 and C3 shall be located on the same vertical axis. The shape of the tubing hole in each section along the length of the pipe may deviate from roundness (Fig.  4b). For this reason, we explain the displacement of the center C2 relative to the center C1 by bending the axis of the hole (see Fig. 4c) or by changing the diameter of the tubing hole within the allowable limits (see Fig. 4b).
In addition, the mismatch of the centers C1 and C2, C3 is caused by misalignment of the ID in relation to the hole surface (see item 2).
We explain the vertical displacement of C3 in relation to C1 by the horizontal position of tubing during the hole surface inspection. The contact of the ID and the hole surface for this case is shown in Fig. 2b. The biggest distance between the nominal cylindrical surface of the ID and the real surface of the inspection device is known with the accuracy up to the permissible deviations of the hole diameter from its nominal size (see GOST R 52203-2004 Tubing and coupling. Specifications).
When inspecting the corrosion pit depth in a raster image of the hole surface, all the said disturbances should be taken into account, as well as video camera 6 resolution (Fig. 2).

Problem-solving methods
We considered that the geometric shapes of the tubing hole surface in the image are circles (Fig. 3a). But the actual figures in the image are more like the ellipses. This is due to the following reasons: -optical system of the hole surface inspection (Fig. 2a); -horizontal position of the ID (Fig. 2b); -possible misalignment of the ID in relation to the hole surface; -various reflective power of the inspected surface, including the roughness. Our analysis showed that these reasons can lead to errors in measuring the depth of the corrosion cavity in the range from 0.5 to 1.5%. The experience of oil pipes operation in Russia recommends to measure the depth of the corrosion cavity with the accuracy of at least 0.15-0.2 mm. We believe that such working accuracy can be achieved if we consider that the geometric shapes in Fig. 3a are the circles.
We used the Hough transform [22][23][24] to search for circles and their centers in the raster image shown in Fig. 3a.
We used the ID to determine with a pixel accuracy the distances between the centers of circles O1 and O2, O1 and O3, as well as the angles α and β between the horizontal line and the half-lines through the centers C1, C2 and C1, C3 respectively, in the raster image of the hole surface (Fig. 3a). Since the diameter of the circle C1 (the diameter of the cylindrical body of the ID) is known to us (60 mm), we have determined the correspondence between the pixel side length and the unit of length (image resolution) on the raster image.
With the real parameters of the ID displacement in the tubing hole, we determined the spatial orientation of the device. The information about the position of the inspection device in the oil pipe hole allowed us to compensate for the measured depth of the corrosion pit. We used the preliminary calibration of the device on the bench to determine the influence of the hole surface out-of-roundness and the tilt of the ID axis in relation to the hole surface on the accuracy of the corrosion pit depth measurement.

Inspection methods
In accordance with the Russian Ruling Document 2 , the tubing inspection is carried out on nondestructive test equipment. Therewith, the equipment sensitivity adjustment is performed on a working test sample made of a smooth part of the pipe of the target size with the special artificial defects.
Taking into account the above requirements, we have developed a bench for test and adjustment of the ID for the control of the depth of the corrosion pits on the tubing end hole surface (Fig. 5). a) b) c) Figure 5. The bench for test and adjustment of the ID for control of the depth of the corrosion pits on the tubing end hole surface: aappearance of the bench; bappearance of the bench with partiallytransparent surfaces; cfront section of the bench. Legend: 1pipe; 2through-holes; 3cylindric dead holes; 4 -female-threaded bushes; 5matchmarks; 6screws; 7 -cylinders; 8 -matchmark. The inner diameter of the pipe 1, the surface of which was inspected on the bench, is estimated at 62 mm, it corresponds to the tubing pipe 73 compliant with the Russian standard GOST 633-80 "Tubing pipes and couplings for them. Specifications", and the US standard API 5CT "Specification for Casing and Tubing" and the international standard ISO 11960: 2011 "Petroleum and natural gas industries-Steel pipes for use as casing or tubing for wells". Two through-holes with the diameters of 4, 8, 12 and 14 mm were made in the pipe 1 perpendicular to its outer surface. The axes of the holes 2 belong to mutually perpendicular planes. Threaded bushes 3 with 16 symmetrical matchmarks 4 are installed in axial alignment with the axes of the holes 2 on the external surface of the pipe. The length of the threaded part of the bushes 3 is 25 mm. Screws 6 are installed in the bushes 4 via a threaded connection. The end of the screw 6 directed towards the axis of the pipe 1, is made in the form of a coaxial cylinder 7. The cylindric dead holes 3 are made on the outer surface of the pipe 1 coaxially with the holes 2. The bushes 4 with a female thread (M20 × 0.5) are installed coaxially in the holes 3 and fixed. The diameter of the cylinder 7 corresponds to one of the diameters of the holes 2. Therewith, the surface of the cylinder 7 and the surface of the hole 2 match along a sliding fit. At the other end of the screw 6, a matchmark 8 and a hexagonal key groove are made. The bench details are made of carbon steel.
The movement of the screws 6 along the thread in the sleeves 4 leads to the movement of the cylinder 7 in the hole 2. In this case, the end face of the cylinder 7 moves relative to the surface of the hole of the pipe 1.
By adjusting the displacement of the end face of the cylinder 7 relative to the surface of the hole of the pipe 1, we simulate the depth of the corrosion pit. Turning the screw 6 through the angle between the two matchmarks 5 allows to simulate the depth of the corrosion cavity with an accuracy of 0.5 mm/16 = 0.03125 mm. The matchmark 8 at the end of the screw 6 allows to adjust the depth of the corrosion pit with an accuracy of 0.03125/2 = 0.01562 mm. We did not find any sources of information indicating the required accuracy of determining the depth of the corrosion pit.
Different diameter of the holes 2 allows us to simulate the longitudinal length (in the direction of the device movement) of the corrosion pits.
In order to materialize the optical scheme shown in Fig. 2, we developed a device with the design shown in Fig. 6. We chose the design of the ID for the control of macro-defects on the inner surface of pipes [17] as a prototype for the above device. The basis of the design is a high-resolution video camera 1 placed coaxially in a cylindrical body 2. A transparent pipe 3 is fixed at one of the body ends. An annular groove 4 is placed at the side of the pipe in the body end where the LED light sources 5 are placed. Light flux from the light sources 5 is limited to the aperture annular diaphragm 6, which forms a sharp boundary between the illuminated area and the shadow area. The light flux reflected from the pipe surface falls on a parabolic reflector 7, which directs the light flux to the sensor of the video camera 1. A cover 8 is required for the protection against mechanical effects on the external surface of the transparent pipe 3, and for the alignment of the target pipe with the video camera. The cover 8 has the length of 101 mm and the diameter of 60 mm. This is necessary to achieve the best alignment of the hole in the pipe and the cylindrical body 2 of the device. A handle 9 closes the cylindrical body 2. Inside the handle there is the channel 10 for the information and supply lines.
A high definition video camera Sony SNC-CH210 Network 1080p HD (manufacturer: SONY IPELA HD) was used in the developed ID. The protective body 2 of the video camera is made of fluoroplast-2 (TECAFLON PVDF) characterized by high strength, chemical resistance and low coefficient of friction on the steel surface. The light source used was SEL-2835-(4730-13000) -3V150 LEDs (manufacturer: SUNSHINE ELECTRONICS TRADING LIMITED) in the amount of 24 pieces, located around the circumference aligned with the symmetry axis of the video camera.
The transparent pipe 3 had the wall thickness of 3 mm and was made of transparent quartz glass of the grades KV according to GOST 15130-69 "Silica optical glass. General specifications". We explain the choice of the pipe 3 material by high abrasion resistance, low hygroscopicity and inertness towards residual heavy oil deposits, asphaltene sediments; asphaltene-resin-paraffin deposits on the surface of the hole after washing.  Figure 6. Design of the device for optical inspection of the inner surface of the pipe ends: аappearance of the device with the section of the handle; bthe device without the cover, parabolic reflector and transparent pipe; сthe device without the cover, parabolic reflector and annular groove, in the cylindrical body, with the body section. Legend: 1video camera; 2cylindrical body; 3transparent pipe; 4annular groove in the cylindrical body; 5 -LEDs; 6aperture annular diaphragm; 7parabolic reflector; 8cover; 9handle; 10channel.
The quartz pipe 3, the cap 8 and the parabolic reflector 7 are fastened together with the MMA glue in accordance with GOST 14887-80 "Optical adhesives. Types". The reason for the choice of the glue brand is the size of the optical elements.
The parabolic reflector 7 is made of copper alloy M0b (American analogue: C10100) by way of machining in accordance with GOST 859-2001 "Copper. Grades". We explain the choice of the parabolic reflector 7 material by the following reasons: -when lathe turning the M0b alloy, the low level of roughness is achieved; -high chemical inertness of the alloy. The remaining elements of the ID are made of aluminum alloy. The aperture annular diaphragm 6 forms a light flux directed at the angle of 45° to the target surface of the hole. The light flux reflected from the pipe surface falls on the parabolic reflector 7 forming a ghost image and a direct image of the defect (Fig. 7). The surface parallel to the optical axis of the video camera 1 is observed using a  Legend: 1video camera; 2cylindrical body; 3transparent pipe; 4annular groove in the cylindrical body; 5 -LEDs; 6aperture annular diaphragm; 7parabolic reflector; 8cover; 9handle; 10channel.
The influence of the position of the corrosion pit on the surface of the hole relative to the horizon line was analyzed using the CNC lathes. First, lathe jaws were re-cut in the chuck, then the bench was fastened (Fig. 8). As a result, the bench hole surface runout was 5 μm. The coordinate "C" of the lathes allowed for discrete rotation of the chunk at an angle from 0 to 180. The position of the ID remained unchanged (Fig. 2b). The rotation of the bench pipe leads to the changes in the distances between the corrosion cavity model and the surface of the ID. Thus, we simulated the effect of the following disturbances on the accuracy of the corrosion cavity depth measurement: -out-of-roundness of the hole shape (Fig. 4b).
-change of the hole diameter within the width of the ring of light that illuminates the target surface of the hole, or the pipe bend (Fig. 4c). Based on the results thus obtained, we developed a calibration chart. In order to estimate the influence of the tilt ( ) of the ID body axis relative to the hole surface, we defined its limits of variation for the hole with the diameter of 62 mm. . Fig. 9 shows two limits of the position of the ID in the oil pipe. We shall note that the distance between the cover 8 and the end face of the aperture annular diaphragm 6 is 132 mm. We used gauges to carry out a fixed change of the angle ψ (GOST 8925-68 "Flat clearance gauges for machine retaining devices. Design").
Turning of the ID shown in Fig. 9a, b is a disturbance that reduces the accuracy of the corrosive pit depth control. The presence of the angle leads to the displacement of the circles O1, O2 and O3 relative to each other (Fig. 4a). We have developed a calibration chart in order to reduce the influence of the presence of the angle on the ID accuracy.  Figure 9. The scheme for determining the limit angles of tilt of the ID body axis relative to the hole surface: ainsertion of the ID into the hole, angle : bmaximum insertion of the ID into the hole, angle .
We estimated the average sensitivity of the ID for each depth of the corrosion pit model using the Student's t-test. Therewith, the reliability of the results corresponded to the significance level p = 0.05. Each test of the ID was repeated at least 10 times.

Results and discussion
When moving the ID along the axis of the bench hole shown in Fig. 3, the video camera 1 captures the video sequence. Fig. 10 shows the video sequence of the surface defect model. The model of the corrosion pit is located within the boundaries of the ring of structured lighting (between the circles O1 and O2).
We analyzed the effect of the defect longitudinal length on its maximum depth. The inspection results are summarized in Table 1 (the location of the defect model corresponds to the angle ). Figure 10. Image of the surface defect on the bench when the ID passes the defect area.
We explain the dependence of the controlled defect depth on its longitudinal length observed from Table 1 by the measure of the angle of incidence of structured lighting on the hole surface. Part of the incident and the reflected lighting is scattered at the end of hole 2 (see Fig. 3) as a result of diffraction. In addition, the greater the depth of the defect, the more frequent are the re-reflections of the light flux from the walls of the hole 2. As a result, the sensitivity of the ID decreases. Our findings for the tubing  12 pipes 73 are as follows: for the corrosion pit with the diameter of 4 mm, the largest controlled defect length is 1.5 mm. In the process of tubing rejection, it is important to determine the maximum depth of the defects, which should not exceed 10% of the nominal pipe thickness with the low range limit of 0.3 ± 0.05 mm (GOST R 52203-2004 "Tubing and coupling. Specifications"). Such sensitivity of the ID is acceptable for the tubing repair operations. We changed the position of the corrosion pit model relative to the horizon line on the bench. The tests have shown that the most accurate measurement of the surface defect depth is possible when the angle φ = 0°. In this case, the corrosion pit model is under the ID. When the model of the surface defect is in this position, almost all of the reflected light from the surface of the corrosion pit falls on the sensor of the video camera. We have developed a calibration chart defining the dependence of the depth of the corrosion pit model on its position on the hole surface and on its length (Fig. 11). Figure  11 shows the dependence of the depth of the corrosion shell on the angle φ and its length, indicating the minimum and maximum deviation of the measurement results at each point of control. To correct the error of measurement of the corrosion pit depth caused by the misalignment of the ID axles and the hole, we have developed a calibration chart of the dependence of the surface defect depth on the angle ψ and on the length of the corrosion pit model (Fig. 12). Figure 12 shows a graph for φ=0° indicating the minimum and maximum deviation of the measurement results at each control point. The smallest error occurs in the ID position when ψ = 1.8 °. In this case, the misalignment of the axes of the holes and the ID is minimal.
The presence of two calibration charts (Fig. 11-12), as well as the analysis of the relative position of the circles O1, O2 and O3 on the image of the hole surface (Fig. 3a) allowed to determine the depth of corrosive pit (for the considered ranges of depths and the lengths of the surface defect model) with the accuracy of not less than 0.15 mm.
The accuracy of measurement of the depth of the hole surface defect can be increased. To achieve this, the models of corrosive cavities should have a more complex shape: cylindrical walls should not have an axis of symmetry and should not be perpendicular to the axis of the hole. In case of using the special equipment for inserting the ID into the tubing hole (a guide or a controlled linear drive), the measurement accuracy can be increased.
We also plan to use various forms of lighting with special-shaped LEDs [25][26][27][28][29][30][31]. Research in this direction will be continued and the results will be reported in our next publications.

Conclusion
The research of the device for optical inspection of the internal surface of the pipe ends showed the following: 1) the developed ID enables the control of the hole depth in manual mode with an accuracy of at least 0.15 mm, which is acceptable for the requirements of tubing repair companies; 2) the calibration of the ID on the bench allowed to reduce the measurement error caused by fluctuations in the size of the hole along its length and the tilt of the ID axis relative to the surface of the tubing hole; 3) changes in the material of the controlled tubing (carbon steel, stainless alloy, aluminum alloys, polymer) require new calibration of the ID; 4) the ID is able to determine the depth of the corrosion pit model up to 1.5 mm for the longitudinal length and transverse width of the defect estimated at 4 mm; 5) the use of a ring light source eliminates diffraction at the edges of the aperture ring and increases the device sensitivity. 6) the developed device can be used in other areas: inspection of holes made in reinforced concrete structures, surface of the holes of chemical production pipelines, GTE fuel system, etc. [32,33]. We believe that the accuracy of the device can be enhanced by using ultraviolet radiation as a light source. This will reduce the impact of stray lighting on the measurement accuracy. In addition, the use of the device with indicator liquids will improve the accuracy of control of the hole surface of the pipes. In this case, it is possible to determine the type of corrosion by the color of the target surface, i.e. it is possible to determine the chemical agent that caused the corrosion. The authors suggest to continue the research in these areas.