The Research of Ellipse Parameter Fitting Algorithm of Ultrasonic Imaging Logging in the Casing Hole

In order to estimate intensity and direction of pressure acted on oil well in horizontal, this paper proposes an algorithm of ellipse fitting based on least square method for sections of oil well with ultrasonic imaging logging data. Five parameters about ellipse corresponding to the sections of oil well are extracted and their geometry deformations and direction are estimated. The tested results show that the fitting algorithm is robust and the estimating error of parameter is small, which have very important practical significance on processing the well logging.


Introduction
The acoustic image log is an acoustic televiewer or ultrasonic borehole imaging tool.The tool uses a rotating acoustic transducer/receiver operating at ultrasonic frequencies.The travel time of the sound from the transducer to the wellbore wall and back to the receiver is measured.This provides a complete image of wellbore diameter (a caliper log).Black colour indicates large diameter, and white is "near" bit size.Fractures and wellbore breakout are easily seen (black) [1] [2].In the casing hole, when the ultrasonic wave non-normal incidence is caused by the eccentric instrument, the amplitude of ultrasonic reflection wave from the inner wall will be reduced; the echo time will be not accurate; and can often appear two pieces of vertical black strips in the casing well.This two dark bands cover up a lot of real information wellbore casing.The log interpretation workers are unable to make the right judgments.Owing to the eccentricity of the instruments during the process of actual logging of-ten appear, it is an important challenge to find a method of eliminating eccentric time image dark band [3] [4].
During the process of well logging, ultrasonic transducer rotating scanning a circle gets the several time callback data in a week.According to these caliper callback time data can be calculated the well radius values, which provide the estimate data for the ellipse fitting of well section.This paper uses a least squares curve fitting method to calculate the center point, the major axis, minor axis and slope of the ellipse, and then judges the geometric deformation and direction of the well cross section using these parameters of the ellipse, further to determine whether a downhole instrument produce eccentric, which provides a good theoretical basis for the eccentric instrument correction.

The Instrument Eccentric Principle
In cased hole, when the downhole instrument generates eccentricity, acoustic transducer launch oblique incidence, the eccentric instrument will affect the ultrasonic echo amplitude and time.The following accounts for the eccentric effect on imaging from the principle of ultrasonic imaging.
When the device is the eccentric, the cross section of the well casing is shown in Figure 1(a).Transducer in the y direction is eccentric and the eccentricity distance is D. The incident and echo wave of transducer is shown in Figure 1(b), the instrument eccentric causes the non-normal incidence and reflection of the ultrasonic wave, even if the same conditions of reflection coefficient in the well week, the part reflection wave deviate the range accepted by transducer, the transducer can't receive the echo information.At the same time, the incident angle of the ultrasound wave is changed in the different rotational position because of the transducer eccentricity, the values of the echo amplitude is also changed in the same smoothness degree of the well week.
The ultrasonovision image caused by the tool eccentricity can often appear two pieces of vertical black strips in the casing well, the dark place is corresponding near the eccentric vertical direction.Therefore, in the case of a downhole instrument eccentric ultrasonic television image can no longer completely correctly reflect the acoustic impedance characteristics of the wall of well, the echo wave time cannot reflect the size of the well radius, which affects the interpretation and judgment of logging image.

Ellipse Fitting Algorithm
During the process of ultrasonic television imaging logging, ultrasonic transducer rotating scanning a circle gets the several time callback data in a week, which estimates the parameters for the ellipse fitting of well section.The elliptical curve fitting uses least squares fitting algorithm, the basic algorithm [5] is described as follows: Figure 2 show that gets N points echo time ( )  from the device center point to the wall of well, i V is the ultrasonic velocity in the mud.In (2) convert polar coordinates to rectangular coordinate system.  1, 2, , As we all known, arbitrary elliptic equations on the plane can be expressed as: Using N point data, constructing objective function is as follows: ( ) ( ) , , , , According to the principle of least squares, the F is minimize, there will be: From above, the normal equations are as follows: x y x y x y x y x y x y y x y y y x y x y x x y x x y y x y y y x y y x Solving the linear equations of order 5 in (6), thus gets the general elliptic quadratic coefficient A, B, C, D and E.
According to (7)-( 11), calculate the parameters of the ellipse as shown in Figure 3: the center coordinates (x 0 , y 0 ), the major axis a, the minor axis b, the angle between the long axis and x-axis θ.

Testing and Results
We performed experiments on simulated data and real data to show the performance of our proposed model.All numerical experiments were performed on 64-bit Windows 7 on a desktop with an Intel CPU at 3.0 GHz and 4 GB memory.
1) The testing of simulated data In order to verify the correctness of the algorithm, we produce a group data of ellipse according to the theory of elliptic equation model, and add the white Gaussian noise, then fit the ellipse curve according to the data with noise and without noise respectively.Figure 3 shows the results of fitting.Simulation results show that, without the noise the fitting parameters of elliptic equation to draw the curve is completely covered by the original elliptic curve, which shows to coincide; with the noise the fitting parameters of elliptic equations to draw the curve is also very well reflect the cross section shape of the original caliper curve.Therefore, Ellipse fitting method based on the least squares fitting well estimates the elliptic curve parameters, even if superposition noise is very big, the fitting algorithm is also very robust.
2) The testing of real data In order to verify the practicability and validity of the algorithm, we use the actual logging data to test the algorithm.Figure 4 shows the result of fitting ellipse for the real well data ×6 before and after delete the outliers.is the result of fitting after deleting the ouliers.The red line is the raw data, the blue point line is the well data of median filter, the blue lines is the well data after deleting the ouliers, the black lines is the curve according to the parameter of ellipse fitting.All the results show that the curve by fitted after deleting the ouliers respects the section shape of the well.

Conclusion
This paper fits ellipse for the oil well section based on the method of least squares and extracts five parameters of ellipse.From the testing results of theoretical model data and real data, the algorithm proposed by this paper is robust and the parameters extracted by this algorithm are accurate.According to those parameters of ellipse fitting, the geometric deformation and direction of the well cross section are estimated.So the information about horizontal pressure and direction can be obtained, meanwhile those parameters provide a good theoretical basis for the eccentric instrument correction.

Figure 1 .
Figure 1.(a) The section diagram of the instrument eccentric in the casing hole; (b) The amplitude diagram of Acoustic echo.

Figure 2 .
Figure 2. The ellipse in the rectangular coordinate system.

Figure 3 .
Figure 3. (a) The fitting result without the noise; (b) The fitting result with the noise.

Figure 4 .
Figure 4. (a) The fitting result of real data without deleting outliers; (b) The fitting result of real data with deleting outliers.

Figure 4 (
Figure 4(a) is the result of fitting after the median filter.Figure 4(b)is the result of fitting after deleting the ouliers.The red line is the raw data, the blue point line is the well data of median filter, the blue lines is the well data after deleting the ouliers, the black lines is the curve according to the parameter of ellipse fitting.All the results show that the curve by fitted after deleting the ouliers respects the section shape of the well.

Figure 4 (
Figure 4(a) is the result of fitting after the median filter.Figure 4(b)is the result of fitting after deleting the ouliers.The red line is the raw data, the blue point line is the well data of median filter, the blue lines is the well data after deleting the ouliers, the black lines is the curve according to the parameter of ellipse fitting.All the results show that the curve by fitted after deleting the ouliers respects the section shape of the well.